Define _GNU_SOURCE before testing for bsd_signal.
[make.git] / configure.in
blob1da6cb2e93b74af03836ba5f772a46dc1d264dca
1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 1993-2012 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
9 # version.
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.
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],[3.82.90],[bug-make@gnu.org])
21 AC_PREREQ([2.59])
22 AC_REVISION([$Id: configure.in,v 1.165 2012/09/10 03:05:49 psmith Exp $])
24 # Autoconf setup
25 AC_CONFIG_AUX_DIR([config])
26 AC_CONFIG_SRCDIR([vpath.c])
27 AC_CONFIG_HEADERS([config.h])
29 # Automake setup
30 AM_INIT_AUTOMAKE([1.9])
32 # Checks for programs.
33 AC_PROG_CC
34 AC_PROG_INSTALL
35 AC_PROG_RANLIB
36 AC_PROG_CPP
37 AC_CHECK_PROG([AR], [ar], [ar], [ar])
38 # Perl is needed for the test suite (only)
39 AC_CHECK_PROG([PERL], [perl], [perl], [perl])
41 # Specialized system macros
42 AC_CANONICAL_HOST
43 AC_AIX
44 AC_ISC_POSIX
45 AC_MINIX
47 # Enable gettext, in "external" mode.
49 AM_GNU_GETTEXT_VERSION([0.14.1])
50 AM_GNU_GETTEXT([external])
52 # This test must come as early as possible after the compiler configuration
53 # tests, because the choice of the file model can (in principle) affect
54 # whether functions and headers are available, whether they work, etc.
55 AC_SYS_LARGEFILE
57 # Checks for libraries.
58 AC_SEARCH_LIBS([getpwnam], [sun])
60 # Checks for header files.
61 AC_HEADER_STDC
62 AC_HEADER_DIRENT
63 AC_HEADER_STAT
64 AC_HEADER_TIME
65 AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
66                   memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h])
68 # Set a flag if we have an ANSI C compiler
69 AS_IF([test "$ac_cv_prog_cc_stdc" != no],
70 [ AC_DEFINE([HAVE_ANSI_COMPILER], [1],
71             [Define to 1 if your compiler conforms to the ANSI C standard.])
75 # Determine what kind of variadic function calls we support
76 AC_CHECK_HEADERS([stdarg.h varargs.h], [break])
78 AM_PROG_CC_C_O
79 AC_C_CONST
80 AC_TYPE_SIGNAL
81 AC_TYPE_UID_T
82 AC_TYPE_PID_T
84 # Find some definition for uintmax_t
86 AC_CHECK_TYPE([uintmax_t],[],
87 [ uintmax_t="unsigned long"
88   AC_CHECK_TYPE([unsigned long long],[uintmax_t="unsigned long long"])
89   AC_DEFINE_UNQUOTED([uintmax_t], [$uintmax_t],
90     [Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])
93 # Find out whether our struct stat returns nanosecond resolution timestamps.
95 AC_STRUCT_ST_MTIM_NSEC
96 AC_CACHE_CHECK([whether to use high resolution file timestamps],
97                [make_cv_file_timestamp_hi_res],
98 [ make_cv_file_timestamp_hi_res=no
99   AS_IF([test "$ac_cv_struct_st_mtim_nsec" != no],
100         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
101 #if HAVE_INTTYPES_H
102 # include <inttypes.h>
103 #endif]],
104                       [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
105         [make_cv_file_timestamp_hi_res=yes])
106   ])])
107 AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [val=1], [val=0])
108 AC_DEFINE_UNQUOTED([FILE_TIMESTAMP_HI_RES], [$val],
109                    [Use high resolution file timestamps if nonzero.])
111 AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
112 [ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
113   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
114   AC_SEARCH_LIBS([clock_gettime], [rt posix4])
115   AS_IF([test "$ac_cv_search_clock_gettime" != no],
116   [ AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
117               [Define to 1 if you have the clock_gettime function.])
118   ])
121 # Check for DOS-style pathnames.
122 pds_AC_DOS_PATHS
124 # See if we have a standard version of gettimeofday().  Since actual
125 # implementations can differ, just make sure we have the most common
126 # one.
127 AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday],
128   [ac_cv_func_gettimeofday=no
129    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
130                   int main ()
131                   {
132                     struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
133                     exit (gettimeofday (&t, 0) != 0
134                           || t.tv_sec < 0 || t.tv_usec < 0);
135                   }]])],
136                   [ac_cv_func_gettimeofday=yes],
137                   [ac_cv_func_gettimeofday=no],
138                   [ac_cv_func_gettimeofday="no (cross-compiling)"])])
139 AS_IF([test "$ac_cv_func_gettimeofday" = yes],
140 [ AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
141             [Define to 1 if you have a standard gettimeofday function])
144 AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \
145                 dup2 getcwd realpath sigsetmask sigaction \
146                 getgroups seteuid setegid setlinebuf setreuid setregid \
147                 getrlimit setrlimit setvbuf pipe strerror strsignal \
148                 lstat readlink atexit])
150 # We need to check declarations, not just existence, because on Tru64 this
151 # function is not declared without special flags, which themselves cause
152 # other problems.  We'll just use our own.
153 AC_CHECK_DECLS([bsd_signal], [], [], [[#define _GNU_SOURCE 1
154 #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
164 AC_FUNC_STRCOLL
166 AC_FUNC_ALLOCA
167 AC_FUNC_FORK([])
168 AC_FUNC_VPRINTF
169 AC_FUNC_CLOSEDIR_VOID
171 # See if the user wants to add (or not) GNU Guile support
172 PKG_PROG_PKG_CONFIG
173 AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
174             [Support GNU Guile for embedded scripting])])
176 # For some strange reason, at least on Ubuntu, each version of Guile
177 # comes with it's own PC file so we have to specify them as individual
178 # packages.  Ugh.
179 AS_IF([test "x$with_guile" != xno],
180 [ PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes],
181   [PKG_CHECK_MODULES([GUILE], [guile-1.8], [have_guile=yes],
182     [have_guile=no])])
185 AS_IF([test "$have_guile" = yes],
186       [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])])
188 AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
190 AC_FUNC_GETLOADAVG
192 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
193 # doesn't.  So, we will.
195 AS_IF([test "$ac_cv_header_nlist_h" = yes],
196 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
197         [[struct nlist nl;
198           nl.n_name = "string";
199           return 0;]])],
200         [make_cv_nlist_struct=yes],
201         [make_cv_nlist_struct=no])
202   AS_IF([test "$make_cv_nlist_struct" = yes],
203   [ AC_DEFINE([NLIST_STRUCT], [1],
204        [Define to 1 if struct nlist.n_name is a pointer rather than an array.])
205   ])
208 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
209   [AC_INCLUDES_DEFAULT
210 #include <signal.h>
211 /* NetBSD declares sys_siglist in unistd.h.  */
212 #if HAVE_UNISTD_H
213 # include <unistd.h>
214 #endif
218 # Check out the wait reality.
219 AC_CHECK_HEADERS([sys/wait.h],[],[],[[#include <sys/types.h>]])
220 AC_CHECK_FUNCS([waitpid wait3])
221 AC_CACHE_CHECK([for union wait], [make_cv_union_wait],
222 [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
223 #include <sys/wait.h>]],
224      [[union wait status; int pid; pid = wait (&status);
225 #ifdef WEXITSTATUS
226 /* Some POSIXoid systems have both the new-style macros and the old
227    union wait type, and they do not work together.  If union wait
228    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
229         if (WEXITSTATUS (status) != 0) pid = -1;
230 #ifdef WTERMSIG
231         /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
232         -- blow chunks here --
233 #endif
234 #endif
235 #ifdef HAVE_WAITPID
236         /* Make sure union wait works with waitpid.  */
237         pid = waitpid (-1, &status, 0);
238 #endif
239       ]])],
240     [make_cv_union_wait=yes],
241     [make_cv_union_wait=no])
243 AS_IF([test "$make_cv_union_wait" = yes],
244 [ AC_DEFINE([HAVE_UNION_WAIT], [1],
245             [Define to 1 if you have the 'union wait' type in <sys/wait.h>.])
249 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
250 AS_IF([test "$PATH_SEPARATOR" = ';'],
251 [ AC_DEFINE([HAVE_DOS_PATHS], [1],
252             [Define to 1 if your system requires backslashes or drive specs in pathnames.])
256 # See if the user wants to use pmake's "customs" distributed build capability
258 AC_SUBST([REMOTE]) REMOTE=stub
259 use_customs=false
260 AC_ARG_WITH([customs],
261 [ AC_HELP_STRING([--with-customs=DIR],
262                  [enable remote jobs via Customs--see README.customs])],
263 [ AS_CASE([$withval], [n|no], [:],
264     [make_cppflags="$CPPFLAGS"
265      AS_CASE([$withval],
266              [y|ye|yes], [:],
267              [CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
268               make_ldflags="$LDFLAGS -L$with_customs/lib"])
269      CF_NETLIBS
270      AC_CHECK_HEADER([customs.h],
271                      [use_customs=true
272                       REMOTE=cstms
273                       LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
274                      [with_customs=no
275                       CPPFLAGS="$make_cppflags" make_badcust=yes])
276     ])
279 # Tell automake about this, so it can include the right .c files.
280 AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true])
282 # See if the user asked to handle case insensitive file systems.
284 AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names])
285 AC_ARG_ENABLE([case-insensitive-file-system],
286   AC_HELP_STRING([--enable-case-insensitive-file-system],
287                  [assume file systems are case insensitive]),
288   [AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])])
290 # See if we can handle the job server feature, and if the user wants it.
292 AC_ARG_ENABLE([job-server],
293   AC_HELP_STRING([--disable-job-server],
294                  [disallow recursive make communication during -jN]),
295   [make_cv_job_server="$enableval" user_job_server="$enableval"],
296   [make_cv_job_server="yes"])
298 AS_IF([test "$ac_cv_func_waitpid" = no && test "$ac_cv_func_wait3" = no],
299       [has_wait_nohang=no],
300       [has_wait_nohang=yes])
302 AC_CACHE_CHECK([for SA_RESTART], [make_cv_sa_restart], [
303   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
304       [[return SA_RESTART;]])],
305     [make_cv_sa_restart=yes],
306     [make_cv_sa_restart=no])])
308 AS_IF([test "$make_cv_sa_restart" != no],
309 [ AC_DEFINE([HAVE_SA_RESTART], [1],
310      [Define to 1 if <signal.h> defines the SA_RESTART constant.])
313 # Only allow jobserver on systems that support it
314 AS_CASE([/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/],
315   [*/no/*], [make_cv_job_server=no])
317 # Also supported on OS2 and MinGW
318 AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes])
320 # If we support it and the user didn't disable it, build with jobserver
321 AS_CASE([/$make_cv_job_server/$user_job_server/],
322   [*/no/*], [: no jobserver],
323   [AC_DEFINE(MAKE_JOBSERVER, 1,
324              [Define to 1 to enable job server support in GNU make.])
325   ])
327 # if we have both lstat() and readlink() then we can support symlink
328 # timechecks.
329 AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
330 [ AC_DEFINE([MAKE_SYMLINKS], [1],
331             [Define to 1 to enable symbolic link timestamp checking.])
334 # Find the SCCS commands, so we can include them in our default rules.
336 AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
337   AS_IF([test -f /usr/sccs/get],
338         [make_cv_path_sccs_get=/usr/sccs/get],
339         [make_cv_path_sccs_get=get])
341 AC_DEFINE_UNQUOTED([SCCS_GET], ["$make_cv_path_sccs_get"],
342                    [Define to the name of the SCCS 'get' command.])
344 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
345 AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
346    test -f s.conftest],
347 [ # We successfully created an SCCS file.
348   AC_CACHE_CHECK([if SCCS get command understands -G], [make_cv_sys_get_minus_G],
349     [AS_IF([$make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
350             test -f conftoast],
351            [make_cv_sys_get_minus_G=yes],
352            [make_cv_sys_get_minus_G=no])
353     ])
354   AS_IF([test "$make_cv_sys_get_minus_G" = yes],
355     [AC_DEFINE([SCCS_GET_MINUS_G], [1],
356      [Define to 1 if the SCCS 'get' command understands the '-G<file>' option.])
357     ])
359 rm -f s.conftest conftoast
361 # Check the system to see if it provides GNU glob.  If not, use our
362 # local version.
363 AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
364 [ AC_EGREP_CPP([gnu glob],[
365 #include <features.h>
366 #include <glob.h>
367 #include <fnmatch.h>
369 #define GLOB_INTERFACE_VERSION 1
370 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
371 # include <gnu-versions.h>
372 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
373    gnu glob
374 # endif
375 #endif],
376         [make_cv_sys_gnu_glob=yes],
377         [make_cv_sys_gnu_glob=no])])
378 AS_IF([test "$make_cv_sys_gnu_glob" = no],
379 [ GLOBINC='-I$(srcdir)/glob'
380   GLOBLIB=glob/libglob.a
382 AC_SUBST([GLOBINC])
383 AC_SUBST([GLOBLIB])
385 # Tell automake about this, so it can build the right .c files.
386 AM_CONDITIONAL([USE_LOCAL_GLOB], [test "$make_cv_sys_gnu_glob" = no])
388 # Let the makefile know what our build host is
390 AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
391 MAKE_HOST="$host"
392 AC_SUBST([MAKE_HOST])
394 w32_target_env=no
395 AM_CONDITIONAL([WINDOWSENV], [false])
397 AS_CASE([$host],
398   [*-*-mingw32],
399    [AM_CONDITIONAL([WINDOWSENV], [true])
400     w32_target_env=yes
401     AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
402     AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
403   ])
405 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
406         [Define to the character that separates directories in PATH.])
408 # Include the Maintainer's Makefile section, if it's here.
410 MAINT_MAKEFILE=/dev/null
411 AS_IF([test -r "$srcdir/maintMakefile"],
412 [ MAINT_MAKEFILE="$srcdir/maintMakefile"
414 AC_SUBST_FILE([MAINT_MAKEFILE])
416 # Allow building with dmalloc
417 AM_WITH_DMALLOC
419 # Forcibly disable SET_MAKE.  If it's set it breaks things like the test
420 # scripts, etc.
421 SET_MAKE=
423 # Sanity check and inform the user of what we found
425 AS_IF([test "x$make_badcust" = xyes], [
426 echo
427 echo "WARNING: --with-customs specified but no customs.h could be found;"
428 echo "         disabling Customs support."
429 echo
432 AS_CASE([$with_customs],
433 [""|n|no|y|ye|yes], [:],
434 [AS_IF([test -f "$with_customs/lib/libcustoms.a"], [:],
435 [ echo
436   echo "WARNING: '$with_customs/lib' does not appear to contain the"
437   echo "         Customs library.  You must build and install Customs"
438   echo "         before compiling GNU make."
439   echo
440 ])])
442 AS_IF([test "x$has_wait_nohang" = xno],
443 [ echo
444   echo "WARNING: Your system has neither waitpid() nor wait3()."
445   echo "         Without one of these, signal handling is unreliable."
446   echo "         You should be aware that running GNU make with -j"
447   echo "         could result in erratic behavior."
448   echo
451 AS_IF([test "x$make_cv_job_server" = xno && test "x$user_job_server" = xyes],
452 [ echo
453   echo "WARNING: Make job server requires a POSIX-ish system that"
454   echo "         supports the pipe(), sigaction(), and either"
455   echo "         waitpid() or wait3() functions.  Your system doesn't"
456   echo "         appear to provide one or more of those."
457   echo "         Disabling job server support."
458   echo
461 # Specify what files are to be created.
462 AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
463                  doc/Makefile w32/Makefile])
465 # OK, do it!
467 AC_OUTPUT
469 # We only generate the build.sh if we have a build.sh.in; we won't have
470 # one before we've created a distribution.
471 AS_IF([test -f "$srcdir/build.sh.in"],
472 [ ./config.status --file build.sh
473   chmod +x build.sh
476 dnl Local Variables:
477 dnl comment-start: "dnl "
478 dnl comment-end: ""
479 dnl comment-start-skip: "\\bdnl\\b\\s *"
480 dnl compile-command: "make configure config.h.in"
481 dnl End: