1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 1993-2020 Free Software Foundation, Inc.
4 # This file is part of GNU Make.
6 # GNU Make is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 3 of the License, or (at your option) any later
11 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 # You should have received a copy of the GNU General Public License along with
17 # this program. If not, see <http://www.gnu.org/licenses/>.
19 AC_INIT([GNU make],[4.3],[bug-make@gnu.org])
24 AC_CONFIG_AUX_DIR([build-aux])
25 AC_CONFIG_SRCDIR([src/vpath.c])
26 AC_CONFIG_HEADERS([src/config.h])
28 AC_CONFIG_LIBOBJ_DIR([lib])
31 # We have to enable "foreign" because ChangeLog is auto-generated
32 # Automake 1.15 and gnulib don't get along: gnulib has some strange error
33 # in the way it handles getloadavg.c which causes make distcheck to fail.
34 # http://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
35 AM_INIT_AUTOMAKE([1.15.1 foreign -Werror -Wall])
37 # Checks for programs.
38 AC_USE_SYSTEM_EXTENSIONS
48 AC_CHECK_PROG([AR], [ar], [ar], [ar])
49 # Perl is needed for the test suite (only)
50 AC_CHECK_PROG([PERL], [perl], [perl], [perl])
52 # Specialized system macros
59 # Enable gettext, in "external" mode.
60 AM_GNU_GETTEXT_VERSION([0.19.4])
61 AM_GNU_GETTEXT([external])
63 # This test must come as early as possible after the compiler configuration
64 # tests, because the choice of the file model can (in principle) affect
65 # whether functions and headers are available, whether they work, etc.
68 # Checks for libraries.
69 AC_SEARCH_LIBS([getpwnam], [sun])
71 # Checks for header files.
76 AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
77 memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h \
78 sys/select.h sys/file.h spawn.h])
90 # Find out whether our struct stat returns nanosecond resolution timestamps.
92 AC_STRUCT_ST_MTIM_NSEC
93 AC_CACHE_CHECK([whether to use high resolution file timestamps],
94 [make_cv_file_timestamp_hi_res],
95 [ make_cv_file_timestamp_hi_res=no
96 AS_IF([test "$ac_cv_struct_st_mtim_nsec" != no],
97 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
99 # include <inttypes.h>
101 [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
102 [make_cv_file_timestamp_hi_res=yes])
104 AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [val=1], [val=0])
105 AC_DEFINE_UNQUOTED([FILE_TIMESTAMP_HI_RES], [$val],
106 [Use high resolution file timestamps if nonzero.])
108 AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
109 [ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
110 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
111 AC_SEARCH_LIBS([clock_gettime], [rt posix4])
112 AS_IF([test "$ac_cv_search_clock_gettime" != no],
113 [ AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
114 [Define to 1 if you have the clock_gettime function.])
118 # Check for DOS-style pathnames.
121 # See if we have a standard version of gettimeofday(). Since actual
122 # implementations can differ, just make sure we have the most common
124 AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday],
125 [ac_cv_func_gettimeofday=no
126 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
129 struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
130 return gettimeofday (&t, 0) != 0
131 || t.tv_sec < 0 || t.tv_usec < 0;
133 [ac_cv_func_gettimeofday=yes],
134 [ac_cv_func_gettimeofday=no],
135 [ac_cv_func_gettimeofday="no (cross-compiling)"])])
136 AS_IF([test "$ac_cv_func_gettimeofday" = yes],
137 [ AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
138 [Define to 1 if you have a standard gettimeofday function])
141 AC_CHECK_FUNCS([strdup strndup memrchr umask mkstemp mktemp fdopen \
142 dup dup2 getcwd realpath sigsetmask sigaction \
143 getgroups seteuid setegid setlinebuf setreuid setregid \
144 getrlimit setrlimit setvbuf pipe strsignal \
145 lstat readlink atexit isatty ttyname pselect posix_spawn \
146 posix_spawnattr_setsigmask])
148 # We need to check declarations, not just existence, because on Tru64 this
149 # function is not declared without special flags, which themselves cause
150 # other problems. We'll just use our own.
151 AC_CHECK_DECLS([bsd_signal], [], [], [[#define _GNU_SOURCE 1
152 #include <signal.h>]])
156 AC_FUNC_SETVBUF_REVERSED
158 # Rumor has it that strcasecmp lives in -lresolv on some odd systems.
159 # It doesn't hurt much to use our own if we can't find it so I don't
160 # make the effort here.
161 AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
163 # strcoll() is used by the GNU glob library
165 AC_FUNC_CLOSEDIR_VOID
167 # dir.c and our glob.c use dirent.d_type if available
168 AC_STRUCT_DIRENT_D_TYPE
170 # See if the user wants to add (or not) GNU Guile support
171 AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
172 [Support GNU Guile for embedded scripting])])
174 # Annoyingly, each version of Guile comes with it's own PC file so we have to
175 # specify them as individual packages. Ugh.
178 AS_IF([test "x$with_guile" != xno],
179 [ guile_versions="3.0 2.2 2.0 1.8"
182 AC_MSG_CHECKING([for GNU Guile])
183 for v in $guile_versions; do
184 PKG_CHECK_EXISTS([guile-$v], [guile_version=$v; have_guile=yes; break], [])
186 AC_MSG_RESULT([$guile_version])
187 AS_IF([test "$have_guile" = yes],
188 [ PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
189 # Unfortunately Guile requires a C99 compiler but GNU make doesn't, so
190 # verify we can actually compile the header.
191 keep_CPPFLAGS="$CPPFLAGS"
192 CPPFLAGS="$CPPFLAGS $pkg_cv_GUILE_CFLAGS"
193 AC_CHECK_HEADER([libguile.h],
194 [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])],
196 [/* Avoid configuration error warnings. */])
197 CPPFLAGS="$keep_CPPFLAGS"
201 AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = "yes"])
203 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
206 /* NetBSD declares sys_siglist in unistd.h. */
213 # Check out the wait reality.
214 AC_CHECK_HEADERS([sys/wait.h],[],[],[[#include <sys/types.h>]])
215 AC_CHECK_FUNCS([waitpid wait3])
216 AC_CACHE_CHECK([for union wait], [make_cv_union_wait],
217 [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
218 #include <sys/wait.h>]],
219 [[union wait status; int pid; pid = wait (&status);
221 /* Some POSIXoid systems have both the new-style macros and the old
222 union wait type, and they do not work together. If union wait
223 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
224 if (WEXITSTATUS (status) != 0) pid = -1;
226 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
227 -- blow chunks here --
231 /* Make sure union wait works with waitpid. */
232 pid = waitpid (-1, &status, 0);
235 [make_cv_union_wait=yes],
236 [make_cv_union_wait=no])
238 AS_IF([test "$make_cv_union_wait" = yes],
239 [ AC_DEFINE([HAVE_UNION_WAIT], [1],
240 [Define to 1 if you have the 'union wait' type in <sys/wait.h>.])
244 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
245 AS_IF([test "$PATH_SEPARATOR" = ';'],
246 [ AC_DEFINE([HAVE_DOS_PATHS], [1],
247 [Define to 1 if your system requires backslashes or drive specs in pathnames.])
250 # See if the user wants to use pmake's "customs" distributed build capability
251 AC_SUBST([REMOTE]) REMOTE=stub
253 AC_ARG_WITH([customs],
254 [AC_HELP_STRING([--with-customs=DIR],
255 [enable remote jobs via Customs--see README.customs])],
256 [ AS_CASE([$withval], [n|no], [:],
257 [make_cppflags="$CPPFLAGS"
260 [CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
261 make_ldflags="$LDFLAGS -L$with_customs/lib"])
263 AC_CHECK_HEADER([customs.h],
266 LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
268 CPPFLAGS="$make_cppflags" make_badcust=yes])
272 # Tell automake about this, so it can include the right .c files.
273 AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true])
275 # See if the user asked to handle case insensitive file systems.
276 AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names])
277 AC_ARG_ENABLE([case-insensitive-file-system],
278 AC_HELP_STRING([--enable-case-insensitive-file-system],
279 [assume file systems are case insensitive]),
280 [AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])])
282 # See if we can handle the job server feature, and if the user wants it.
283 AC_ARG_ENABLE([job-server],
284 AC_HELP_STRING([--disable-job-server],
285 [disallow recursive make communication during -jN]),
286 [make_cv_job_server="$enableval" user_job_server="$enableval"],
287 [make_cv_job_server="yes"])
289 AS_IF([test "$ac_cv_func_waitpid" = no && test "$ac_cv_func_wait3" = no],
290 [has_wait_nohang=no],
291 [has_wait_nohang=yes])
293 AC_CACHE_CHECK([for SA_RESTART], [make_cv_sa_restart], [
294 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
295 [[return SA_RESTART;]])],
296 [make_cv_sa_restart=yes],
297 [make_cv_sa_restart=no])])
299 AS_IF([test "$make_cv_sa_restart" != no],
300 [ AC_DEFINE([HAVE_SA_RESTART], [1],
301 [Define to 1 if <signal.h> defines the SA_RESTART constant.])
304 # Only allow jobserver on systems that support it
305 AS_CASE([/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/],
306 [*/no/*], [make_cv_job_server=no])
308 # Also supported on OS2 and MinGW
309 AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes])
311 # If we support it and the user didn't disable it, build with jobserver
312 AS_CASE([/$make_cv_job_server/$user_job_server/],
313 [*/no/*], [: no jobserver],
314 [AC_DEFINE(MAKE_JOBSERVER, 1,
315 [Define to 1 to enable job server support in GNU make.])
318 # If dl*() functions are supported we can enable the load operation
319 AC_CHECK_DECLS([dlopen, dlsym, dlerror], [], [],
320 [[#include <dlfcn.h>]])
322 AC_ARG_ENABLE([load],
323 AC_HELP_STRING([--disable-load],
324 [disable support for the 'load' operation]),
325 [make_cv_load="$enableval" user_load="$enableval"],
326 [make_cv_load="yes"])
328 AS_CASE([/$ac_cv_have_decl_dlopen/$ac_cv_have_decl_dlsym/$ac_cv_have_decl_dlerror/],
329 [*/no/*], [make_cv_load=no])
332 AS_IF([test "$make_cv_load" = yes], [
333 AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=])
336 AS_CASE([/$make_cv_load/$user_load/],
337 [*/no/*], [make_cv_load=no],
338 [AC_DEFINE(MAKE_LOAD, 1,
339 [Define to 1 to enable 'load' support in GNU make.])
342 # If we want load support, we might need to link with export-dynamic.
343 # See if we can figure it out. Unfortunately this is very difficult.
344 # For example passing -rdynamic to the SunPRO linker gives a warning
345 # but succeeds and creates a shared object, not an executable!
346 AS_IF([test "$make_cv_load" = yes], [
347 AC_MSG_CHECKING([If the linker accepts -Wl,--export-dynamic])
348 old_LDFLAGS="$LDFLAGS"
349 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
350 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
351 [AC_MSG_RESULT([yes])
352 AC_SUBST([AM_LDFLAGS], [-Wl,--export-dynamic])],
354 AC_MSG_CHECKING([If the linker accepts -rdynamic])
355 LDFLAGS="$old_LDFLAGS -rdynamic"
356 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
357 [AC_MSG_RESULT([yes])
358 AC_SUBST([AM_LDFLAGS], [-rdynamic])],
359 [AC_MSG_RESULT([no])])
361 LDFLAGS="$old_LDFLAGS"
364 # if we have both lstat() and readlink() then we can support symlink
366 AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
367 [ AC_DEFINE([MAKE_SYMLINKS], [1],
368 [Define to 1 to enable symbolic link timestamp checking.])
371 # Use posix_spawn if we have support and the user didn't disable it
373 AC_ARG_ENABLE([posix-spawn],
374 AC_HELP_STRING([--disable-posix-spawn],
375 [disable support for posix_spawn()]),
376 [make_cv_posix_spawn="$enableval" user_posix_spawn="$enableval"],
377 [make_cv_posix_spawn="yes"])
379 AS_CASE([/$ac_cv_header_spawn/$ac_cv_func_posix_spawn/],
380 [*/no/*], [make_cv_posix_spawn=no])
382 AS_IF([test "$make_cv_posix_spawn" = yes],
383 AC_CACHE_CHECK([for posix_spawn that fails synchronously],
384 [make_cv_synchronous_posix_spawn],
385 [make_cv_synchronous_posix_spawn=no
386 AC_RUN_IFELSE([AC_LANG_SOURCE([[
390 extern char **environ;
393 char* path = strdup("./non-existent");
397 return posix_spawn(0, path, 0, 0, argv, environ);
399 [make_cv_synchronous_posix_spawn=no],
400 [make_cv_synchronous_posix_spawn=yes],
401 [make_cv_synchronous_posix_spawn="no (cross-compiling)"])]))
403 AS_CASE([/$user_posix_spawn/$make_cv_posix_spawn/$make_cv_synchronous_posix_spawn/],
404 [*/no/*], [make_cv_posix_spawn=no],
405 [AC_DEFINE(USE_POSIX_SPAWN, 1, [Define to 1 to use posix_spawn().])
408 # Find the SCCS commands, so we can include them in our default rules.
410 AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
411 AS_IF([test -f /usr/sccs/get],
412 [make_cv_path_sccs_get=/usr/sccs/get],
413 [make_cv_path_sccs_get=get])
415 AC_DEFINE_UNQUOTED([SCCS_GET], ["$make_cv_path_sccs_get"],
416 [Define to the name of the SCCS 'get' command.])
418 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
419 AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
421 [ # We successfully created an SCCS file.
422 AC_CACHE_CHECK([if SCCS get command understands -G], [make_cv_sys_get_minus_G],
423 [AS_IF([$make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
425 [make_cv_sys_get_minus_G=yes],
426 [make_cv_sys_get_minus_G=no])
428 AS_IF([test "$make_cv_sys_get_minus_G" = yes],
429 [AC_DEFINE([SCCS_GET_MINUS_G], [1],
430 [Define to 1 if the SCCS 'get' command understands the '-G<file>' option.])
433 rm -f s.conftest conftoast
435 # Let the makefile know what our build host is
437 AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
439 AC_SUBST([MAKE_HOST])
442 AM_CONDITIONAL([WINDOWSENV], [false])
446 [AM_CONDITIONAL([WINDOWSENV], [true])
448 AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
449 AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
452 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
453 [Define to the character that separates directories in PATH.])
455 # Include the Maintainer's Makefile section, if it's here.
457 MAINT_MAKEFILE=/dev/null
458 AS_IF([test -r "$srcdir/maintMakefile"],
459 [ MAINT_MAKEFILE="$srcdir/maintMakefile"
461 AC_SUBST_FILE([MAINT_MAKEFILE])
463 # Allow building with dmalloc
466 # Forcibly disable SET_MAKE. If it's set it breaks things like the test
470 # Sanity check and inform the user of what we found
472 AS_IF([test "x$make_badcust" = xyes], [
474 echo "WARNING: --with-customs specified but no customs.h could be found;"
475 echo " disabling Customs support."
479 AS_CASE([$with_customs],
480 [""|n|no|y|ye|yes], [:],
481 [AS_IF([test -f "$with_customs/lib/libcustoms.a"], [:],
483 echo "WARNING: '$with_customs/lib' does not appear to contain the"
484 echo " Customs library. You must build and install Customs"
485 echo " before compiling GNU make."
489 AS_IF([test "x$has_wait_nohang" = xno],
491 echo "WARNING: Your system has neither waitpid() nor wait3()."
492 echo " Without one of these, signal handling is unreliable."
493 echo " You should be aware that running GNU make with -j"
494 echo " could result in erratic behavior."
498 AS_IF([test "x$make_cv_job_server" = xno && test "x$user_job_server" = xyes],
500 echo "WARNING: Make job server requires a POSIX-ish system that"
501 echo " supports the pipe(), sigaction(), and either"
502 echo " waitpid() or wait3() functions. Your system doesn't"
503 echo " appear to provide one or more of those."
504 echo " Disabling job server support."
508 AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
510 echo "WARNING: 'load' support requires a POSIX-ish system that"
511 echo " supports the dlopen(), dlsym(), and dlerror() functions."
512 echo " Your system doesn't appear to provide one or more of these."
513 echo " Disabling 'load' support."
517 AS_IF([test "x$make_cv_posix_spawn" = xno && test "x$user_posix_spawn" = xyes],
519 echo "WARNING: posix_spawn() is not supported on this system."
523 # Specify what files are to be created.
524 AC_CONFIG_FILES([Makefile build.cfg lib/Makefile po/Makefile.in doc/Makefile \
525 tests/config-flags.pm])
526 # We don't need this: the standard automake output suffices for POSIX systems.
534 dnl comment-start: "dnl "
536 dnl comment-start-skip: "\\bdnl\\b\\s *"
537 dnl compile-command: "make configure config.h.in"