source: trunk/src/kmk/configure.ac@ 3144

Last change on this file since 3144 was 3143, checked in by bird, 7 years ago

kmk: bootstrap fixes for linux.

  • Property svn:eol-style set to LF
File size: 17.5 KB
Line 
1# Process this file with autoconf to produce a configure script.
2#
3# Copyright (C) 1993-2016 Free Software Foundation, Inc.
4# This file is part of GNU Make.
5#
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
9# version.
10#
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
14# details.
15#
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/>.
18
19AC_INIT([GNU make],[4.2.1],[bug-make@gnu.org])
20
21AC_PREREQ([2.69])
22
23# Autoconf setup
24AC_CONFIG_AUX_DIR([config])
25AC_CONFIG_SRCDIR([vpath.c])
26AC_CONFIG_HEADERS([config.h])
27
28# Automake setup
29# We have to enable "foreign" because ChangeLog is auto-generated
30# We cannot enable -Werror because gettext 0.18.1 has invalid content
31# When we update gettext to 0.18.3 or better we can add it again.
32# bird: Added subdir-objects
33AM_INIT_AUTOMAKE([1.15 foreign -Werror -Wall subdir-objects])
34
35# Checks for programs.
36AC_USE_SYSTEM_EXTENSIONS
37AC_PROG_CC
38AC_PROG_INSTALL
39AC_PROG_RANLIB
40AC_PROG_CPP
41AC_CHECK_PROG([AR], [ar], [ar], [ar])
42# Perl is needed for the test suite (only)
43AC_CHECK_PROG([PERL], [perl], [perl], [perl])
44
45# Needed for w32/Makefile.am
46AM_PROG_AR
47
48# Specialized system macros
49AC_CANONICAL_HOST
50AC_AIX
51AC_ISC_POSIX
52AC_MINIX
53
54# Enable gettext, in "external" mode.
55# bird: causes trouble when it doesn't find 'po' in SUBDIRS, so skip it.
56#AM_GNU_GETTEXT_VERSION([0.19.4])
57#AM_GNU_GETTEXT([external])
58
59# This test must come as early as possible after the compiler configuration
60# tests, because the choice of the file model can (in principle) affect
61# whether functions and headers are available, whether they work, etc.
62AC_SYS_LARGEFILE
63
64# Checks for libraries.
65AC_SEARCH_LIBS([getpwnam], [sun])
66
67# Checks for header files.
68AC_HEADER_STDC
69AC_HEADER_DIRENT
70AC_HEADER_STAT
71AC_HEADER_TIME
72AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
73 memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h \
74 sys/select.h])
75
76AM_PROG_CC_C_O
77AC_C_CONST
78AC_TYPE_SIGNAL
79AC_TYPE_UID_T
80AC_TYPE_PID_T
81AC_TYPE_OFF_T
82AC_TYPE_SIZE_T
83AC_TYPE_SSIZE_T
84AC_TYPE_UINTMAX_T
85
86# Find out whether our struct stat returns nanosecond resolution timestamps.
87
88AC_STRUCT_ST_MTIM_NSEC
89AC_CACHE_CHECK([whether to use high resolution file timestamps],
90 [make_cv_file_timestamp_hi_res],
91[ make_cv_file_timestamp_hi_res=no
92 AS_IF([test "$ac_cv_struct_st_mtim_nsec" != no],
93 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
94#if HAVE_INTTYPES_H
95# include <inttypes.h>
96#endif]],
97 [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
98 [make_cv_file_timestamp_hi_res=yes])
99 ])])
100AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [val=1], [val=0])
101AC_DEFINE_UNQUOTED([FILE_TIMESTAMP_HI_RES], [$val],
102 [Use high resolution file timestamps if nonzero.])
103
104AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
105[ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
106 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
107 AC_SEARCH_LIBS([clock_gettime], [rt posix4])
108 AS_IF([test "$ac_cv_search_clock_gettime" != no],
109 [ AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
110 [Define to 1 if you have the clock_gettime function.])
111 ])
112])
113
114# Check for DOS-style pathnames.
115pds_AC_DOS_PATHS
116
117# See if we have a standard version of gettimeofday(). Since actual
118# implementations can differ, just make sure we have the most common
119# one.
120AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday],
121 [ac_cv_func_gettimeofday=no
122 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
123 int main ()
124 {
125 struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
126 exit (gettimeofday (&t, 0) != 0
127 || t.tv_sec < 0 || t.tv_usec < 0);
128 }]])],
129 [ac_cv_func_gettimeofday=yes],
130 [ac_cv_func_gettimeofday=no],
131 [ac_cv_func_gettimeofday="no (cross-compiling)"])])
132AS_IF([test "$ac_cv_func_gettimeofday" = yes],
133[ AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
134 [Define to 1 if you have a standard gettimeofday function])
135])
136
137AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \
138 dup dup2 getcwd realpath sigsetmask sigaction \
139 getgroups seteuid setegid setlinebuf setreuid setregid \
140 getrlimit setrlimit setvbuf pipe strerror strsignal \
141 lstat readlink atexit isatty ttyname pselect])
142
143# We need to check declarations, not just existence, because on Tru64 this
144# function is not declared without special flags, which themselves cause
145# other problems. We'll just use our own.
146AC_CHECK_DECLS([bsd_signal], [], [], [[#define _GNU_SOURCE 1
147#include <signal.h>]])
148
149AC_FUNC_FORK
150
151AC_FUNC_SETVBUF_REVERSED
152
153# Rumor has it that strcasecmp lives in -lresolv on some odd systems.
154# It doesn't hurt much to use our own if we can't find it so I don't
155# make the effort here.
156AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
157
158# strcoll() is used by the GNU glob library
159AC_FUNC_STRCOLL
160
161AC_FUNC_ALLOCA
162AC_FUNC_CLOSEDIR_VOID
163
164# See if the user wants to add (or not) GNU Guile support
165PKG_PROG_PKG_CONFIG
166AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
167 [Support GNU Guile for embedded scripting])])
168
169# For some strange reason, at least on Ubuntu, each version of Guile
170# comes with it's own PC file so we have to specify them as individual
171# packages. Ugh.
172AS_IF([test "x$with_guile" != xno],
173[ PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes],
174 [PKG_CHECK_MODULES([GUILE], [guile-1.8], [have_guile=yes],
175 [have_guile=no])])
176])
177
178AS_IF([test "$have_guile" = yes],
179 [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])])
180
181AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
182
183AC_FUNC_GETLOADAVG
184
185# AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
186# doesn't. So, we will.
187
188AS_IF([test "$ac_cv_header_nlist_h" = yes],
189[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
190 [[struct nlist nl;
191 nl.n_name = "string";
192 return 0;]])],
193 [make_cv_nlist_struct=yes],
194 [make_cv_nlist_struct=no])
195 AS_IF([test "$make_cv_nlist_struct" = yes],
196 [ AC_DEFINE([NLIST_STRUCT], [1],
197 [Define to 1 if struct nlist.n_name is a pointer rather than an array.])
198 ])
199])
200
201AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
202 [AC_INCLUDES_DEFAULT
203#include <signal.h>
204/* NetBSD declares sys_siglist in unistd.h. */
205#if HAVE_UNISTD_H
206# include <unistd.h>
207#endif
208])
209
210
211# Check out the wait reality.
212AC_CHECK_HEADERS([sys/wait.h],[],[],[[#include <sys/types.h>]])
213AC_CHECK_FUNCS([waitpid wait3])
214AC_CACHE_CHECK([for union wait], [make_cv_union_wait],
215[ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
216#include <sys/wait.h>]],
217 [[union wait status; int pid; pid = wait (&status);
218#ifdef WEXITSTATUS
219/* Some POSIXoid systems have both the new-style macros and the old
220 union wait type, and they do not work together. If union wait
221 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
222 if (WEXITSTATUS (status) != 0) pid = -1;
223#ifdef WTERMSIG
224 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
225 -- blow chunks here --
226#endif
227#endif
228#ifdef HAVE_WAITPID
229 /* Make sure union wait works with waitpid. */
230 pid = waitpid (-1, &status, 0);
231#endif
232 ]])],
233 [make_cv_union_wait=yes],
234 [make_cv_union_wait=no])
235])
236AS_IF([test "$make_cv_union_wait" = yes],
237[ AC_DEFINE([HAVE_UNION_WAIT], [1],
238 [Define to 1 if you have the 'union wait' type in <sys/wait.h>.])
239])
240
241
242# If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
243AS_IF([test "$PATH_SEPARATOR" = ';'],
244[ AC_DEFINE([HAVE_DOS_PATHS], [1],
245 [Define to 1 if your system requires backslashes or drive specs in pathnames.])
246])
247
248# See if the user wants to use pmake's "customs" distributed build capability
249AC_SUBST([REMOTE]) REMOTE=stub
250use_customs=false
251AC_ARG_WITH([customs],
252[AC_HELP_STRING([--with-customs=DIR],
253 [enable remote jobs via Customs--see README.customs])],
254[ AS_CASE([$withval], [n|no], [:],
255 [make_cppflags="$CPPFLAGS"
256 AS_CASE([$withval],
257 [y|ye|yes], [:],
258 [CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
259 make_ldflags="$LDFLAGS -L$with_customs/lib"])
260 CF_NETLIBS
261 AC_CHECK_HEADER([customs.h],
262 [use_customs=true
263 REMOTE=cstms
264 LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
265 [with_customs=no
266 CPPFLAGS="$make_cppflags" make_badcust=yes])
267 ])
268])
269
270# Tell automake about this, so it can include the right .c files.
271AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true])
272
273# See if the user asked to handle case insensitive file systems.
274AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names])
275AC_ARG_ENABLE([case-insensitive-file-system],
276 AC_HELP_STRING([--enable-case-insensitive-file-system],
277 [assume file systems are case insensitive]),
278 [AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])])
279
280# See if we can handle the job server feature, and if the user wants it.
281AC_ARG_ENABLE([job-server],
282 AC_HELP_STRING([--disable-job-server],
283 [disallow recursive make communication during -jN]),
284 [make_cv_job_server="$enableval" user_job_server="$enableval"],
285 [make_cv_job_server="yes"])
286
287AS_IF([test "$ac_cv_func_waitpid" = no && test "$ac_cv_func_wait3" = no],
288 [has_wait_nohang=no],
289 [has_wait_nohang=yes])
290
291AC_CACHE_CHECK([for SA_RESTART], [make_cv_sa_restart], [
292 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
293 [[return SA_RESTART;]])],
294 [make_cv_sa_restart=yes],
295 [make_cv_sa_restart=no])])
296
297AS_IF([test "$make_cv_sa_restart" != no],
298[ AC_DEFINE([HAVE_SA_RESTART], [1],
299 [Define to 1 if <signal.h> defines the SA_RESTART constant.])
300])
301
302# Only allow jobserver on systems that support it
303AS_CASE([/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/],
304 [*/no/*], [make_cv_job_server=no])
305
306# Also supported on OS2 and MinGW
307AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes])
308
309# If we support it and the user didn't disable it, build with jobserver
310AS_CASE([/$make_cv_job_server/$user_job_server/],
311 [*/no/*], [: no jobserver],
312 [AC_DEFINE(MAKE_JOBSERVER, 1,
313 [Define to 1 to enable job server support in GNU make.])
314 ])
315
316# If dl*() functions are supported we can enable the load operation
317AC_CHECK_DECLS([dlopen, dlsym, dlerror], [], [],
318 [[#include <dlfcn.h>]])
319
320AC_ARG_ENABLE([load],
321 AC_HELP_STRING([--disable-load],
322 [disable support for the 'load' operation]),
323 [make_cv_load="$enableval" user_load="$enableval"],
324 [make_cv_load="yes"])
325
326AS_CASE([/$ac_cv_have_decl_dlopen/$ac_cv_have_decl_dlsym/$ac_cv_have_decl_dlerror/],
327 [*/no/*], [make_cv_load=no])
328
329# We might need -ldl
330AS_IF([test "$make_cv_load" = yes], [
331 AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=])
332 ])
333
334AS_CASE([/$make_cv_load/$user_load/],
335 [*/no/*], [make_cv_load=no],
336 [AC_DEFINE(MAKE_LOAD, 1,
337 [Define to 1 to enable 'load' support in GNU make.])
338 ])
339
340# If we want load support, we might need to link with export-dynamic.
341# See if we can figure it out. Unfortunately this is very difficult.
342# For example passing -rdynamic to the SunPRO linker gives a warning
343# but succeeds and creates a shared object, not an executable!
344AS_IF([test "$make_cv_load" = yes], [
345 AC_MSG_CHECKING([If the linker accepts -Wl,--export-dynamic])
346 old_LDFLAGS="$LDFLAGS"
347 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
348 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
349 [AC_MSG_RESULT([yes])
350 AC_SUBST([AM_LDFLAGS], [-Wl,--export-dynamic])],
351 [AC_MSG_RESULT([no])
352 AC_MSG_CHECKING([If the linker accepts -rdynamic])
353 LDFLAGS="$old_LDFLAGS -rdynamic"
354 AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
355 [AC_MSG_RESULT([yes])
356 AC_SUBST([AM_LDFLAGS], [-rdynamic])],
357 [AC_MSG_RESULT([no])])
358 ])
359 LDFLAGS="$old_LDFLAGS"
360])
361
362# if we have both lstat() and readlink() then we can support symlink
363# timechecks.
364AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
365 [ AC_DEFINE([MAKE_SYMLINKS], [1],
366 [Define to 1 to enable symbolic link timestamp checking.])
367])
368
369# Find the SCCS commands, so we can include them in our default rules.
370
371AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
372 AS_IF([test -f /usr/sccs/get],
373 [make_cv_path_sccs_get=/usr/sccs/get],
374 [make_cv_path_sccs_get=get])
375])
376AC_DEFINE_UNQUOTED([SCCS_GET], ["$make_cv_path_sccs_get"],
377 [Define to the name of the SCCS 'get' command.])
378
379ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
380AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
381 test -f s.conftest],
382[ # We successfully created an SCCS file.
383 AC_CACHE_CHECK([if SCCS get command understands -G], [make_cv_sys_get_minus_G],
384 [AS_IF([$make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
385 test -f conftoast],
386 [make_cv_sys_get_minus_G=yes],
387 [make_cv_sys_get_minus_G=no])
388 ])
389 AS_IF([test "$make_cv_sys_get_minus_G" = yes],
390 [AC_DEFINE([SCCS_GET_MINUS_G], [1],
391 [Define to 1 if the SCCS 'get' command understands the '-G<file>' option.])
392 ])
393])
394rm -f s.conftest conftoast
395
396# Check the system to see if it provides GNU glob. If not, use our
397# local version.
398AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
399[ AC_EGREP_CPP([gnu glob],[
400#include <features.h>
401#include <glob.h>
402#include <fnmatch.h>
403
404#define GLOB_INTERFACE_VERSION 1
405#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
406# include <gnu-versions.h>
407# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
408 gnu glob
409# endif
410#endif],
411 [make_cv_sys_gnu_glob=yes],
412 [make_cv_sys_gnu_glob=no])])
413AS_IF([test "$make_cv_sys_gnu_glob" = no],
414[ GLOBINC='-I$(srcdir)/glob'
415 GLOBLIB=glob/libglob.a
416])
417AC_SUBST([GLOBINC])
418AC_SUBST([GLOBLIB])
419
420# Tell automake about this, so it can build the right .c files.
421AM_CONDITIONAL([USE_LOCAL_GLOB], [test "$make_cv_sys_gnu_glob" = no])
422
423# Let the makefile know what our build host is
424
425AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
426MAKE_HOST="$host"
427AC_SUBST([MAKE_HOST])
428
429w32_target_env=no
430AM_CONDITIONAL([WINDOWSENV], [false])
431
432AS_CASE([$host],
433 [*-*-mingw32],
434 [AM_CONDITIONAL([WINDOWSENV], [true])
435 w32_target_env=yes
436 AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
437 AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
438 ])
439
440AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
441 [Define to the character that separates directories in PATH.])
442
443# Include the Maintainer's Makefile section, if it's here.
444
445MAINT_MAKEFILE=/dev/null
446AS_IF([test -r "$srcdir/maintMakefile"],
447[ MAINT_MAKEFILE="$srcdir/maintMakefile"
448])
449AC_SUBST_FILE([MAINT_MAKEFILE])
450
451# Allow building with dmalloc
452AM_WITH_DMALLOC
453
454# Forcibly disable SET_MAKE. If it's set it breaks things like the test
455# scripts, etc.
456SET_MAKE=
457
458# Sanity check and inform the user of what we found
459
460AS_IF([test "x$make_badcust" = xyes], [
461echo
462echo "WARNING: --with-customs specified but no customs.h could be found;"
463echo " disabling Customs support."
464echo
465])
466
467AS_CASE([$with_customs],
468[""|n|no|y|ye|yes], [:],
469[AS_IF([test -f "$with_customs/lib/libcustoms.a"], [:],
470[ echo
471 echo "WARNING: '$with_customs/lib' does not appear to contain the"
472 echo " Customs library. You must build and install Customs"
473 echo " before compiling GNU make."
474 echo
475])])
476
477AS_IF([test "x$has_wait_nohang" = xno],
478[ echo
479 echo "WARNING: Your system has neither waitpid() nor wait3()."
480 echo " Without one of these, signal handling is unreliable."
481 echo " You should be aware that running GNU make with -j"
482 echo " could result in erratic behavior."
483 echo
484])
485
486AS_IF([test "x$make_cv_job_server" = xno && test "x$user_job_server" = xyes],
487[ echo
488 echo "WARNING: Make job server requires a POSIX-ish system that"
489 echo " supports the pipe(), sigaction(), and either"
490 echo " waitpid() or wait3() functions. Your system doesn't"
491 echo " appear to provide one or more of those."
492 echo " Disabling job server support."
493 echo
494])
495
496AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
497[ echo
498 echo "WARNING: 'load' support requires a POSIX-ish system that"
499 echo " supports the dlopen(), dlsym(), and dlerror() functions."
500 echo " Your system doesn't appear to provide one or more of these."
501 echo " Disabling 'load' support."
502 echo
503])
504
505# Specify what files are to be created.
506AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
507 doc/Makefile w32/Makefile tests/config-flags.pm])
508
509# OK, do it!
510
511AC_OUTPUT
512
513# We only generate the build.sh if we have a build.sh.in; we won't have
514# one before we've created a distribution.
515AS_IF([test -f "$srcdir/build.sh.in"],
516[ ./config.status --file build.sh
517 chmod +x build.sh
518])
519
520dnl Local Variables:
521dnl comment-start: "dnl "
522dnl comment-end: ""
523dnl comment-start-skip: "\\bdnl\\b\\s *"
524dnl compile-command: "make configure config.h.in"
525dnl End:
Note: See TracBrowser for help on using the repository browser.