X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/a09710e913297f40c320c93689391a0a8fe4bc3a..fe0b1ec40988638025db569a936b09f0295749a1:/configure.ac diff --git a/configure.ac b/configure.ac index 2394790c45..5520dd6a90 100644 --- a/configure.ac +++ b/configure.ac @@ -128,17 +128,12 @@ AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME], OPTION_DEFAULT_ON([sound],[don't compile with sound support]) -OPTION_DEFAULT_ON([sync-input],[process async input synchronously]) -if test "$with_sync_input" = yes; then - AC_DEFINE(SYNC_INPUT, 1, [Process async input synchronously.]) -fi - dnl FIXME currently it is not the last. dnl This should be the last --with option, because --with-x is dnl added later on when we find the path of X, and it's best to dnl keep them together visually. AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT], - [use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no)])], + [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])], [ case "${withval}" in y | ye | yes ) val=gtk ;; n | no ) val=no ;; @@ -146,11 +141,13 @@ AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT], a | at | ath | athe | athen | athena ) val=athena ;; m | mo | mot | moti | motif ) val=motif ;; g | gt | gtk ) val=gtk ;; + gtk2 ) val=gtk2 ;; gtk3 ) val=gtk3 ;; * ) AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid; -this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk' or -`gtk3'. `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.]) +this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk', +`gtk2' or `gtk3'. `yes' and `gtk' are synonyms. +`athena' and `lucid' are synonyms.]) ;; esac with_x_toolkit=$val @@ -180,6 +177,7 @@ OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars]) OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d]) OPTION_DEFAULT_ON([xim],[don't use X11 XIM]) OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system]) +OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI]) OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console]) OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) @@ -574,9 +572,41 @@ else test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" fi +# Avoid gnulib's threadlib module, as we do threads our own way. +AC_DEFUN([gl_THREADLIB]) + # Initialize gnulib right after choosing the compiler. +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 + case $CFLAGS in + '-g') + emacs_g3_CFLAGS='-g3';; + '-g -O2') + emacs_g3_CFLAGS='-g3 -O2';; + *) + emacs_g3_CFLAGS='';; + esac + if test -n "$emacs_g3_CFLAGS"; then + emacs_save_CFLAGS=$CFLAGS + CFLAGS=$emacs_g3_CFLAGS + AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS], + [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 + CFLAGS=$emacs_save_CFLAGS + fi + fi +fi + AC_ARG_ENABLE([gcc-warnings], [AS_HELP_STRING([--enable-gcc-warnings], [turn on lots of GCC warnings. This is intended for @@ -677,6 +707,7 @@ else 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 -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations @@ -709,8 +740,13 @@ else gl_WARN_ADD([-funit-at-a-time]) AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) - AC_DEFINE([_FORTIFY_SOURCE], [2], - [enable compile-time and run-time bounds-checking, and some warnings]) + AH_VERBATIM([FORTIFY_SOURCE], + [/* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting glibc 2.15+. */ + #if defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + ]) AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) # We use a slightly smaller set of warning options for lib/. @@ -731,6 +767,7 @@ dnl AC_PROG_MKDIR_P dnl if test "x$RANLIB" = x; then dnl AC_PROG_RANLIB dnl fi +AC_PROG_LN_S AC_PATH_PROG(INSTALL_INFO, install-info, :, $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin) @@ -1152,9 +1189,10 @@ AC_DEFUN([PKG_CHECK_MODULES], [ $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. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) + ## 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) @@ -1247,10 +1285,12 @@ dnl On Solaris 8 there's a compilation warning for term.h because dnl it doesn't define `bool'. AC_CHECK_HEADERS(term.h, , , -) AC_HEADER_TIME -AC_CHECK_DECLS([sys_siglist]) +AC_CHECK_DECLS([sys_siglist], [], [], [[#include + ]]) if test $ac_cv_have_decl_sys_siglist != yes; then # For Tru64, at least: - AC_CHECK_DECLS([__sys_siglist]) + AC_CHECK_DECLS([__sys_siglist], [], [], [[#include + ]]) if test $ac_cv_have_decl___sys_siglist = yes; then AC_DEFINE(sys_siglist, __sys_siglist, [Define to any substitute for sys_siglist.]) @@ -1267,17 +1307,6 @@ if test $emacs_cv_speed_t = yes; then [Define to 1 if `speed_t' is declared by .]) fi -AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception, -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], -[[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;]])], - emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no)) -HAVE_EXCEPTION=$emacs_cv_struct_exception -dnl Define on Darwin so emacs symbols will not conflict with those -dnl in the System framework. Otherwise -prebind will not work. -if test $emacs_cv_struct_exception != yes || test $opsys = darwin; then - AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.]) -fi - AC_CHECK_HEADERS_ONCE(sys/socket.h) AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT #if HAVE_SYS_SOCKET_H @@ -1357,10 +1386,14 @@ AC_SYS_LONG_FILE_NAMES #### Choose a window system. +## We leave window_system equal to none if +## we end up building without one. Any new window system should +## set window_system to an appropriate value and add objects to +## window-system-specific substs. + +window_system=none AC_PATH_X -if test "$no_x" = yes; then - window_system=none -else +if test "$no_x" != yes; then window_system=x11 fi @@ -1430,13 +1463,13 @@ if test "${with_ns}" != no; then ns_appdir=`pwd`/nextstep/Emacs.app ns_appbindir=${ns_appdir}/Contents/MacOS ns_appresdir=${ns_appdir}/Contents/Resources - ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base + ns_appsrc=Cocoa/Emacs.base elif test -f $GNUSTEP_CONFIG_FILE; then NS_IMPL_GNUSTEP=yes ns_appdir=`pwd`/nextstep/Emacs.app ns_appbindir=${ns_appdir} ns_appresdir=${ns_appdir}/Resources - ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base + ns_appsrc=GNUstep/Emacs.base dnl FIXME sourcing this several times in subshells seems inefficient. GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)" GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)" @@ -1478,19 +1511,35 @@ fail; AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes], [AC_MSG_ERROR([`--with-ns' was specified, but the include files are missing or cannot be compiled.])]) + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [ +#ifdef MAC_OS_X_VERSION_MAX_ALLOWED +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + ; /* OK */ +#else +#error "OSX 10.4 or newer required" +#endif +#endif + ])], + ns_osx_have_104=yes, + ns_osx_have_104=no) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [NSInteger i;])], ns_have_nsinteger=yes, ns_have_nsinteger=no) + if test $ns_osx_have_104 = no; then + AC_MSG_ERROR([`OSX 10.4 or newer is required']); + fi if test $ns_have_nsinteger = yes; then AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.]) fi fi + AC_SUBST(TEMACS_LDFLAGS2) INSTALL_ARCH_INDEP_EXTRA=install-etc ns_self_contained=no -ns_frag=/dev/null NS_OBJ= NS_OBJC_OBJ= if test "${HAVE_NS}" = yes; then @@ -1499,7 +1548,6 @@ if test "${HAVE_NS}" = yes; then fi window_system=nextstep - with_xft=no # set up packaging dirs if test "${EN_NS_SELF_CONTAINED}" = yes; then ns_self_contained=yes @@ -1518,8 +1566,6 @@ if test "${HAVE_NS}" = yes; then leimdir="\${ns_appresdir}/leim" INSTALL_ARCH_INDEP_EXTRA= fi - ns_frag=$srcdir/src/ns.mk - NS_OBJ="fontset.o fringe.o image.o" NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o" fi CFLAGS="$tmp_CFLAGS" @@ -1529,20 +1575,57 @@ AC_SUBST(ns_self_contained) AC_SUBST(NS_OBJ) AC_SUBST(NS_OBJC_OBJ) AC_SUBST(LIB_STANDARD) -AC_SUBST_FILE(ns_frag) + +HAVE_W32=no +W32_OBJ= +W32_LIBS= +if test "${with_w32}" != no; then + if test "${opsys}" != "cygwin"; then + AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin.]) + fi + AC_CHECK_HEADER([windows.h], [HAVE_W32=yes], + [AC_MSG_ERROR([`--with-w32' was specified, but windows.h + cannot be found.])]) + AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.]) + W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o" + W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o" + W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" + W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool" +fi +AC_SUBST(W32_OBJ) +AC_SUBST(W32_LIBS) + +if test "${HAVE_W32}" = "yes"; then + window_system=w32 + with_xft=no +fi + +## $window_system is now set to the window system we will +## ultimately use. + +term_header= +HAVE_X_WINDOWS=no +HAVE_X11=no +USE_X_TOOLKIT=none case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes HAVE_X11=yes + term_header=xterm.h case "${with_x_toolkit}" in athena | lucid ) USE_X_TOOLKIT=LUCID ;; motif ) USE_X_TOOLKIT=MOTIF ;; gtk ) with_gtk=yes + term_header=gtkutil.h dnl Don't set this for GTK. A lot of tests below assumes Xt when dnl USE_X_TOOLKIT is set. USE_X_TOOLKIT=none ;; + gtk2 ) with_gtk2=yes + term_header=gtkutil.h + USE_X_TOOLKIT=none ;; gtk3 ) with_gtk3=yes + term_header=gtkutil.h USE_X_TOOLKIT=none ;; no ) USE_X_TOOLKIT=none ;; dnl If user did not say whether to use a toolkit, make this decision later: @@ -1550,13 +1633,19 @@ dnl use the toolkit if we have gtk, or X11R5 or newer. * ) USE_X_TOOLKIT=maybe ;; esac ;; - nextstep | none ) - HAVE_X_WINDOWS=no - HAVE_X11=no - USE_X_TOOLKIT=none + nextstep ) + term_header=nsterm.h + ;; + w32 ) + term_header=w32term.h ;; esac +if test -n "${term_header}"; then + AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}", + [Define to the header for the built-in window system.]) +fi + if test "$window_system" = none && test "X$with_x" != "Xno"; then AC_CHECK_PROG(HAVE_XSERVER, X, true, false) if test "$HAVE_XSERVER" = true || @@ -1860,33 +1949,42 @@ fi HAVE_GTK=no GTK_OBJ= -if test "${with_gtk3}" = "yes"; then +check_gtk2=no +gtk3_pkg_errors= +if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then GLIB_REQUIRED=2.28 GTK_REQUIRED=3.0 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) - if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then + if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then AC_MSG_ERROR($GTK_PKG_ERRORS) fi - AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) - GTK_OBJ=emacsgtkfixed.o + if test "$pkg_check_gtk" = "yes"; then + AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) + GTK_OBJ=emacsgtkfixed.o + term_header=gtkutil.h + USE_GTK_TOOLKIT="GTK3" + else + check_gtk2=yes + gtk3_pkg_errors="$GTK_PKG_ERRORS " + fi fi -if test "$pkg_check_gtk" != "yes"; then - HAVE_GTK=no -if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then +if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then GLIB_REQUIRED=2.10 GTK_REQUIRED=2.10 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) - if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then - AC_MSG_ERROR($GTK_PKG_ERRORS) + if test "$pkg_check_gtk" = "no" && + { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; } + then + AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS) fi -fi + test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2" fi if test x"$pkg_check_gtk" = xyes; then @@ -1950,6 +2048,8 @@ if test "${HAVE_GTK}" = "yes"; then gtk_widget_get_mapped gtk_adjustment_get_page_size \ gtk_orientable_set_orientation \ gtk_window_set_has_resize_grip) + + term_header=gtkutil.h fi dnl D-Bus has been tested under GNU/Linux only. Must be adapted for @@ -2000,6 +2100,11 @@ 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) + if test "$HAVE_GOBJECT" = "yes"; then + SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS" + SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS" + fi SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" CFLAGS="$SETTINGS_CFLAGS $CFLAGS" @@ -2050,7 +2155,6 @@ HAVE_XAW3D=no LUCID_LIBW= if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then if test "$with_xaw3d" != no; then - AC_MSG_CHECKING(for xaw3d) AC_CACHE_VAL(emacs_cv_xaw3d, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include @@ -2063,6 +2167,7 @@ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then emacs_cv_xaw3d=no fi if test $emacs_cv_xaw3d = yes; then + AC_MSG_CHECKING(for xaw3d) AC_MSG_RESULT([yes; using Lucid toolkit]) USE_X_TOOLKIT=LUCID HAVE_XAW3D=yes @@ -2070,6 +2175,7 @@ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then AC_DEFINE(HAVE_XAW3D, 1, [Define to 1 if you have the Xaw3d library (-lXaw3d).]) else + AC_MSG_CHECKING(for xaw3d) AC_MSG_RESULT(no) AC_MSG_CHECKING(for libXaw) AC_CACHE_VAL(emacs_cv_xaw, @@ -2233,6 +2339,9 @@ if test "${with_toolkit_scroll_bars}" != "no"; then elif test "${HAVE_NS}" = "yes"; then AC_DEFINE(USE_TOOLKIT_SCROLL_BARS) USE_TOOLKIT_SCROLL_BARS=yes + elif test "${HAVE_W32}" = "yes"; then + AC_DEFINE(USE_TOOLKIT_SCROLL_BARS) + USE_TOOLKIT_SCROLL_BARS=yes fi fi @@ -2399,6 +2508,41 @@ AC_SUBST(M17N_FLT_LIBS) ### Use -lXpm if available, unless `--with-xpm=no'. HAVE_XPM=no LIBXPM= + +if test "${HAVE_W32}" = "yes"; then + if test "${with_xpm}" != "no"; then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS -I/usr/include/noX" + LDFLAGS="$LDFLAGS -L/usr/lib/noX" + AC_CHECK_HEADER(X11/xpm.h, + [AC_CHECK_LIB(Xpm, XpmReadFileToImage, HAVE_XPM=yes)]) + if test "${HAVE_XPM}" = "yes"; then + AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define) + AC_EGREP_CPP(no_return_alloc_pixels, + [#include "X11/xpm.h" +#ifndef XpmReturnAllocPixels +no_return_alloc_pixels +#endif + ], HAVE_XPM=no, HAVE_XPM=yes) + + if test "${HAVE_XPM}" = "yes"; then + REAL_CPPFLAGS="$REAL_CPPFLAGS -I/usr/include/noX" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + fi + fi + fi + + if test "${HAVE_XPM}" = "yes"; then + AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).]) + LIBXPM=-lXpm + fi +fi + if test "${HAVE_X11}" = "yes"; then if test "${with_xpm}" != "no"; then AC_CHECK_HEADER(X11/xpm.h, @@ -2425,12 +2569,13 @@ no_return_alloc_pixels LIBXPM=-lXpm fi fi + AC_SUBST(LIBXPM) ### Use -ljpeg if available, unless `--with-jpeg=no'. HAVE_JPEG=no LIBJPEG= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_jpeg}" != "no"; then dnl Checking for jpeglib.h can lose because of a redefinition of dnl HAVE_STDLIB_H. @@ -2458,7 +2603,7 @@ AC_SUBST(LIBJPEG) ### Use -lpng if available, unless `--with-png=no'. HAVE_PNG=no LIBPNG= -if test "${HAVE_X11}" = "yes"; then +if 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. @@ -2491,7 +2636,7 @@ AC_SUBST(LIBPNG) ### Use -ltiff if available, unless `--with-tiff=no'. HAVE_TIFF=no LIBTIFF= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_tiff}" != "no"; then AC_CHECK_HEADER(tiffio.h, [tifflibs="-lz -lm" @@ -2511,7 +2656,8 @@ AC_SUBST(LIBTIFF) ### Use -lgif or -lungif if available, unless `--with-gif=no'. HAVE_GIF=no LIBGIF= -if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then +if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \ + || test "${HAVE_W32}" = "yes"; then AC_CHECK_HEADER(gif_lib.h, # EGifPutExtensionLast only exists from version libungif-4.1.0b1. # Earlier versions can crash Emacs. @@ -2593,6 +2739,9 @@ if test "${HAVE_NS}" = "yes"; then OTHER_FILES=ns-app fi +if test "${HAVE_W32}" = "yes"; then + HAVE_MENUS=yes +fi ### Use session management (-lSM -lICE) if available HAVE_X_SM=no @@ -2641,8 +2790,8 @@ 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 -# fmod, logb, and frexp are found in -lm on most systems. -# On HPUX 9.01, -lm does not contain logb, so check for sqrt. +# sqrt and other floating-point functions such as fmod and frexp +# are found in -lm on most systems. AC_CHECK_LIB(m, sqrt) # Check for mail-locking functions in a "mail" library. Probably this should @@ -2722,7 +2871,7 @@ AC_SUBST(BLESSMAIL_TARGET) AC_CHECK_FUNCS(gethostname \ closedir getrusage get_current_dir_name \ -lrand48 logb frexp fmod cbrt setsid \ +lrand48 setsid \ fpathconf select euidaccess getpagesize setlocale \ utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \ __fpending strsignal setitimer \ @@ -3102,6 +3251,14 @@ else AC_MSG_RESULT(no) fi +dnl Check for a Solaris 2.4 vfork bug that Autoconf misses (through 2.69). +dnl This can be removed once we assume Autoconf 2.70. +case $canonical in + *-solaris2.4 | *-solaris2.4.*) + dnl Disable the Autoconf-generated vfork test. + : ${ac_cv_func_vfork_works=no};; +esac + AC_FUNC_FORK AC_CHECK_FUNCS(snprintf) @@ -3152,12 +3309,6 @@ AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written, so that Emacs can tell instantly when you try to modify a file that someone else has modified in his/her Emacs.]) -AH_TEMPLATE(FLOAT_CHECK_DOMAIN, [Define if the float library doesn't - handle errors by either setting errno, or signaling SIGFPE/SIGILL.]) - -AH_TEMPLATE(HAVE_INVERSE_HYPERBOLIC, [Define if you have the functions - acosh, asinh, and atanh.]) - dnl Everybody supports this, except MS. dnl Seems like the kind of thing we should be testing for, though. ## Note: PTYs are broken on darwin <6. Use at your own risk. @@ -3218,10 +3369,6 @@ esac case $opsys in - darwin | gnu | hpux* | *bsd ) - AC_DEFINE(NO_TERMIO, 1, [Define if termio.h should not be included.]) - ;; - irix6-5 | sol2* | unixware ) dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments; dnl instead, there's a system variable _sys_nsig. Unfortunately, we @@ -3231,26 +3378,16 @@ case $opsys in ;; esac +emacs_broken_SIGIO=no case $opsys in dnl SIGIO exists, but the feature doesn't work in the way Emacs needs. dnl See eg . hpux* | irix6-5 | openbsd | sol2* | unixware ) - AC_DEFINE(BROKEN_SIGIO, 1, [Define if SIGIO should not be used.]) + emacs_broken_SIGIO=yes ;; aix4-2) - dnl BUILD 9008 - FIONREAD problem still exists in X-Windows. - AC_DEFINE(BROKEN_FIONREAD, 1, [Define if FIONREAD should not be used.]) - dnl As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h. - dnl But, on AIX, SIGAIO, SIGPTY, and SIGPOLL are defined as SIGIO, - dnl which causes compilation error at init_signals in sysdep.c. - dnl So, we define these macros so that syssignal.h detects them - dnl and undefine SIGAIO, SIGPTY and SIGPOLL. - AC_DEFINE(BROKEN_SIGAIO, 1, [Define if SIGAIO should not be used.]) - AC_DEFINE(BROKEN_SIGPOLL,1, [Define if SIGPOLL should not be used.]) - AC_DEFINE(BROKEN_SIGPTY, 1, [Define if SIGPTY should not be used.]) - dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given dnl the way this system works, libc functions that return malloced dnl memory use the libc malloc implementation. Calling xfree or @@ -3292,12 +3429,6 @@ case $opsys in AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to work around an issue when reading from a PTY.]) ;; - - dnl Define the following so emacs symbols will not conflict with those - dnl in the System framework. Otherwise -prebind will not work. - darwin) - AC_DEFINE(NO_ABORT, 1, [Do not define abort in emacs.c.]) - ;; esac case $opsys in @@ -3332,7 +3463,7 @@ dnl The choice is controlled by the variable interrupt_input. dnl dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO) dnl -dnl Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros +dnl Emacs uses the presence of the USABLE_SIGIO macro dnl to indicate whether or not signal-driven I/O is possible. It uses dnl INTERRUPT_INPUT to decide whether to use it by default. dnl @@ -3392,7 +3523,7 @@ case $opsys in cygwin ) AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl multi-line AC_DEFINEs are hard. :( - AC_DEFINE(PTY_OPEN, [ do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)]) + AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)]) AC_DEFINE(PTY_NAME_SPRINTF, []) AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) ;; @@ -3421,7 +3552,7 @@ case $opsys in AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD dnl to prevent sigchld_handler from intercepting the child's death. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask (SIGCHLD)); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) dnl if HAVE_POSIX_OPENPT if test "x$ac_cv_func_posix_openpt" = xyes; then AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)]) @@ -3466,18 +3597,15 @@ case $opsys in ;; sol2* ) - dnl Uses sigblock/sigunblock rather than sighold/sigrelse, - dnl which appear to be BSD4.1 specific. It may also be appropriate - dnl for SVR4.x (x<2) but I'm not sure. fnf@cygnus.com dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() dnl from intercepting that death. If any child but grantpt's should die dnl within, it should be caught after sigrelse(2). - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; unixware ) dnl Comments are as per sol2*. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; esac @@ -3732,13 +3860,38 @@ else esac fi dnl GCC? +AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[jmp_buf j; + if (! _setjmp (j)) + _longjmp (j, 1);]])], + [emacs_cv_func__setjmp=yes], + [emacs_cv_func__setjmp=no])]) +if test $emacs_cv_func__setjmp = yes; then + AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.]) +else + AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[sigjmp_buf j; + if (! sigsetjmp (j, 1)) + siglongjmp (j, 1);]])], + [emacs_cv_func_sigsetjmp=yes], + [emacs_cv_func_sigsetjmp=no])]) + if test $emacs_cv_func_sigsetjmp = yes; then + AC_DEFINE([HAVE_SIGSETJMP], 1, + [Define to 1 if sigsetjmp and siglongjmp work. + The value of this symbol is irrelevant if HAVE__SETJMP is defined.]) + fi +fi case $opsys in sol2* | unixware ) - dnl setjmp and longjmp can safely replace _setjmp and _longjmp, - dnl but they will run more slowly. - AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.]) - AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.]) dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs, dnl and this is all we need. @@ -3753,13 +3906,6 @@ case $opsys in AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on some systems, where it requires time.h.]) ;; - - netbsd | openbsd ) - dnl Greg A. Woods says we must include signal.h - dnl before syssignal.h is included, to work around interface conflicts - dnl that are handled with CPP __RENAME() macro in signal.h. - AC_DEFINE(SIGNAL_H_AHB, 1, [Define if AH_BOTTOM should include signal.h.]) - ;; esac @@ -3849,6 +3995,46 @@ case $opsys in ;; esac +AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD], + [case $opsys in + aix4-2) + dnl BUILD 9008 - FIONREAD problem still exists in X-Windows. + emacs_cv_usable_FIONREAD=no + ;; + + *) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include + #include + #ifdef USG5_4 + # include + #endif + ]], + [[int foo = ioctl (0, FIONREAD, &foo);]])], + [emacs_cv_usable_FIONREAD=yes], + [emacs_cv_usable_FIONREAD=no]) + ;; + esac]) +if test $emacs_cv_usable_FIONREAD = yes; then + AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.]) + + if test $emacs_broken_SIGIO = no; then + AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include + #include + ]], + [[int foo = SIGIO | F_SETFL | FASYNC;]])], + [emacs_cv_usable_SIGIO=yes], + [emacs_cv_usable_SIGIO=no])], + [emacs_cv_usable_SIGIO=yes], + [emacs_cv_usable_SIGIO=no]) + if test $emacs_cv_usable_SIGIO = yes; then + AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.]) + fi + fi +fi + case $opsys in dnl Emacs supplies its own malloc, but glib (part of Gtk+) calls @@ -3862,11 +4048,6 @@ case $opsys in ;; hpux11) - dnl See comments in sysdep.c:sys_signal. - dnl SA_RESTART resets the timeout of `select' on hpux11. - dnl Defining BROKEN_SA_RESTART is not the same as undef'ing SA_RESTART. - AC_DEFINE(BROKEN_SA_RESTART, 1, [Define if SA_RESTART should only - be used in batch mode.]) dnl It works to open the pty's tty in the parent (Emacs), then dnl close and reopen it in the child. AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it @@ -3901,6 +4082,11 @@ fi version=$PACKAGE_VERSION +copyright="Copyright (C) 2012 Free Software Foundation, Inc." +AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"], + [Short copyright string for this version of Emacs.]) +AC_SUBST(copyright) + ### Specify what sort of things we'll be editing into Makefile and config.h. ### Use configuration here uncanonicalized to avoid exceeding size limits. AC_SUBST(version) @@ -3944,6 +4130,11 @@ AC_SUBST(ns_appsrc) AC_SUBST(GNU_OBJC_CFLAGS) AC_SUBST(OTHER_FILES) +if test -n "${term_header}"; then + AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}", + [Define to the header for the built-in window system.]) +fi + AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", [Define to the canonical Emacs configuration name.]) AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}", @@ -3958,7 +4149,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 fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" + XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o" FONT_OBJ=xfont.o if test "$HAVE_XFT" = "yes"; then FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" @@ -4086,7 +4277,7 @@ fi AC_SUBST(RALLOC_OBJ) if test "$opsys" = "cygwin"; then - CYGWIN_OBJ="sheap.o" + CYGWIN_OBJ="sheap.o cygw32.o" ## Cygwin differs because of its unexec(). PRE_ALLOC_OBJ= POST_ALLOC_OBJ=lastfile.o @@ -4248,13 +4439,14 @@ if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then fi dnl if $GCC AC_SUBST(LIB_GCC) - -## If we're using X11/GNUstep, define some consequences. -if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then +## Common for all window systems +if test "$window_system" != "none"; then AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.]) AC_DEFINE(HAVE_MOUSE, 1, [Define if you have mouse support.]) + WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o" fi +AC_SUBST(WINDOW_SYSTEM_OBJ) AH_TOP([/* GNU Emacs site configuration template file. @@ -4300,11 +4492,7 @@ End: #### It makes printing result more understandable as using GTK sets #### toolkit_scroll_bars to yes by default. if test "${HAVE_GTK}" = "yes"; then - if test "${with_gtk3}" = "yes"; then - USE_X_TOOLKIT=GTK3 - else - USE_X_TOOLKIT=GTK - fi + USE_X_TOOLKIT="$USE_GTK_TOOLKIT" fi echo " @@ -4392,6 +4580,16 @@ fi test "${exec_prefix}" != NONE && exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`] +if test "$HAVE_NS" = "yes"; then + if test "$NS_IMPL_GNUSTEP" = yes; then + AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \ + nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in]) + else + AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \ + nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in]) + fi +fi + dnl Obviously there is duplication here wrt $SUBDIR_MAKEFILES. dnl You _can_ use that variable in AC_CONFIG_FILES, so long as any directory dnl using automake (ie lib/) is explicitly listed and not "hidden" in a variable @@ -4400,12 +4598,12 @@ dnl This will work, but you get a config.status that is not quite right dnl (see http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00028.html). dnl That doesn't have any obvious consequences for Emacs, but on the whole dnl it seems better to just live with the duplication. -SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile" +SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile nextstep/Makefile" AC_CONFIG_FILES([Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile \ doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \ doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile \ - leim/Makefile]) + leim/Makefile nextstep/Makefile]) dnl test/ is not present in release tarfiles. opt_makefile=test/automated/Makefile