X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/54ab7d34c56aca38b600cdc3e37fc215e7abec06..58556eb49eecb603a971f92ec2a426f68e996379:/configure.ac diff --git a/configure.ac b/configure.ac index 4130662e8e..52cc165195 100644 --- a/configure.ac +++ b/configure.ac @@ -86,7 +86,7 @@ AC_DEFUN([OPTION_DEFAULT_OFF], [dnl ])dnl dnl OPTION_DEFAULT_ON(NAME, HELP-STRING) -dnl Create a new --with option that defaults to $enable_features. +dnl Create a new --with option that defaults to $with_features. dnl NAME is the base name of the option. The shell variable with_NAME dnl will be set either to 'no' (for a plain --without-NAME) or to dnl 'yes' (if the option is not specified). Note that the shell @@ -199,9 +199,24 @@ OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) OPTION_DEFAULT_ON([gconf],[don't compile with GConf support]) OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support]) OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support]) -OPTION_DEFAULT_ON([acl],[don't compile with ACL support]) OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support]) -OPTION_DEFAULT_ON([inotify],[don't compile with inotify (file-watch) support]) + +AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB], + [use a file notification library (LIB one of: yes, gfile, inotify, w32, no)])], + [ case "${withval}" in + y | ye | yes ) val=yes ;; + n | no ) val=no ;; + g | gf | gfi | gfil | gfile ) val=gfile ;; + i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;; + w | w3 | w32 ) val=w32 ;; + * ) AC_MSG_ERROR([`--with-file-notification=$withval' is invalid; +this option's value should be `yes', `no', `gfile', `inotify' or `w32'. +`yes' is a synonym for `w32' on MS-Windows, and for `gfile' otherwise.]) + ;; + esac + with_file_notification=$val + ], + [with_file_notification=$with_features]) ## For the times when you want to build Emacs but don't have ## a suitable makeinfo, and can live without the manuals. @@ -555,7 +570,7 @@ case "${canonical}" in i[3456]86-*-* ) case "${canonical}" in *-darwin* ) opsys=darwin ;; - *-mingw32 ) + *-mingw32 ) opsys=mingw32 # MinGW overrides and adds some system headers in nt/inc. GCC_TEST_OPTIONS="-I $srcdir/nt/inc" @@ -623,10 +638,10 @@ AC_DEFUN([gl_THREADLIB]) dnl Amongst other things, this sets AR and ARFLAGS. gl_EARLY -# It's helpful to have C macros available to GDB, so prefer -g3 to -g -# if -g3 works and the user does not specify CFLAGS. -# This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains. if test "$ac_test_CFLAGS" != set; then + # It's helpful to have C macros available to GDB, so prefer -g3 to -g + # if -g3 works and the user does not specify CFLAGS. + # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains. case $CFLAGS in '-g') emacs_g3_CFLAGS='-g3';; @@ -642,16 +657,32 @@ if test "$ac_test_CFLAGS" != set; then [emacs_cv_prog_cc_g3], [AC_LINK_IFELSE([AC_LANG_PROGRAM()], [emacs_cv_prog_cc_g3=yes], - [emacs_cv_prog_cc_g3=no])]) - if test $emacs_cv_prog_cc_g3 = yes; then - CFLAGS=$emacs_g3_CFLAGS - else + [emacs_cv_prog_cc_g3=no])]) + if test $emacs_cv_prog_cc_g3 != yes; then CFLAGS=$emacs_save_CFLAGS fi if test $opsys = mingw32; then CFLAGS="$CFLAGS -gdwarf-2" fi fi + + case $CFLAGS in + *-O*) ;; + *) + # No optimization flag was inferred for this non-GCC compiler. + # Try -O. This is needed for xlc on AIX; see Bug#14258. + emacs_save_CFLAGS=$CFLAGS + test -z "$CFLAGS" || CFLAGS="$CFLAGS " + CFLAGS=${CFLAGS}-O + AC_CACHE_CHECK([whether $CC accepts -O], + [emacs_cv_prog_cc_o], + [AC_LINK_IFELSE([AC_LANG_PROGRAM()], + [emacs_cv_prog_cc_o=yes], + [emacs_cv_prog_cc_o=no])]) + if test $emacs_cv_prog_cc_o != yes; then + CFLAGS=$emacs_save_CFLAGS + fi ;; + esac fi AC_ARG_ENABLE([gcc-warnings], @@ -732,27 +763,13 @@ else esac AC_SUBST([WERROR_CFLAGS]) - nw="$nw -Waggregate-return" # anachronistic - nw="$nw -Wlong-long" # C90 is anachronistic - nw="$nw -Wc++-compat" # We don't care about C++ compilers - nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib - nw="$nw -Wtraditional" # Warns on #elif which we use often - nw="$nw -Wcast-qual" # Too many warnings for now - nw="$nw -Wconversion" # Too many warnings for now nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings - nw="$nw -Wsign-conversion" # Too many warnings for now nw="$nw -Woverlength-strings" # Not a problem these days - nw="$nw -Wtraditional-conversion" # Too many warnings for now - nw="$nw -Wunreachable-code" # so buggy that it's now silently ignored - nw="$nw -Wpadded" # Our structs are not padded - nw="$nw -Wredundant-decls" # we regularly (re)declare functions nw="$nw -Wlogical-op" # any use of fwrite provokes this nw="$nw -Wformat-nonliteral" # we do this a lot nw="$nw -Wvla" # warnings in gettext.h nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__ - nw="$nw -Wswitch-enum" # Too many warnings for now nw="$nw -Wswitch-default" # Too many warnings for now - nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. nw="$nw -Wstrict-overflow" # OK to optimize assuming that @@ -770,6 +787,20 @@ else # The following line should be removable at some point. nw="$nw -Wsuggest-attribute=pure" + # 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" + #endif + ]])], + [emacs_cv_clang=yes], + [emacs_cv_clang=no])]) + if test $emacs_cv_clang = yes; then + nw="$nw -Wcast-align" + fi + gl_MANYWARN_ALL_GCC([ws]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) for w in $ws; do @@ -786,6 +817,14 @@ else # gcc 4.5.0 20090517. gl_WARN_ADD([-Wno-logical-op]) + # More things that clang is unduly picky about. + if test $emacs_cv_clang = yes; then + gl_WARN_ADD([-Wno-format-extra-args]) + gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) + gl_WARN_ADD([-Wno-unused-command-line-argument]) + gl_WARN_ADD([-Wno-unused-value]) + fi + gl_WARN_ADD([-fdiagnostics-show-option]) gl_WARN_ADD([-funit-at-a-time]) @@ -1019,7 +1058,7 @@ case "$opsys" in ;; openbsd) - ## Han Boetes says this is necessary, + ## Han Boetes says this is necessary, ## otherwise Emacs dumps core on elf systems. LD_SWITCH_SYSTEM="-Z" ;; @@ -1589,15 +1628,15 @@ W32_RES_LINK= EMACS_MANIFEST= if test "${with_w32}" != no; then case "${opsys}" in - cygwin) + cygwin) AC_CHECK_HEADER([windows.h], [HAVE_W32=yes], [AC_MSG_ERROR([`--with-w32' was specified, but windows.h - cannot be found.])]) + cannot be found.])]) ;; mingw32) ## Using --with-w32 with MinGW is a no-op, but we allow it. ;; - *) + *) AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.]) ;; esac @@ -1611,7 +1650,7 @@ if test "${opsys}" = "mingw32"; then [[void test(PIMAGE_NT_HEADERS pHeader) {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}]])], [emacs_cv_w32api=yes - HAVE_W32=yes], + HAVE_W32=yes], emacs_cv_w32api=no) AC_MSG_RESULT($emacs_cv_w32api) if test "${emacs_cv_w32api}" = "no"; then @@ -1645,7 +1684,6 @@ if test "${HAVE_W32}" = "yes"; then W32_RES_LINK="-Wl,emacs.res" else W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o" - W32_OBJ="$W32_OBJ w32notify.o" W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32" W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10" W32_RES_LINK="\$(EMACSRES)" @@ -2059,6 +2097,7 @@ if test "${opsys}" != "mingw32"; then USE_GTK_TOOLKIT="GTK3" if test "x$ac_enable_gtk_deprecation_warnings" = x; then GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS" + GTK_CFLAGS="$GTK_CFLAGS -DGLIB_DISABLE_DEPRECATION_WARNINGS" fi else check_gtk2=yes @@ -2270,33 +2309,60 @@ fi AC_SUBST(LIBGNUTLS_LIBS) AC_SUBST(LIBGNUTLS_CFLAGS) +NOTIFY_OBJ= +NOTIFY_SUMMARY=no + +dnl Set defaults of $with_file_notification. +if test "${with_file_notification}" = "yes"; then + if test "${opsys}" = "mingw32"; then + with_file_notification=w32 + else + if test "${with_ns}" != yes; then + with_file_notification=gfile + fi + fi +fi + +dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED +dnl has been added in glib 2.24. It has been tested under +dnl GNU/Linux only. We take precedence over inotify, but this makes +dnl only sense when glib has been compiled with inotify support. How +dnl to check? +if test "${with_file_notification}" = "gfile"; then + PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.24, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no) + if test "$HAVE_GFILENOTIFY" = "yes"; then + AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.]) + NOTIFY_OBJ=gfilenotify.o + NOTIFY_SUMMARY="yes -lgio (gfile)" + fi +fi dnl inotify is only available on GNU/Linux. -if test "${with_inotify}" = "yes"; then - AC_CHECK_HEADERS(sys/inotify.h) +if test "${with_file_notification}" = "inotify"; then + AC_CHECK_HEADER(sys/inotify.h) if test "$ac_cv_header_sys_inotify_h" = yes ; then - AC_CHECK_FUNC(inotify_init1) + AC_CHECK_FUNC(inotify_init1) + if test "$ac_cv_func_inotify_init1" = yes; then + AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.]) + NOTIFY_OBJ=inotify.o + NOTIFY_SUMMARY="yes -lglibc (inotify)" + fi + fi +fi +dnl MS Windows native file monitor is available for mingw32 only. +if test "${with_file_notification}" = "w32"; then + AC_CHECK_HEADER(windows.h) + if test "$ac_cv_header_windows_h" = yes ; then + AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.]) + NOTIFY_OBJ=w32notify.o + NOTIFY_SUMMARY="yes (w32)" fi fi -if test "$ac_cv_func_inotify_init1" = yes; then - AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.]) +if test -n "$NOTIFY_OBJ"; then + AC_DEFINE(USE_FILE_NOTIFY, 1, [Define to 1 if using file notifications.]) fi - -dnl POSIX ACL support: provided by libacl on GNU/Linux, by libc on FreeBSD. -HAVE_POSIX_ACL=no -LIBACL_LIBS= -if test "${with_acl}" = "yes"; then - AC_CHECK_LIB([acl], [acl_set_file], HAVE_POSIX_ACL=yes, HAVE_POSIX_ACL=no) - if test "$HAVE_POSIX_ACL" = yes; then - AC_DEFINE(HAVE_POSIX_ACL, 1, [Define to 1 if using POSIX ACL support.]) - LIBACL_LIBS=-lacl - else - AC_CHECK_FUNC(acl_set_file, HAVE_POSIX_ACL=yes, HAVE_POSIX_ACL=no) - if test "$HAVE_POSIX_ACL" = yes; then - AC_DEFINE(HAVE_POSIX_ACL, 1, [Define to 1 if using POSIX ACL support.]) - fi - fi -fi -AC_SUBST(LIBACL_LIBS) +AC_SUBST(NOTIFY_OBJ) +AC_SUBST(GFILENOTIFY_CFLAGS) +AC_SUBST(GFILENOTIFY_LIBS) dnl Do not put whitespace before the #include statements below. dnl Older compilers (eg sunos4 cc) choke on it. @@ -2983,6 +3049,56 @@ if test "${HAVE_X11}" = "yes"; then fi AC_SUBST(LIBXSM) +### Use XRandr (-lXrandr) if available +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) + 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 + SAVE_CFLAGS="$CFLAGS" + SAVE_LIBS="$LIBS" + CFLAGS="$XRANDR_CFLAGS $CFLAGS" + LIBS="$XRANDR_LIBS $LIBS" + AC_CHECK_FUNCS(XRRGetOutputPrimary XRRGetScreenResourcesCurrent) + CFLAGS="$SAVE_CFLAGS" + LIBS="$SAVE_LIBS" + + AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.]) + fi +fi + +### 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) + 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 + + ### Use libxml (-lxml2) if available ### mingw32 doesn't use -lxml2, since it loads the library dynamically. HAVE_LIBXML2=no @@ -3500,6 +3616,25 @@ AC_FUNC_FORK AC_CHECK_FUNCS(snprintf) +dnl Check this late. It depends on what other libraries (lrsvg, Gtk+ etc) +dnl Emacs uses. +XGSELOBJ= +AC_MSG_CHECKING([whether GLib is linked in]) +AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[#include + ]], + [[g_print ("Hello world");]])], + [links_glib=yes], + [links_glib=no]) +AC_MSG_RESULT([$links_glib]) +if test "${links_glib}" = "yes"; then + AC_DEFINE(HAVE_GLIB, 1, [Define to 1 if GLib is linked in.]) + if test "$HAVE_NS" = no;then + XGSELOBJ=xgselect.o + fi +fi +AC_SUBST(XGSELOBJ) + dnl Adapted from Haible's version. AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], @@ -4286,7 +4421,7 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you want to use the X window system.]) XMENU_OBJ=xmenu.o - XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o" + XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o" FONT_OBJ=xfont.o if test "$HAVE_XFT" = "yes"; then FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" @@ -4467,6 +4602,9 @@ case "$opsys" in ## each); under Cocoa 31 commands are required. if test "$HAVE_NS" = "yes"; then libs_nsgui="-framework AppKit" + if test "$NS_IMPL_COCOA" = "yes"; then + libs_nsgui="$libs_nsgui -framework IOKit" + fi headerpad_extra=6C8 else libs_nsgui= @@ -4491,12 +4629,17 @@ case "$opsys" in gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;; mingw32) + ## MinGW64 does not prepend an underscore to symbols, so we must + ## pass a different -entry switch to linker. FIXME: It is better + ## to make the entry points the same by changing unexw32.c. case "$canonical" in x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,_start -Wl,-Map,./temacs.map" ;; *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;; esac ;; + openbsd) LD_SWITCH_SYSTEM_TEMACS='-nopie' ;; + *) LD_SWITCH_SYSTEM_TEMACS= ;; esac @@ -4617,6 +4760,7 @@ echo " Does Emacs use -lgpm? ${HAVE_GPM}" echo " Does Emacs use -ldbus? ${HAVE_DBUS}" echo " Does Emacs use -lgconf? ${HAVE_GCONF}" echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}" +echo " Does Emacs use a file notification library? ${NOTIFY_SUMMARY}" echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}" echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"