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.
+## This might be a 'configure' arg.
AC_SUBST([ACLOCAL_PATH])
## Makefile.in needs the cache file name.
rs6000-ibm-aix[56]* )
opsys=aix4-2
;;
- powerpc-ibm-aix[56]* )
+ powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
opsys=aix4-2
;;
opsys=sol2-10
emacs_check_sunpro_c=yes
;;
+ *-sunos5.[1-5]* | *-solaris2.[1-5]* ) unported=yes ;;
+ ## Note that Emacs 23.1's NEWS said the following would be dropped.
*-sunos5.6* | *-solaris2.6* )
opsys=sol2-6
RANLIB="ar -ts"
;;
+ ## 5.7 EOL Aug 2008, 5.8 EOL Mar 2012.
*-sunos5.[7-9]* | *-solaris2.[7-9]* )
opsys=sol2-6
emacs_check_sunpro_c=yes
#### Choose a compiler.
+dnl Don't bother to test for C89.
+AC_DEFUN([_AC_PROG_CC_C89], [$2])
+
dnl Sets GCC=yes if using gcc.
AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"])
if test -n "$XCRUN"; then
test -n "$AR" && export AR
fi
+dnl Emacs needs C99 or later.
+gl_PROG_CC_C99
+
AM_PROG_CC_C_O
if test x$GCC = xyes; then
# Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
# as we don't use them.
AC_DEFUN([gl_FCNTL_O_FLAGS])
-# 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_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)
-
# clang is unduly picky about some things.
AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
[AC_COMPILE_IFELSE(
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.
LN_S="/bin/ln"
fi
+dnl On some Debian versions, "install-info" prints irritating messages
+dnl "This is not dpkg install-info anymore, but GNU install-info"
+dnl if called via an absolute file name.
+dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
+dnl Sadly some people may have an old ginstall-info installed on
+dnl non-Debian systems, so we can't use this.
+dnl AC_PATH_PROGS(INSTALL_INFO, [ginstall-info install-info], :,
+dnl $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
+
AC_PATH_PROG(INSTALL_INFO, install-info, :,
$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
dnl Don't use GZIP, which is used by gzip for additional parameters.
CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
fi
-# Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better.
+# Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better.
AC_DEFUN([AC_TYPE_SIZE_T])
# Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
AC_DEFUN([AC_TYPE_UID_T])
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
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 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],
- [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])
+ [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
system_malloc=$emacs_cv_sanitize_address
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
- darwin|sol2-10) system_malloc=yes ;;
+ darwin|mingw32|sol2-10) system_malloc=yes ;;
esac
GMALLOC_OBJ=
## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
## Does the AC_FUNC_MMAP test below make this check unnecessary?
case "$opsys" in
- gnu*) REL_ALLOC=no ;;
+ mingw32|gnu*) REL_ALLOC=no ;;
esac
fi
use_mmap_for_buffers=no
case "$opsys" in
- cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
+ cygwin|mingw32|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
esac
AC_FUNC_MMAP
dnl Check for the POSIX thread library.
LIB_PTHREAD=
+if test "$opsys" != "mingw32"; then
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
LIBS=$OLD_LIBS
fi
AC_SUBST([LIB_PTHREAD])
+fi
dnl Check for need for bigtoc support on IBM AIX
HAVE_PNG=no
LIBPNG=
PNG_CFLAGS=
-if test "${with_png}" != no; then
+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"
+ elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
+ AC_MSG_CHECKING([for png])
+ png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
+ png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` || {
+ # 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.
+ if test -r /usr/include/libpng/png.h &&
+ test ! -r /usr/include/png.h; then
+ png_cflags=-I/usr/include/libpng
+ else
+ png_cflags=
+ fi
+ png_libs='-lpng'
+ }
+ SAVE_CFLAGS=$CFLAGS
+ SAVE_LIBS=$LIBS
+ CFLAGS="$CFLAGS $png_cflags"
+ LIBS="$png_libs -lz -lm $LIBS"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <png.h>]],
+ [[return !png_get_channels (0, 0);]])],
+ [HAVE_PNG=yes
+ PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
+ LIBPNG=$png_libs
+ # $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])
+ CFLAGS=$SAVE_CFLAGS
+ LIBS=$SAVE_LIBS
+ AC_MSG_RESULT([$HAVE_PNG])
fi
fi
if test $HAVE_PNG = yes; then
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.
AC_SUBST(BLESSMAIL_TARGET)
OLD_LIBS=$LIBS
-LIBS="$LIB_MATH $LIBS"
+LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
AC_CHECK_FUNCS(accept4 gethostname \
getrusage get_current_dir_name \
lrand48 random rint \
select getpagesize setlocale \
getrlimit setrlimit shutdown getaddrinfo \
-strsignal setitimer \
+pthread_sigmask strsignal setitimer \
sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
-gai_strerror getline getdelim sync \
+gai_strerror sync \
getpwent endpwent getgrent endgrent \
cfmakeraw cfsetspeed copysign __executable_start log2)
LIBS=$OLD_LIBS
[Define to 1 if you have inet sockets.])
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)
else
case $opsys in
dnl irix: Tested on Irix 6.5. SCM worked on earlier versions.
- dragonfly | freebsd | netbsd | openbsd | irix6-5 | sol2* )
+ aix* | dragonfly | freebsd | netbsd | openbsd | irix6-5 | sol2* )
AC_DEFINE(GC_SETJMP_WORKS, 1)
;;
esac
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.
+ ## Is it any better under MinGW64 to relocate emacs into higher addresses?
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" ;;
+ x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -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
;;
AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
-## MinGW-specific post-link processing of temacs.
-TEMACS_POST_LINK=":"
-ADDSECTION=
-EMACS_HEAPSIZE=
-if test "${opsys}" = "mingw32"; then
- TEMACS_POST_LINK="\$(MINGW_TEMACS_POST_LINK)"
- ADDSECTION="../nt/addsection\$(EXEEXT)"
- ## Preload heap size of temacs.exe in MB.
- case "$canonical" in
- x86_64-*-*) EMACS_HEAPSIZE=42 ;;
- *) EMACS_HEAPSIZE=27 ;;
- esac
-fi
-
-AC_SUBST(ADDSECTION)
-AC_SUBST(TEMACS_POST_LINK)
-AC_SUBST(EMACS_HEAPSIZE)
-
## Common for all window systems
if test "$window_system" != "none"; then
AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])