Assume C99 or later.
[bpt/emacs.git] / configure.ac
index b2ce64a..0119685 100644 (file)
@@ -296,7 +296,7 @@ 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.
+## This might be a 'configure' arg.
 AC_SUBST([ACLOCAL_PATH])
 
 ## Makefile.in needs the cache file name.
@@ -670,6 +670,9 @@ fi
 
 #### 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
@@ -677,6 +680,9 @@ 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
@@ -1303,7 +1309,7 @@ else
   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])
@@ -1359,10 +1365,6 @@ 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
@@ -1372,29 +1374,15 @@ 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 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
@@ -3070,7 +3058,9 @@ AC_SUBST(LIBZ)
 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])
@@ -3304,6 +3294,26 @@ 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.