Bump to 4.4
[platform/upstream/make.git] / configure.ac
index cd49a2c..9f68897 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 #
-# Copyright (C) 1993-2020 Free Software Foundation, Inc.
+# Copyright (C) 1993-2022 Free Software Foundation, Inc.
 # This file is part of GNU Make.
 #
 # GNU Make is free software; you can redistribute it and/or modify it under
@@ -14,9 +14,9 @@
 # details.
 #
 # You should have received a copy of the GNU General Public License along with
-# this program.  If not, see <http://www.gnu.org/licenses/>.
+# this program.  If not, see <https://www.gnu.org/licenses/>.
 
-AC_INIT([GNU make],[4.3],[bug-make@gnu.org])
+AC_INIT([GNU Make],[4.4],[bug-make@gnu.org])
 
 AC_PREREQ([2.69])
 
@@ -31,7 +31,7 @@ AC_CONFIG_LIBOBJ_DIR([lib])
 # We have to enable "foreign" because ChangeLog is auto-generated
 # Automake 1.15 and gnulib don't get along: gnulib has some strange error
 # in the way it handles getloadavg.c which causes make distcheck to fail.
-# http://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
+# https://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
 AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
 
 # Checks for programs.
@@ -51,42 +51,36 @@ AC_CHECK_PROG([PERL], [perl], [perl], [perl])
 
 # Specialized system macros
 AC_CANONICAL_HOST
-AC_AIX
-AC_ISC_POSIX
-AC_MINIX
 AC_C_BIGENDIAN
 
 # Enable gettext, in "external" mode.
 AM_GNU_GETTEXT_VERSION([0.19.4])
 AM_GNU_GETTEXT([external])
 
-# This test must come as early as possible after the compiler configuration
-# tests, because the choice of the file model can (in principle) affect
-# whether functions and headers are available, whether they work, etc.
-AC_SYS_LARGEFILE
-
 # Checks for libraries.
+AC_SEARCH_LIBS([strerror],[cposix])
 AC_SEARCH_LIBS([getpwnam], [sun])
 
-# Checks for header files.
-AC_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_STAT
-AC_HEADER_TIME
+
 AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
-                  memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h \
+                  memory.h sys/param.h sys/resource.h sys/timeb.h sys/time.h \
                   sys/select.h sys/file.h spawn.h])
 
 AM_PROG_CC_C_O
 AC_C_CONST
-AC_TYPE_SIGNAL
 AC_TYPE_UID_T
 AC_TYPE_PID_T
 AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_TYPE_SSIZE_T
+AC_TYPE_INTMAX_T
 AC_TYPE_UINTMAX_T
 
+# Check for sig_atomic_t
+gt_TYPE_SIG_ATOMIC_T
+
 # Find out whether our struct stat returns nanosecond resolution timestamps.
 
 AC_STRUCT_ST_MTIM_NSEC
@@ -115,9 +109,6 @@ AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
   ])
 ])
 
-# Check for DOS-style pathnames.
-pds_AC_DOS_PATHS
-
 # See if we have a standard version of gettimeofday().  Since actual
 # implementations can differ, just make sure we have the most common
 # one.
@@ -138,10 +129,10 @@ AS_IF([test "$ac_cv_func_gettimeofday" = yes],
             [Define to 1 if you have a standard gettimeofday function])
 ])
 
-AC_CHECK_FUNCS([strdup strndup memrchr umask mkstemp mktemp fdopen \
-                dup dup2 getcwd realpath sigsetmask sigaction \
+AC_CHECK_FUNCS([strtoll strdup strndup stpcpy memrchr mempcpy umask mkstemp \
+                mktemp fdopen dup dup2 getcwd realpath sigsetmask sigaction \
                 getgroups seteuid setegid setlinebuf setreuid setregid \
-                getrlimit setrlimit setvbuf pipe strsignal \
+                mkfifo getrlimit setrlimit setvbuf pipe strerror strsignal \
                 lstat readlink atexit isatty ttyname pselect posix_spawn \
                 posix_spawnattr_setsigmask])
 
@@ -153,8 +144,6 @@ AC_CHECK_DECLS([bsd_signal], [], [], [[#define _GNU_SOURCE 1
 
 AC_FUNC_FORK
 
-AC_FUNC_SETVBUF_REVERSED
-
 # Rumor has it that strcasecmp lives in -lresolv on some odd systems.
 # It doesn't hurt much to use our own if we can't find it so I don't
 # make the effort here.
@@ -186,15 +175,35 @@ AS_IF([test "x$with_guile" != xno],
   AC_MSG_RESULT([$guile_version])
   AS_IF([test "$have_guile" = yes],
   [ PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
-    # Unfortunately Guile requires a C99 compiler but GNU make doesn't, so
-    # verify we can actually compile the header.
+    # Unfortunately pkg doesn't help in multi-arch environments where the
+    # package is installed for some architectures but not others; we need
+    # to try to link.
     keep_CPPFLAGS="$CPPFLAGS"
-    CPPFLAGS="$CPPFLAGS $pkg_cv_GUILE_CFLAGS"
+    keep_LIBS="$LIBS"
+    CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
+    LIBS="$LIBS $GUILE_LIBS"
     AC_CHECK_HEADER([libguile.h],
                     [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])],
                     [have_guile=no],
                     [/* Avoid configuration error warnings. */])
+    AS_IF([test "$have_guile" = yes],
+    [ AC_MSG_CHECKING([whether we can link GNU Guile])
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <libguile.h>
+static void *
+guile_init (void *arg)
+{
+   (void) arg;
+   return 0;
+}
+]], [[
+    scm_with_guile (guile_init, 0);
+]])],
+        [have_guile=yes],
+        [have_guile=no])
+      AC_MSG_RESULT([$have_guile])])
     CPPFLAGS="$keep_CPPFLAGS"
+    LIBS="$keep_LIBS"
   ])
 ])
 
@@ -251,8 +260,7 @@ AS_IF([test "$PATH_SEPARATOR" = ';'],
 AC_SUBST([REMOTE]) REMOTE=stub
 use_customs=false
 AC_ARG_WITH([customs],
-[AC_HELP_STRING([--with-customs=DIR],
-                [enable remote jobs via Customs--see README.customs])],
+[AS_HELP_STRING([--with-customs=DIR],[enable remote jobs via Customs--see README.customs])],
 [ AS_CASE([$withval], [n|no], [:],
     [make_cppflags="$CPPFLAGS"
      AS_CASE([$withval],
@@ -275,14 +283,12 @@ AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true])
 # See if the user asked to handle case insensitive file systems.
 AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names])
 AC_ARG_ENABLE([case-insensitive-file-system],
-  AC_HELP_STRING([--enable-case-insensitive-file-system],
-                 [assume file systems are case insensitive]),
+  AS_HELP_STRING([--enable-case-insensitive-file-system],[assume file systems are case insensitive]),
   [AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])])
 
 # See if we can handle the job server feature, and if the user wants it.
 AC_ARG_ENABLE([job-server],
-  AC_HELP_STRING([--disable-job-server],
-                 [disallow recursive make communication during -jN]),
+  AS_HELP_STRING([--disable-job-server],[disallow recursive make communication during -jN]),
   [make_cv_job_server="$enableval" user_job_server="$enableval"],
   [make_cv_job_server="yes"])
 
@@ -320,8 +326,7 @@ AC_CHECK_DECLS([dlopen, dlsym, dlerror], [], [],
   [[#include <dlfcn.h>]])
 
 AC_ARG_ENABLE([load],
-  AC_HELP_STRING([--disable-load],
-                 [disable support for the 'load' operation]),
+  AS_HELP_STRING([--disable-load],[disable support for the 'load' operation]),
   [make_cv_load="$enableval" user_load="$enableval"],
   [make_cv_load="yes"])
 
@@ -371,8 +376,7 @@ AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
 # Use posix_spawn if we have support and the user didn't disable it
 
 AC_ARG_ENABLE([posix-spawn],
-  AC_HELP_STRING([--disable-posix-spawn],
-                 [disable support for posix_spawn()]),
+  AS_HELP_STRING([--disable-posix-spawn],[disable support for posix_spawn()]),
   [make_cv_posix_spawn="$enableval" user_posix_spawn="$enableval"],
   [make_cv_posix_spawn="yes"])
 
@@ -384,20 +388,16 @@ AS_IF([test "$make_cv_posix_spawn" = yes],
     [make_cv_synchronous_posix_spawn],
     [make_cv_synchronous_posix_spawn=no
      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+       #include <errno.h>
        #include <spawn.h>
-       #include <string.h>
-
        extern char **environ;
-
-       int main() {
-         char* path = strdup("./non-existent");
-         char *argv[[2]];
-         argv[[0]] = path;
-         argv[[1]] =  0;
-         return posix_spawn(0, path, 0, 0, argv, environ);
+       int main () {
+         char path[[]] = "./xxx-non-existent";
+         char *argv[[]] = {path, 0};
+         return posix_spawn (0, path, 0, 0, argv, environ) == ENOENT ? 0 : 1;
        }]])],
-       [make_cv_synchronous_posix_spawn=no],
        [make_cv_synchronous_posix_spawn=yes],
+       [make_cv_synchronous_posix_spawn=no],
        [make_cv_synchronous_posix_spawn="no (cross-compiling)"])]))
 
 AS_CASE([/$user_posix_spawn/$make_cv_posix_spawn/$make_cv_synchronous_posix_spawn/],
@@ -445,13 +445,21 @@ AS_CASE([$host],
   [*-*-mingw32],
    [AM_CONDITIONAL([WINDOWSENV], [true])
     w32_target_env=yes
-    AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
-    AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
+    AC_DEFINE([WINDOWS32], [1], [Build for the WINDOWS32 API.])
+    AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
   ])
 
 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
         [Define to the character that separates directories in PATH.])
 
+AC_DEFINE_UNQUOTED([HAVE_DECL_GETLOADAVG],[$HAVE_DECL_GETLOADAVG],
+        [Define to 1 if you have the declaration of 'getloadavg'.])
+
+# Remember that we ran configure to generate config.h
+
+AC_DEFINE([MK_CONFIGURE], [1],
+          [Define to 1 if config.h is generated by running the configure script.])
+
 # Include the Maintainer's Makefile section, if it's here.
 
 MAINT_MAKEFILE=/dev/null
@@ -520,12 +528,20 @@ AS_IF([test "x$make_cv_posix_spawn" = xno && test "x$user_posix_spawn" = xyes],
   echo
 ])
 
+# autoconf initializes $prefix to NONE.
+AM_CONDITIONAL([KNOWN_PREFIX],
+               [test "x$prefix" = xNONE -o "x$prefix" = x/usr/local \
+                     -o "x$prefix" = x/usr/gnu -o "x$prefix" = x/usr])
+
 # Specify what files are to be created.
-AC_CONFIG_FILES([Makefile build.cfg lib/Makefile po/Makefile.in doc/Makefile \
-                 tests/config-flags.pm])
+AC_CONFIG_FILES([build.cfg tests/config-flags.pm \
+                 Makefile lib/Makefile doc/Makefile po/Makefile.in])
 # We don't need this: the standard automake output suffices for POSIX systems.
 #mk/Posix.mk
 
+# Put build.sh in the build directory so it's easy to find
+AC_CONFIG_LINKS([build.sh:build.sh])
+
 # OK, do it!
 
 AC_OUTPUT