summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-08-06 23:32:52 +0200
committerHans Ulrich Niedermann <github@n-dimensional.de>2021-08-07 11:55:59 +0200
commit94efe00f0170f81dea85d6a0fe89b12111e98d19 (patch)
tree6cefe70b8b3ca68483c10b772cda94e5f5c8c60f /configure.ac
parent5c8c0538714b170ad83b2095dcf42838d663a3d3 (diff)
downloadlibgphoto2-94efe00f0170f81dea85d6a0fe89b12111e98d19.tar.gz
Use AC_SEARCH_LIBS to find where mmap(2) is defined
Use AC_SEARCH_LIBS to find whether mmap(2) in the standard library, or whether using mmap(2) requires linking against libmman. This avoids conditionally calling/expanding AM_CONDITIONAL which autoreconf (rightly) complains about. This also uses proper m4 quoting in all m4 macro arguments.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 13 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 0df0b7a31..8421f4bf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,9 +329,19 @@ AC_HEADER_DIRENT
AC_HEADER_STDC
# after _HEADER_STDC
AC_CHECK_HEADERS([sys/param.h sys/mman.h sys/select.h locale.h memory.h getopt.h unistd.h mcheck.h limits.h sys/time.h langinfo.h])
-AC_CHECK_LIB(mman, mmap, [
- AM_CONDITIONAL([HAVE_MMAN_LIB], [test x$ac_cv_lib_mman_mmap = xyes])
- ])
+
+dnl If sys/mman.h is present, check whether mmap requires the mman
+dnl library (see camlibs/st2205/st2205.c st2205_malloc_page_aligned()).
+MMAP_LIBS=""
+AS_VAR_IF([ac_cv_header_sys_mman_h], [yes], [dnl
+gp_saved_LIBS="$LIBS"
+LIBS=""
+AC_SEARCH_LIBS([mmap], [mman])
+MMAP_LIBS="$LIBS"
+LIBS="$gp_saved_LIBS"
+])dnl
+AC_SUBST([MMAP_LIBS])
+
AC_C_INLINE([])
AC_C_CONST([])
dnl FIXME: AC_STRUCT_TIMEZONE