X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/cd626254b7031392ff12ba2806f0e68b0ccda8e3..3e9fa60a5c99568817a12a1011b0e61cce5d3a67:/configure.ac diff --git a/configure.ac b/configure.ac index 837a619d8a..47bb458a76 100644 --- a/configure.ac +++ b/configure.ac @@ -295,6 +295,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) @@ -304,15 +307,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 \ @@ -911,6 +905,13 @@ else AC_SUBST([GNULIB_WARN_CFLAGS]) fi +edit_cflags=" + s,///*,/,g + s/^/ / + s/ -I/ $isystem/g + s/^ // +" + dnl Some other nice autoconf tests. @@ -1339,65 +1340,28 @@ 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 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], + [PKG_CHECK_MODULES([$1], [$2], + [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"` + m4_default([$3], [HAVE_$1=yes])], + [m4_default([$4], [HAVE_$1=no])])]) HAVE_SOUND=no if test "${with_sound}" != "no"; then @@ -1425,7 +1389,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" @@ -2193,7 +2157,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) @@ -2211,12 +2175,10 @@ 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) @@ -2246,7 +2208,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 @@ -2273,7 +2236,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 @@ -2397,7 +2361,7 @@ 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 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. @@ -2415,12 +2379,14 @@ if test "${with_dbus}" = "yes"; then 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" @@ -2454,7 +2420,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. @@ -2464,7 +2430,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" @@ -2495,12 +2461,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.]) @@ -2542,7 +2510,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 @@ -2816,7 +2784,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 @@ -2825,7 +2794,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 @@ -2864,8 +2833,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 @@ -2875,8 +2843,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, @@ -2895,7 +2862,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 @@ -3082,8 +3049,15 @@ elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then 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_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library.]) + + dnl Some systems, eg NetBSD 6, only provide eg "libpng16", not "libpng". + lpng=`libpng-config --libs 2> /dev/null` + case $lpng in + -l*) : ;; + *) lpng="-lpng" ;; + esac + LIBPNG="$lpng -lz -lm" AC_CHECK_DECL(png_longjmp, [], @@ -3261,14 +3235,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 @@ -3283,27 +3256,29 @@ 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 libxml (-lxml2) if available @@ -3311,7 +3286,7 @@ fi 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" @@ -4938,7 +4913,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}"