X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/21c625fdd0fffffb8420ec25fbcba1aed7e05248..440cef5fc5147af9d49396b8828721676e312658:/configure.ac diff --git a/configure.ac b/configure.ac index db5f12149c..5e30c49f2d 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,9 @@ done AC_CONFIG_HEADERS(src/config.h:src/config.in) AC_CONFIG_SRCDIR(src/lisp.h) AC_CONFIG_AUX_DIR(build-aux) +dnl automake 1.13 and later understand this, making -I m4 unnecessary. +dnl With older versions this is a no-op. +AC_CONFIG_MACRO_DIR(m4) xcsdkdir= AC_CHECK_PROGS(XCRUN, [xcrun]) @@ -293,6 +296,9 @@ otherwise for the first of `gfile' or `inotify' that is usable.]) dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals]) +## This might be a 'configure' arg, e.g., autogen.sh might set it. +AC_SUBST([ACLOCAL_PATH]) + ## Makefile.in needs the cache file name. AC_SUBST(cache_file) @@ -302,15 +308,6 @@ OPTION_DEFAULT_ON([compress-install], [don't compress some files (.el, .info, etc.) when installing. Equivalent to: make GZIP_PROG= install]) -AC_ARG_WITH([pkg-config-prog],dnl -[AS_HELP_STRING([--with-pkg-config-prog=FILENAME], - [file name of pkg-config for finding GTK and librsvg])]) -if test "X${with_pkg_config_prog}" != X; then - if test "${with_pkg_config_prog}" != yes; then - PKG_CONFIG="${with_pkg_config_prog}" - fi -fi - AC_ARG_WITH(gameuser,dnl [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])]) test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \ @@ -505,7 +502,7 @@ case "${canonical}" in ;; ## OpenBSD ports - *-*-openbsd* ) + *-*-openbsd* | *-*-mirbsd* ) opsys=openbsd ;; @@ -765,56 +762,12 @@ AC_ARG_ENABLE([gcc-warnings], [gl_gcc_warnings=no] ) -AC_ARG_ENABLE(link-time-optimization, -[AS_HELP_STRING([--enable-link-time-optimization], - [build emacs with link-time optimization. - This is supported only for GCC since 4.5.0.])], -if test "${enableval}" != "no"; then - AC_MSG_CHECKING([whether link-time optimization is supported]) - ac_lto_supported=no - if test x$GCC = xyes; then - CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` - if test x$CPUS != x; then - LTO="-flto=$CPUS" - else - LTO="-flto" - fi - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $LTO" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [ac_lto_supported=yes], [ac_lto_supported=no]) - CFLAGS="$old_CFLAGS" - fi - AC_MSG_RESULT([$ac_lto_supported]) - if test "$ac_lto_supported" = "yes"; then - CFLAGS="$CFLAGS $LTO" - fi -fi) - -# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) -# ------------------------------------------------ -# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. -# Otherwise, run RUN-IF-NOT-FOUND. -AC_DEFUN([gl_GCC_VERSION_IFELSE], - [AC_PREPROC_IFELSE( - [AC_LANG_PROGRAM( - [[ -#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__) -/* ok */ -#else -# error "your version of gcc is older than $1.$2" -#endif - ]]), - ], [$3], [$4]) - ] -) - # clang is unduly picky about some things. AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #ifndef __clang__ - #error "not clang" + error "not clang"; #endif ]])], [emacs_cv_clang=yes], @@ -927,7 +880,58 @@ else AC_SUBST([GNULIB_WARN_CFLAGS]) fi +edit_cflags=" + s,///*,/,g + s/^/ / + s/ -I/ $isystem/g + s/^ // +" +AC_ARG_ENABLE(link-time-optimization, +[AS_HELP_STRING([--enable-link-time-optimization], + [build emacs with link-time optimization. + This is supported for gcc since 4.5.0 and clang. + Note that clang support is experimental - see INSTALL])], +if test "${enableval}" != "no"; then + ac_lto_supported=no + if test $emacs_cv_clang = yes; then + AC_MSG_CHECKING([whether link-time optimization is supported by clang]) + GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so 2>/dev/null` + if test -x "$GOLD_PLUGIN"; then + LTO="-flto" + fi + elif test x$GCC = xyes; then + AC_MSG_CHECKING([whether link-time optimization is supported by gcc]) + CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` + if test x$CPUS != x; then + LTO="-flto=$CPUS" + else + LTO="-flto" + fi + else + AC_MSG_ERROR([Link-time optimization is not supported with your compiler.]) + fi + if test -z "$LTO"; then + ac_lto_supported=no + else + old_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $LTO" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [ac_lto_supported=yes], [ac_lto_supported=no]) + CFLAGS="$old_CFLAGS" + fi + AC_MSG_RESULT([$ac_lto_supported]) + if test "$ac_lto_supported" = "yes"; then + CFLAGS="$CFLAGS $LTO" + if test x$emacs_cv_clang = xyes; then + AC_MSG_WARN([Please read INSTALL before using link-time optimization with clang]) + # WARNING: 'ar --plugin ...' doesn't work without + # command, so plugin name is appended to ARFLAGS. + ARFLAGS="cru --plugin $GOLD_PLUGIN" + RANLIB="$RANLIB --plugin $GOLD_PLUGIN" + fi + fi +fi) dnl Some other nice autoconf tests. dnl These are commented out, since gl_EARLY and/or Autoconf already does them. @@ -950,11 +954,21 @@ rm -f conf$$ conf$$.file LN_S_FILEONLY='cp -p' +dnl On MinGW, ensure we will call the MSYS /bin/ln.exe, not some +dnl random program in the current directory. if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then - LN_S_FILEONLY='ln -s' + if test "$opsys" = "mingw32"; then + LN_S_FILEONLY='/bin/ln -s' + else + LN_S_FILEONLY='ln -s' + fi elif ln conf$$.file conf$$ 2>/dev/null; then - LN_S_FILEONLY=ln + if test "$opsys" = "mingw32"; then + LN_S_FILEONLY=/bin/ln + else + LN_S_FILEONLY=ln + fi fi fi @@ -976,7 +990,7 @@ dnl executables at "make install" time. dnl See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00475.html dnl for more details. if test "$opsys" = "mingw32"; then - LN_S="ln" + LN_S="/bin/ln" fi AC_PATH_PROG(INSTALL_INFO, install-info, :, @@ -1116,7 +1130,7 @@ AC_CACHE_CHECK([whether addresses are sanitized], #endif #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer) #else - #error "Addresses are not sanitized." + error "Addresses are not sanitized."; #endif ]])], [emacs_cv_sanitize_address=yes], @@ -1294,8 +1308,17 @@ AC_DEFUN([AC_TYPE_SIZE_T]) # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. AC_DEFUN([AC_TYPE_UID_T]) +# sqrt and other floating-point functions such as fmod and frexp +# are found in -lm on many systems. +OLD_LIBS=$LIBS +AC_SEARCH_LIBS([sqrt], [m]) +if test "X$LIBS" = "X$OLD_LIBS"; then + LIB_MATH= +else + LIB_MATH=$ac_cv_search_sqrt +fi +LIBS=$OLD_LIBS -LIB_MATH=-lm dnl Current possibilities handled by sed (aix4-2 -> aix, dnl gnu-linux -> gnu/linux, etc.): dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix. @@ -1336,65 +1359,42 @@ AC_SUBST(LIB_MATH) AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE", [The type of system you are compiling for; sets `system-type'.]) +m4_pattern_forbid([^PKG_]) + +AC_ARG_VAR(PKG_CONFIG_PATH, [Colon-separated list of directories +searched by pkg-config]) pre_PKG_CONFIG_CFLAGS=$CFLAGS pre_PKG_CONFIG_LIBS=$LIBS -AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - -dnl This function definition taken from Gnome 2.0 -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no - - if test "$PKG_CONFIG" = "no" ; then - ifelse([$4], , [AC_MSG_ERROR([ - *** The pkg-config script could not be found. Make sure it is in your path, or give the full name of pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog. Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4]) - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) - - if "$PKG_CONFIG" --exists "$2" 2>&AS_MESSAGE_LOG_FD && - $1_CFLAGS=`"$PKG_CONFIG" --cflags "$2" 2>&AS_MESSAGE_LOG_FD` && - $1_LIBS=`"$PKG_CONFIG" --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then - edit_cflags=" - s,///*,/,g - s/^/ / - s/ -I/ $isystem/g - s/^ // - " - $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"` - $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'` - AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS']) - succeeded=yes - else - AC_MSG_RESULT(no) - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. Do it in a subshell - ## to capture any diagnostics in invoking pkg-config. - $1_PKG_ERRORS=`("$PKG_CONFIG" --print-errors "$2") 2>&1` - ifelse([$4], ,echo "$$1_PKG_ERRORS",) - fi - - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4]) - fi -]) +PKG_PROG_PKG_CONFIG(0.9.0) + +dnl EMACS_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4) +dnl acts like PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, +dnl HAVE_GSTUFF=yes, HAVE_GSTUFF=no) -- see pkg-config man page -- +dnl except that it works around older pkg-config bugs and +dnl it postprocesses CFLAGS as needed for --enable-gcc-warnings. +dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that +dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no +dnl actions. +AC_DEFUN([EMACS_CHECK_MODULES], + [dnl pkg-config before 0.26 doesn't check exit status properly; see: + dnl https://bugs.freedesktop.org/show_bug.cgi?id=29801 + dnl Work around the bug by checking the status ourselves. + emacs_check_module_ok=false + AS_IF([test -n "$PKG_CONFIG" && + { $PKG_CONFIG --atleast-pkgconfig-version 0.26 || + { $PKG_CONFIG --cflags "$2" && $PKG_CONFIG --libs "$2"; } + } >/dev/null 2>&AS_MESSAGE_LOG_FD], + [PKG_CHECK_MODULES([$1], [$2], + [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"` + emacs_check_module_ok=:], + [:])]) + if $emacs_check_module_ok; then + m4_default([$3], [HAVE_$1=yes]) + else + m4_default([$4], [HAVE_$1=no]) + fi]) HAVE_SOUND=no if test "${with_sound}" != "no"; then @@ -1422,7 +1422,7 @@ if test "${with_sound}" != "no"; then if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then ALSA_REQUIRED=1.0.0 ALSA_MODULES="alsa >= $ALSA_REQUIRED" - PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no) + EMACS_CHECK_MODULES([ALSA], [$ALSA_MODULES]) if test $HAVE_ALSA = yes; then SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" @@ -1703,7 +1703,7 @@ fail; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 ; /* OK */ #else -#error "OSX 10.4 or newer required" + error "OSX 10.4 or newer required"; #endif #endif ])], @@ -1721,7 +1721,7 @@ fail; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 ; /* OK */ #else -#error "OSX 10.5 not found" + error "OSX 10.5 not found"; #endif #endif ])], @@ -1839,7 +1839,6 @@ if test "${HAVE_W32}" = "yes"; then x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;; *) EMACS_MANIFEST="emacs-x86.manifest" ;; esac - UPDATE_MANIFEST=update-game-score.exe.manifest if test "${opsys}" = "cygwin"; then W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool" @@ -1847,6 +1846,7 @@ if test "${HAVE_W32}" = "yes"; then # the rc file), not a linker script. W32_RES_LINK="-Wl,emacs.res" else + UPDATE_MANIFEST=update-game-score.exe.manifest W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o" W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32" W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10" @@ -2044,53 +2044,32 @@ fi LIBS="$LIBS_SYSTEM $LIBS" -dnl If found, this adds -ldnet to LIBS, which Autoconf uses for checks. -AC_CHECK_LIB(dnet, dnet_ntoa) -dnl This causes -lresolv to get used in subsequent tests, -dnl which causes failures on some systems such as HPUX 9. -dnl AC_CHECK_LIB(resolv, gethostbyname) - dnl FIXME replace main with a function we actually want from this library. AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd") -dnl Check if pthreads is available. +dnl Check for the POSIX thread library. LIB_PTHREAD= AC_CHECK_HEADERS_ONCE(pthread.h) if test "$ac_cv_header_pthread_h"; then dnl gmalloc.c uses pthread_atfork, which is not available on older-style dnl hosts such as MirBSD 10, so test for pthread_atfork instead of merely - dnl testing for pthread_self if Emacs uses gmalloc.c. + dnl testing for pthread_kill if Emacs uses gmalloc.c. if test "$GMALLOC_OBJ" = gmalloc.o; then emacs_pthread_function=pthread_atfork else - emacs_pthread_function=pthread_self + emacs_pthread_function=pthread_kill fi - AC_CHECK_LIB(pthread, $emacs_pthread_function, HAVE_PTHREAD=yes) -fi -if test "$HAVE_PTHREAD" = yes; then - case "${canonical}" in - *-hpux*) ;; - *) LIB_PTHREAD="-lpthread" - LIBS="$LIB_PTHREAD $LIBS" ;; - esac - AC_DEFINE(HAVE_PTHREAD, 1, [Define to 1 if you have pthread (-lpthread).]) + OLD_LIBS=$LIBS + AC_SEARCH_LIBS([$emacs_pthread_function], [pthread], + [AC_DEFINE([HAVE_PTHREAD], [1], + [Define to 1 if you have pthread (-lpthread).])]) + if test "X$LIBS" != "X$OLD_LIBS"; then + eval LIB_PTHREAD=\$ac_cv_search_$emacs_pthread_function + fi + LIBS=$OLD_LIBS fi AC_SUBST([LIB_PTHREAD]) -AC_CHECK_LIB(pthreads, cma_open) - -## Note: when using cpp in s/aix4.2.h, this definition depended on -## HAVE_LIBPTHREADS. That was not defined earlier in configure when -## the system file was sourced. Hence the value of LIBS_SYSTEM -## added to LIBS in configure would never contain the pthreads part, -## but the value used in Makefiles might. FIXME? -## -## -lpthreads seems to be necessary for Xlib in X11R6, and should -## be harmless on older versions of X where it happens to exist. -test "$opsys" = "aix4-2" && \ - test $ac_cv_lib_pthreads_cma_open = yes && \ - LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads" - dnl Check for need for bigtoc support on IBM AIX case ${host_os} in @@ -2107,12 +2086,12 @@ aix*) ;; esac -# Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets -# used for the tests that follow. We set them back to REAL_CFLAGS and -# REAL_CPPFLAGS later on. +# Change CFLAGS, CPPFLAGS, and LIBS temporarily so that C_SWITCH_X_SITE +# is for the tests that follow. We set them back later on. REAL_CFLAGS="$CFLAGS" REAL_CPPFLAGS="$CPPFLAGS" +REAL_LIBS="$LIBS" if test "${HAVE_X11}" = "yes"; then DEFS="$C_SWITCH_X_SITE $DEFS" @@ -2137,12 +2116,8 @@ if test "${HAVE_X11}" = "yes"; then [xgnu_linux_first_failure=no], [xgnu_linux_first_failure=yes]) if test "${xgnu_linux_first_failure}" = "yes"; then - OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE" - OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE" OLD_CPPFLAGS="$CPPFLAGS" OLD_LIBS="$LIBS" - LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout" - C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout" CPPFLAGS="$CPPFLAGS -b i486-linuxaout" LIBS="$LIBS -b i486-linuxaout" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], @@ -2151,15 +2126,15 @@ if test "${HAVE_X11}" = "yes"; then [xgnu_linux_second_failure=yes]) if test "${xgnu_linux_second_failure}" = "yes"; then # If we get the same failure with -b, there is no use adding -b. - # So take it out. This plays safe. - LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE" - C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE" - CPPFLAGS="$OLD_CPPFLAGS" - LIBS="$OLD_LIBS" + # So leave it out. This plays safe. AC_MSG_RESULT(no) else + LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout" + C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout" AC_MSG_RESULT(yes) fi + CPPFLAGS=$OLD_CPPFLAGS + LIBS=$OLD_LIBS else AC_MSG_RESULT(no) fi @@ -2215,7 +2190,7 @@ if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = RSVG_REQUIRED=2.11.0 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED" - PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, HAVE_RSVG=yes, :) + EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE]) AC_SUBST(RSVG_CFLAGS) AC_SUBST(RSVG_LIBS) @@ -2226,7 +2201,6 @@ if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = if test "${opsys}" = "mingw32"; then RSVG_LIBS= fi - LIBS="$RSVG_LIBS $LIBS" fi fi fi @@ -2234,20 +2208,22 @@ fi HAVE_IMAGEMAGICK=no if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_imagemagick}" != "no"; then - ## 6.2.8 is the earliest version known to work, but earlier versions - ## might work - let us know if you find one. - ## 6.0.7 does not work. See bug#7955. + ## 6.3.5 is the earliest version known to work; see Bug#17339. ## 6.8.2 makes Emacs crash; see Bug#13867. - IMAGEMAGICK_MODULE="Wand >= 6.2.8 Wand != 6.8.2" - PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :) + IMAGEMAGICK_MODULE="Wand >= 6.3.5 Wand != 6.8.2" + EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE]) AC_SUBST(IMAGEMAGICK_CFLAGS) AC_SUBST(IMAGEMAGICK_LIBS) if test $HAVE_IMAGEMAGICK = yes; then AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.]) + OLD_CFLAGS=$CFLAGS + OLD_LIBS=$LIBS CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS" LIBS="$IMAGEMAGICK_LIBS $LIBS" AC_CHECK_FUNCS(MagickExportImagePixels MagickMergeImageLayers) + CFLAGS=$OLD_CFLAGS + LIBS=$OLD_LIBS fi fi fi @@ -2265,7 +2241,8 @@ if test "${opsys}" != "mingw32"; then GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" dnl Checks for libraries. - PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no) + EMACS_CHECK_MODULES([GTK], [$GTK_MODULES], + [pkg_check_gtk=yes], [pkg_check_gtk=no]) if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then AC_MSG_ERROR($GTK_PKG_ERRORS) fi @@ -2292,7 +2269,8 @@ if test "${opsys}" != "mingw32"; then GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" dnl Checks for libraries. - PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no) + EMACS_CHECK_MODULES([GTK], [$GTK_MODULES], + [pkg_check_gtk=yes], [pkg_check_gtk=no]) if test "$pkg_check_gtk" = "no" && { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; } then @@ -2302,10 +2280,12 @@ if test "${opsys}" != "mingw32"; then fi fi +OLD_CFLAGS=$CFLAGS +OLD_LIBS=$LIBS + if test x"$pkg_check_gtk" = xyes; then AC_SUBST(GTK_LIBS) - C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl Try to compile a simple GTK program. @@ -2337,6 +2317,7 @@ if test x"$pkg_check_gtk" = xyes; then AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]); fi else + C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS" HAVE_GTK=yes AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.]) GTK_OBJ="gtkutil.o $GTK_OBJ" @@ -2405,40 +2386,46 @@ if test "${HAVE_GTK}" = "yes"; then term_header=gtkutil.h fi +CFLAGS=$OLD_CFLAGS +LIBS=$OLD_LIBS + dnl D-Bus has been tested under GNU/Linux only. Must be adapted for dnl other platforms. HAVE_DBUS=no DBUS_OBJ= if test "${with_dbus}" = "yes"; then - PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no) + EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0]) if test "$HAVE_DBUS" = yes; then - LIBS="$LIBS $DBUS_LIBS" AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.]) dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1. dnl dbus_type_is_valid and dbus_validate_* have been introduced in dnl D-Bus 1.5.12. + OLD_LIBS=$LIBS + LIBS="$LIBS $DBUS_LIBS" AC_CHECK_FUNCS(dbus_watch_get_unix_fd \ dbus_type_is_valid \ dbus_validate_bus_name \ dbus_validate_path \ dbus_validate_interface \ dbus_validate_member) + LIBS=$OLD_LIBS DBUS_OBJ=dbusbind.o fi fi +AC_SUBST(DBUS_CFLAGS) +AC_SUBST(DBUS_LIBS) AC_SUBST(DBUS_OBJ) dnl GSettings has been tested under GNU/Linux only. HAVE_GSETTINGS=no if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then - PKG_CHECK_MODULES(GSETTINGS, gio-2.0 >= 2.26, HAVE_GSETTINGS=yes, HAVE_GSETTINGS=no) + EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26]) if test "$HAVE_GSETTINGS" = "yes"; then old_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $GSETTINGS_CFLAGS" old_LIBS=$LIBS LIBS="$LIBS $GSETTINGS_LIBS" AC_MSG_CHECKING([whether GSettings is in gio]) - GSETTINGS_COMPILES=no AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[/* Check that gsettings really is present. */ @@ -2449,10 +2436,10 @@ if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then GSettings *settings; GVariant *val = g_settings_get_value (settings, ""); ]])], - [GSETTINGS_COMPILES=yes]) - AC_MSG_RESULT([$GSETTINGS_COMPILES]) + [], HAVE_GSETTINGS=no) + AC_MSG_RESULT([$HAVE_GSETTINGS]) - if test "$GSETTINGS_COMPILES" = "yes"; then + if test "$HAVE_GSETTINGS" = "yes"; then AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.]) SETTINGS_CFLAGS="$GSETTINGS_CFLAGS" SETTINGS_LIBS="$GSETTINGS_LIBS" @@ -2466,7 +2453,7 @@ dnl GConf has been tested under GNU/Linux only. dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6. HAVE_GCONF=no if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then - PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no) + EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13]) if test "$HAVE_GCONF" = yes; then AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.]) dnl Newer GConf doesn't link with g_objects, so this is not defined. @@ -2476,7 +2463,7 @@ if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then fi if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then - PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.0, HAVE_GOBJECT=yes, HAVE_GOBJECT=no) + EMACS_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0]) if test "$HAVE_GOBJECT" = "yes"; then SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS" SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS" @@ -2507,12 +2494,14 @@ AC_SUBST(LIBSELINUX_LIBS) HAVE_GNUTLS=no HAVE_GNUTLS3=no if test "${with_gnutls}" = "yes" ; then - PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], HAVE_GNUTLS3=yes, HAVE_GNUTLS3=no) + EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], + [HAVE_GNUTLS3=yes], [HAVE_GNUTLS3=no]) if test "${HAVE_GNUTLS3}" = "yes"; then AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.]) HAVE_GNUTLS="yes" else - PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no) + EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], + [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no]) fi if test "${HAVE_GNUTLS}" = "yes"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) @@ -2521,9 +2510,6 @@ if test "${with_gnutls}" = "yes" ; then # Windows loads GnuTLS dynamically if test "${opsys}" = "mingw32"; then LIBGNUTLS_LIBS= - else - CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" - LIBS="$LIBGNUTLS_LIBS $LIBS" fi fi @@ -2557,7 +2543,7 @@ dnl only sense when glib has been compiled with inotify support. How dnl to check? case $with_file_notification,$NOTIFY_OBJ in gfile, | yes,) - PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.24, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no) + EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24]) if test "$HAVE_GFILENOTIFY" = "yes"; then AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.]) NOTIFY_OBJ=gfilenotify.o @@ -2646,6 +2632,7 @@ fi X_TOOLKIT_TYPE=$USE_X_TOOLKIT LIBXTR6= +LIBXMU= if test "${USE_X_TOOLKIT}" != "none"; then AC_MSG_CHECKING(X11 toolkit version) AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6, @@ -2672,37 +2659,20 @@ dnl If using toolkit, check whether libXmu.a exists. dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link. OLDLIBS="$LIBS" if test x$HAVE_X11XTR6 = xyes; then - LIBS="-lXt -lSM -lICE $LIBS" + OTHERLIBS='-lXt -lSM -lICE' else - LIBS="-lXt $LIBS" + OTHERLIBS='-lXt' + fi + AC_SEARCH_LIBS([XmuConvertStandardSelection], [Xmu], [], [], [$OTHERLIBS]) + if test "X$LIBS" != "X$OLDLIBS"; then + LIBXMU=$ac_cv_search_XmuConvertStandardSelection fi - AC_CHECK_LIB(Xmu, XmuConvertStandardSelection) - test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS" - dnl ac_cv_lib_Xmu_XmuConvertStandardSelection is also referenced below. + LIBS=$OLDLIBS + dnl ac_cv_search_XmuConvertStandardSelection is also referenced below. fi AC_SUBST(LIBXTR6) - -dnl FIXME the logic here seems weird, but this is what cpp was doing. -dnl Why not just test for libxmu in the normal way? -LIBXMU=-lXmu -case $opsys in - ## These systems don't supply Xmu. - hpux* | aix4-2 ) - test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU= - ;; - mingw32 ) - LIBXMU= - ;; -esac AC_SUBST(LIBXMU) -# On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D. -if test "${HAVE_X11}" = "yes"; then - if test "${USE_X_TOOLKIT}" != "none"; then - AC_CHECK_LIB(Xext, XShapeQueryExtension) - fi -fi - LIBXP= if test "${USE_X_TOOLKIT}" = "MOTIF"; then # OpenMotif may be installed in such a way on some GNU/Linux systems. @@ -2847,7 +2817,8 @@ fi ### Start of font-backend (under X11) section. if test "${HAVE_X11}" = "yes"; then - PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no) + EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0], + [HAVE_FC=yes], [HAVE_FC=no]) ## Use -lXft if available, unless `--with-xft=no'. HAVE_XFT=maybe @@ -2856,7 +2827,7 @@ if test "${HAVE_X11}" = "yes"; then fi if test "x${with_xft}" != "xno"; then - PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no) + EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no]) ## Because xftfont.c uses XRenderQueryExtension, we also ## need to link to -lXrender. HAVE_XRENDER=no @@ -2877,11 +2848,10 @@ if test "${HAVE_X11}" = "yes"; then AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.]) AC_SUBST(XFT_LIBS) C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS" - else - CPPFLAGS="$OLD_CPPFLAGS" - CFLAGS="$OLD_CFLAGS" - LIBS="$OLD_LIBS" fi # "${HAVE_XFT}" = "yes" + CPPFLAGS=$OLD_CPPFLAGS + CFLAGS=$OLD_CFLAGS + LIBS=$OLD_LIBS fi # "$HAVE_XFT" != no fi # "x${with_xft}" != "xno" @@ -2896,8 +2866,7 @@ if test "${HAVE_X11}" = "yes"; then dnl ftfont.o: undefined reference to symbol 'FT_New_Face' dnl if -lfreetype is not specified. dnl The following is needed to set FREETYPE_LIBS. - PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes, - HAVE_FREETYPE=no) + EMACS_CHECK_MODULES([FREETYPE], [freetype2]) test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype) fi @@ -2907,8 +2876,7 @@ if test "${HAVE_X11}" = "yes"; then AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if using the freetype and fontconfig libraries.]) if test "${with_libotf}" != "no"; then - PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes, - HAVE_LIBOTF=no) + EMACS_CHECK_MODULES([LIBOTF], [libotf]) if test "$HAVE_LIBOTF" = "yes"; then AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.]) AC_CHECK_LIB(otf, OTF_get_variation_glyphs, @@ -2927,7 +2895,7 @@ if test "${HAVE_X11}" = "yes"; then HAVE_M17N_FLT=no if test "${HAVE_LIBOTF}" = yes; then if test "${with_m17n_flt}" != "no"; then - PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no) + EMACS_CHECK_MODULES([M17N_FLT], [m17n-flt]) if test "$HAVE_M17N_FLT" = "yes"; then AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.]) fi @@ -3079,60 +3047,6 @@ elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then fi AC_SUBST(LIBJPEG) -### Use -lpng if available, unless `--with-png=no'. -### mingw32 doesn't use -lpng, since it loads the library dynamically. -HAVE_PNG=no -LIBPNG= -if test "${opsys}" = "mingw32"; then - if test "${with_png}" != "no"; then - AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no) - fi - if test "${HAVE_PNG}" = "yes"; then - AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).]) - - AC_CHECK_DECL(png_longjmp, - [], - [AC_DEFINE(PNG_DEPSTRUCT, [], - [Define to empty to suppress deprecation warnings when building - with --enable-gcc-warnings and with libpng versions before 1.5, - which lack png_longjmp.])], - [[#ifdef HAVE_LIBPNG_PNG_H - # include - #else - # include - #endif - ]]) - fi -elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then - if test "${with_png}" != "no"; then - # Debian unstable as of July 2003 has multiple libpngs, and puts png.h - # in /usr/include/libpng. - AC_CHECK_HEADERS(png.h libpng/png.h, break) - if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then - AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm) - fi - fi - - if test "${HAVE_PNG}" = "yes"; then - AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).]) - LIBPNG="-lpng -lz -lm" - - AC_CHECK_DECL(png_longjmp, - [], - [AC_DEFINE(PNG_DEPSTRUCT, [], - [Define to empty to suppress deprecation warnings when building - with --enable-gcc-warnings and with libpng versions before 1.5, - which lack png_longjmp.])], - [[#ifdef HAVE_LIBPNG_PNG_H - # include - #else - # include - #endif - ]]) - fi -fi -AC_SUBST(LIBPNG) - HAVE_ZLIB=no LIBZ= if test "${with_zlib}" != "no"; then @@ -3152,6 +3066,60 @@ if test "${HAVE_ZLIB}" = "yes"; then fi AC_SUBST(LIBZ) +### Use -lpng if available, unless `--with-png=no'. +HAVE_PNG=no +LIBPNG= +PNG_CFLAGS= +if test "${NS_IMPL_COCOA}" = yes; then + : # Nothing to do +elif test "${with_png}" != no; then + # mingw32 loads the library dynamically. + if test "$opsys" = mingw32; then + AC_CHECK_HEADER([png.h], [HAVE_PNG=yes]) + elif png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` && + png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` + then + HAVE_PNG=yes + PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` + LIBPNG=$png_libs + else + # libpng-config does not work; configure by hand. + # Debian unstable as of July 2003 has multiple libpngs, and puts png.h + # in /usr/include/libpng. + AC_CHECK_HEADERS([png.h libpng/png.h], + [AC_CHECK_LIB([png], [png_get_channels], + [HAVE_PNG=yes + LIBPNG='-lpng' + if test "$ac_cv_header_png_h" != yes; then + PNG_CFLAGS=-I/usr/include/libpng + fi + break], + [], [-lz -lm])]) + fi + # $LIBPNG requires explicit -lz in some cases. + # We don't know what those cases are, exactly, so play it safe and + # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ. + if test -n "$LIBPNG" && test -z "$LIBZ"; then + LIBPNG="$LIBPNG -lz" + fi +fi +if test $HAVE_PNG = yes; then + AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.]) + + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $PNG_CFLAGS" + AC_CHECK_DECL([png_longjmp], + [], + [AC_DEFINE([PNG_DEPSTRUCT], [], + [Define to empty to suppress deprecation warnings when building + with --enable-gcc-warnings and with libpng versions before 1.5, + which lack png_longjmp.])], + [[#include + ]]) + CFLAGS=$SAVE_CFLAGS +fi +AC_SUBST(LIBPNG) +AC_SUBST(PNG_CFLAGS) ### Use -ltiff if available, unless `--with-tiff=no'. ### mingw32 doesn't use -ltiff, since it loads the library dynamically. @@ -3284,10 +3252,6 @@ if test "${HAVE_X11}" = "yes"; then if test "${HAVE_X_SM}" = "yes"; then AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).]) LIBXSM="-lSM -lICE" - case "$LIBS" in - *-lSM*) ;; - *) LIBS="$LIBXSM $LIBS" ;; - esac fi fi AC_SUBST(LIBXSM) @@ -3297,14 +3261,13 @@ HAVE_XRANDR=no if test "${HAVE_X11}" = "yes"; then XRANDR_REQUIRED=1.2.2 XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED" - PKG_CHECK_MODULES(XRANDR, $XRANDR_MODULES, HAVE_XRANDR=yes, HAVE_XRANDR=no) + EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES]) if test $HAVE_XRANDR = no; then # Test old way in case pkg-config doesn't have it (older machines). AC_CHECK_HEADER(X11/extensions/Xrandr.h, [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)]) if test $HAVE_XRANDR = yes; then XRANDR_LIBS=-lXrandr - AC_SUBST(XRANDR_LIBS) fi fi if test $HAVE_XRANDR = yes; then @@ -3319,35 +3282,57 @@ if test "${HAVE_X11}" = "yes"; then AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.]) fi fi +AC_SUBST(XRANDR_CFLAGS) +AC_SUBST(XRANDR_LIBS) ### Use Xinerama (-lXinerama) if available HAVE_XINERAMA=no if test "${HAVE_X11}" = "yes"; then XINERAMA_REQUIRED=1.0.2 XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED" - PKG_CHECK_MODULES(XINERAMA, $XINERAMA_MODULES, HAVE_XINERAMA=yes, - HAVE_XINERAMA=no) + EMACS_CHECK_MODULES([XINERAMA], [$XINERAMA_MODULES]) if test $HAVE_XINERAMA = no; then # Test old way in case pkg-config doesn't have it (older machines). AC_CHECK_HEADER(X11/extensions/Xinerama.h, [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)]) if test $HAVE_XINERAMA = yes; then XINERAMA_LIBS=-lXinerama - AC_SUBST(XINERAMA_LIBS) fi fi if test $HAVE_XINERAMA = yes; then AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.]) fi fi +AC_SUBST(XINERAMA_CFLAGS) +AC_SUBST(XINERAMA_LIBS) +### Use Xfixes (-lXfixes) if available +HAVE_XFIXES=no +if test "${HAVE_X11}" = "yes"; then + XFIXES_REQUIRED=4.0.0 + XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED" + EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES]) + if test $HAVE_XFIXES = no; then + # Test old way in case pkg-config doesn't have it (older machines). + AC_CHECK_HEADER(X11/extensions/Xfixes.h, + [AC_CHECK_LIB(Xfixes, XFixesHideCursor, HAVE_XFIXES=yes)]) + if test $HAVE_XFIXES = yes; then + XFIXES_LIBS=-lXfixes + fi + fi + if test $HAVE_XFIXES = yes; then + AC_DEFINE(HAVE_XFIXES, 1, [Define to 1 if you have the Xfixes extension.]) + fi +fi +AC_SUBST(XFIXES_CFLAGS) +AC_SUBST(XFIXES_LIBS) ### Use libxml (-lxml2) if available ### mingw32 doesn't use -lxml2, since it loads the library dynamically. HAVE_LIBXML2=no if test "${with_xml2}" != "no"; then ### I'm not sure what the version number should be, so I just guessed. - PKG_CHECK_MODULES(LIBXML2, libxml-2.0 > 2.6.17, HAVE_LIBXML2=yes, HAVE_LIBXML2=no) + EMACS_CHECK_MODULES([LIBXML2], [libxml-2.0 > 2.6.17]) # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc. if test "${HAVE_LIBXML2}" != "yes" -a "$opsys" = "darwin"; then SAVE_CPPFLAGS="$CPPFLAGS" @@ -3363,8 +3348,8 @@ if test "${with_xml2}" != "no"; then fi if test "${HAVE_LIBXML2}" = "yes"; then if test "${opsys}" != "mingw32"; then - LIBS="$LIBXML2_LIBS $LIBS" - AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no) + AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no + [$LIBXML2_LIBS]) else LIBXML2_LIBS="" fi @@ -3393,19 +3378,17 @@ if test $emacs_cv_netdb_declares_h_errno = yes; then AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.]) fi -# sqrt and other floating-point functions such as fmod and frexp -# are found in -lm on most systems, but mingw32 doesn't use -lm. -if test "${opsys}" != "mingw32"; then - AC_CHECK_LIB(m, sqrt) -fi - # Check for mail-locking functions in a "mail" library. Probably this should # have the same check as for liblockfile below. AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no) if test $have_mail = yes; then LIBS_MAIL=-lmail - LIBS="$LIBS_MAIL $LIBS" AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).]) + + OLD_LIBS=$LIBS + LIBS="$LIBS_MAIL $LIBS" + AC_CHECK_FUNCS(touchlock) + LIBS=$OLD_LIBS else LIBS_MAIL= fi @@ -3413,7 +3396,6 @@ dnl Debian, at least: AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no) if test $have_lockfile = yes; then LIBS_MAIL=-llockfile - LIBS="$LIBS_MAIL $LIBS" AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).]) else # If we have the shared liblockfile, assume we must use it for mail @@ -3478,18 +3460,19 @@ case "$mail_lock" in esac AC_SUBST(BLESSMAIL_TARGET) - +OLD_LIBS=$LIBS +LIBS="$LIB_MATH $LIBS" AC_CHECK_FUNCS(accept4 gethostname \ getrusage get_current_dir_name \ -lrand48 \ +lrand48 random rint \ select getpagesize setlocale \ getrlimit setrlimit shutdown getaddrinfo \ strsignal setitimer \ sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ gai_strerror getline getdelim sync \ getpwent endpwent getgrent endgrent \ -touchlock \ cfmakeraw cfsetspeed copysign __executable_start log2) +LIBS=$OLD_LIBS dnl No need to check for aligned_alloc and posix_memalign if using dnl gmalloc.o, as it supplies them. Don't use these functions on @@ -3498,17 +3481,6 @@ if test -z "$GMALLOC_OBJ" && test "$opsys" != darwin; then AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break]) fi -## Eric Backus says, HP-UX 9.x on HP 700 machines -## has a broken `rint' in some library versions including math library -## version number A.09.05. -## You can fix the math library by installing patch number PHSS_4630. -## But we can fix it more reliably for Emacs by just not using rint. -## We also skip HAVE_RANDOM - see comments in src/conf_post.h. -case $opsys in - hpux*) : ;; - *) AC_CHECK_FUNCS(random rint) ;; -esac - dnl Cannot use AC_CHECK_FUNCS AC_CACHE_CHECK([for __builtin_unwind_init], emacs_cv_func___builtin_unwind_init, @@ -3725,6 +3697,7 @@ DESLIB= KRB4LIB= if test "${with_kerberos}" != no; then + OLD_LIBS=$LIBS AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no) if test $have_com_err = yes; then COM_ERRLIB=-lcom_err @@ -3781,6 +3754,7 @@ if test "${with_kerberos}" != no; then [AC_CHECK_HEADERS(kerberos/krb.h)])]) fi AC_CHECK_HEADERS(com_err.h) + LIBS=$OLD_LIBS fi AC_SUBST(COM_ERRLIB) @@ -3855,11 +3829,19 @@ AC_FUNC_FORK AC_CHECK_FUNCS(snprintf) -dnl Check this late. It depends on what other libraries (lrsvg, Gtk+ etc) -dnl Emacs uses. +dnl Check for glib. This differs from other library checks in that +dnl Emacs need not link to glib unless some other library is already +dnl linking to glib. Although glib provides no facilities that Emacs +dnl needs for its own purposes, when glib is present Emacs needs to +dnl use primitives like g_main_context_query to avoid clashing with +dnl glib at a low level. +dnl +dnl Check this late, since it depends on $GTK_CFLAGS etc. XGSELOBJ= OLDCFLAGS="$CFLAGS" OLDLIBS="$LIBS" +CFLAGS="$CFLAGS $GTK_CFLAGS $RSVG_CFLAGS $DBUS_CFLAGS $SETTINGS_CFLAGS" +LIBS="$LIBS $GTK_LIBS $RSVG_LIBS $DBUS_LIBS $SETTINGS_LIBS" CFLAGS="$CFLAGS $GFILENOTIFY_CFLAGS" LIBS="$LIBS $GFILENOTIFY_LIBS" AC_MSG_CHECKING([whether GLib is linked in]) @@ -3995,7 +3977,7 @@ AH_TEMPLATE(NO_EDITRES, [Define if XEditRes should not be used.]) case $opsys in aix4-2) dnl Unfortunately without libXmu we cannot support EditRes. - if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then + if test "x$ac_cv_search_XmuConvertStandardSelection" = xno; then AC_DEFINE(NO_EDITRES, 1) fi ;; @@ -4290,28 +4272,6 @@ case $opsys in esac -dnl Used in lisp.h, emacs.c, vm-limit.c -dnl NEWS.18 describes this as "a number which contains -dnl the high bits to be inclusive or'ed with pointers that are unpacked." -AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers -stored in a Lisp_Object.]) -dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT. - -case $opsys in - aix*) - dnl This works with 32-bit executables; Emacs doesn't support 64-bit. - AC_DEFINE(DATA_SEG_BITS, [0x20000000]) - ;; - hpux*) - dnl The data segment on this machine always starts at address 0x40000000. - AC_DEFINE(DATA_SEG_BITS, [0x40000000]) - ;; - irix6-5) - AC_DEFINE(DATA_SEG_BITS, [0x10000000]) - ;; -esac - - AH_TEMPLATE(TAB3, [Undocumented.]) case $opsys in @@ -4575,6 +4535,7 @@ esac # Set up the CFLAGS for real compilation, so we can substitute it. CFLAGS="$REAL_CFLAGS" CPPFLAGS="$REAL_CPPFLAGS" +LIBS="$REAL_LIBS" ## Hack to detect a buggy GCC version. if test "x$GCC" = xyes \ @@ -4998,7 +4959,7 @@ echo " Does Emacs use -lXpm? ${HAVE_XPM}" echo " Does Emacs use -ljpeg? ${HAVE_JPEG}" echo " Does Emacs use -ltiff? ${HAVE_TIFF}" echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF" -echo " Does Emacs use -lpng? ${HAVE_PNG}" +echo " Does Emacs use a png library? ${HAVE_PNG} $LIBPNG" echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}" echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}"