This is a major update, which switches virtually every allocated-but-not-freed
[make.git] / configure.in
blobb6faa37bf83bbcf0c8d79d7bbfdbdaac29df1303
1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
5 # This file is part of GNU Make.
7 # GNU Make is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2, or (at your option) any later 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 FOR
13 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along with
16 # GNU Make; see the file COPYING.  If not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 AC_INIT([GNU make],[3.81.90],[bug-make@gnu.org])
21 AC_PREREQ(2.59)
22 AC_REVISION([[$Id: configure.in,v 1.145 2006/10/01 05:38:38 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 if test "$ac_cv_prog_cc_stdc" != no; then
70   AC_DEFINE(HAVE_ANSI_COMPILER, 1,
71               [Define 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>.])])
92 # Find out whether our struct stat returns nanosecond resolution timestamps.
94 AC_STRUCT_ST_MTIM_NSEC
95 AC_MSG_CHECKING([whether to use high resolution file timestamps])
96 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
97   make_cv_file_timestamp_hi_res=no
98   if test "$ac_cv_struct_st_mtim_nsec" != no; then
99     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
100 #       if HAVE_INTTYPES_H
101 #        include <inttypes.h>
102 #       endif]],
103                       [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
104       [make_cv_file_timestamp_hi_res=yes],
105       [])
106   fi])
107 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
108 if test "$make_cv_file_timestamp_hi_res" = yes; then
109   val=1
110 else
111   val=0
113 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
114                    [Use high resolution file timestamps if nonzero.])
116 if test "$make_cv_file_timestamp_hi_res" = yes; then
117   # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
118   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
119   AC_SEARCH_LIBS(clock_gettime, [rt posix4])
120   if test "$ac_cv_search_clock_gettime" != no; then
121     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
122               [Define if you have the clock_gettime function.])
123   fi
126 # Check for DOS-style pathnames.
127 pds_AC_DOS_PATHS
129 # See if we have a standard version of gettimeofday().  Since actual
130 # implementations can differ, just make sure we have the most common
131 # one.
132 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
133   [ac_cv_func_gettimeofday=no
134    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
135                   int main ()
136                   {
137                     struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
138                     exit (gettimeofday (&t, 0) != 0
139                           || t.tv_sec < 0 || t.tv_usec < 0);
140                   }]])],
141                   [ac_cv_func_gettimeofday=yes],
142                   [ac_cv_func_gettimeofday=no],
143                   [ac_cv_func_gettimeofday="no (cross-compiling)"])])
144 if test "$ac_cv_func_gettimeofday" = yes; then
145   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
146             [Define if you have a standard gettimeofday function])
149 AC_CHECK_FUNCS( strdup mkstemp mktemp fdopen \
150                 bsd_signal dup2 getcwd realpath sigsetmask sigaction \
151                 getgroups seteuid setegid setlinebuf setreuid setregid \
152                 getrlimit setrlimit setvbuf pipe strerror strsignal \
153                 lstat readlink atexit)
155 AC_FUNC_SETVBUF_REVERSED
157 # strcoll() is used by the GNU glob library
158 AC_FUNC_STRCOLL
160 AC_FUNC_ALLOCA
161 AC_FUNC_FORK([])
162 AC_FUNC_VPRINTF
163 AC_FUNC_CLOSEDIR_VOID
165 AC_FUNC_GETLOADAVG
167 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
168 # doesn't.  So, we will.
170 if test "$ac_cv_header_nlist_h" = yes; then
171   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
172         [[struct nlist nl;
173           nl.n_name = "string";
174           return 0;]])],
175         [make_cv_nlist_struct=yes],
176         [make_cv_nlist_struct=no])
177   if test "$make_cv_nlist_struct" = yes; then
178     AC_DEFINE(NLIST_STRUCT, 1,
179        [Define if struct nlist.n_name is a pointer rather than an array.])
180   fi
183 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
184   [AC_INCLUDES_DEFAULT
185 #include <signal.h>
186 /* NetBSD declares sys_siglist in unistd.h.  */
187 #if HAVE_UNISTD_H
188 # include <unistd.h>
189 #endif
193 # Check out the wait reality.
194 AC_CHECK_HEADERS(sys/wait.h,,,[[#include <sys/types.h>]])
195 AC_CHECK_FUNCS(waitpid wait3)
196 AC_MSG_CHECKING(for union wait)
197 AC_CACHE_VAL(make_cv_union_wait, [dnl
198     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
199 #include <sys/wait.h>]],
200      [[union wait status; int pid; pid = wait (&status);
201 #ifdef WEXITSTATUS
202 /* Some POSIXoid systems have both the new-style macros and the old
203    union wait type, and they do not work together.  If union wait
204    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
205         if (WEXITSTATUS (status) != 0) pid = -1;
206 #ifdef WTERMSIG
207         /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
208         -- blow chunks here --
209 #endif
210 #endif
211 #ifdef HAVE_WAITPID
212         /* Make sure union wait works with waitpid.  */
213         pid = waitpid (-1, &status, 0);
214 #endif
215       ]])],
216     [make_cv_union_wait=yes],
217     [make_cv_union_wait=no])])
218 if test "$make_cv_union_wait" = yes; then
219   AC_DEFINE(HAVE_UNION_WAIT, 1,
220             [Define this if you have the \`union wait' type in <sys/wait.h>.])
222 AC_MSG_RESULT($make_cv_union_wait)
225 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
226 if test "$PATH_SEPARATOR" = ';'; then
227   AC_DEFINE(HAVE_DOS_PATHS, 1,
228             [Define this if your system requires backslashes or drive specs in pathnames.])
232 # See if the user wants to use pmake's "customs" distributed build capability
234 AC_SUBST(REMOTE) REMOTE=stub
235 use_customs=false
236 AC_ARG_WITH(customs,
237   AC_HELP_STRING([--with-customs=DIR],
238                  [enable remote jobs via Customs--see README.customs]),
239   [case $withval in
240     n|no) : ;;
241     *) make_cppflags="$CPPFLAGS"
242        case $withval in
243          y|ye|yes) : ;;
244          *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
245             make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
246        esac
247        CF_NETLIBS
248        AC_CHECK_HEADER(customs.h,
249                        [use_customs=true
250                          REMOTE=cstms
251                          LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
252                        [with_customs=no
253                          CPPFLAGS="$make_cppflags" make_badcust=yes])
254        ;;
255   esac])
256 # Tell automake about this, so it can include the right .c files.
257 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
259 # See if the user asked to handle case insensitive file systems.
261 AH_TEMPLATE(HAVE_CASE_INSENSITIVE_FS, [Use case insensitive file names])
262 AC_ARG_ENABLE(case-insensitive-file-system,
263   AC_HELP_STRING([--enable-case-insensitive-file-system],
264                  [enable case insensitive file system support]),
265   case_insensitive_fs="yes" AC_DEFINE(HAVE_CASE_INSENSITIVE_FS),
266   case_insensitive_fs="no")
268 # See if we can handle the job server feature, and if the user wants it.
270 AC_ARG_ENABLE(job-server,
271   AC_HELP_STRING([--disable-job-server],
272                  [disallow recursive make communication during -jN]),
273   [make_cv_job_server="$enableval" user_job_server="$enableval"],
274   [make_cv_job_server="yes"])
276 has_wait_nohang=yes
277 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
278   no/no) has_wait_nohang=no ;;
279 esac
281 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
282   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
283       [[return SA_RESTART;]])],
284     [make_cv_sa_restart=yes],
285     [make_cv_sa_restart=no])])
287 if test "$make_cv_sa_restart" != no; then
288   AC_DEFINE(HAVE_SA_RESTART, 1,
289      [Define if <signal.h> defines the SA_RESTART constant.])
292 # enable make_cv_sa_restart for OS/2 so that the jobserver will be enabled,
293 # but do it after HAVE_SA_RESTART has been defined.
294 case "$host_os" in
295   os2*) make_cv_sa_restart=yes ;;
296 esac
298 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
299   yes/yes/yes/yes/yes)
300     AC_DEFINE(MAKE_JOBSERVER, 1,
301               [Define this to enable job server support in GNU make.]);;
302 esac
304 # if we have both lstat() and readlink() then we can support symlink
305 # timechecks.
306 case "$ac_cv_func_lstat/$ac_cv_func_readlink" in
307   yes/yes)
308     AC_DEFINE(MAKE_SYMLINKS, 1,
309               [Define this to enable symbolic link timestamp checking.]);;
310 esac
312 # Find the SCCS commands, so we can include them in our default rules.
314 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
315 if test -f /usr/sccs/get; then
316   make_cv_path_sccs_get=/usr/sccs/get
317 else
318   make_cv_path_sccs_get=get
319 fi])
320 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"],
321                    [Define to the name of the SCCS 'get' command.])
323 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
324 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
325    test -f s.conftest; then
326   # We successfully created an SCCS file.
327   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
328     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
329        test -f conftoast; then
330        make_cv_sys_get_minus_G=yes
331     else
332        make_cv_sys_get_minus_G=no
333     fi])
334   case "$make_cv_sys_get_minus_G" in
335     yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
336            [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
337   esac
339 rm -f s.conftest conftoast
341 # Check the system to see if it provides GNU glob.  If not, use our
342 # local version.
344 AC_MSG_CHECKING(if system libc has GNU glob)
345 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
346  AC_EGREP_CPP(gnu glob,[
347 #include <features.h>
348 #include <glob.h>
349 #include <fnmatch.h>
351 #define GLOB_INTERFACE_VERSION 1
352 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
353 # include <gnu-versions.h>
354 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
355    gnu glob
356 # endif
357 #endif
358  ], [AC_MSG_RESULT(yes)
359 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
360 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
361 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
362 make_cv_sys_gnu_glob=no])])
363 # Tell automake about this, so it can build the right .c files.
364 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
366 # Let the makefile know what our build host is
368 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
369 MAKE_HOST="$host"
370 AC_SUBST(MAKE_HOST)
372 w32_target_env=no
373 AM_CONDITIONAL([WINDOWSENV], false)
375 case "$host" in
376   *-*-mingw32)
377     AM_CONDITIONAL(WINDOWSENV, true)
378     w32_target_env=yes
379     AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
380     AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
381     ;;
382 esac
384 AC_DEFINE_UNQUOTED(PATH_SEPARATOR_CHAR,'$PATH_SEPARATOR',[Define to the character that separates directories in PATH.])
386 # Include the Maintainer's Makefile section, if it's here.
388 MAINT_MAKEFILE=/dev/null
389 if test -r "$srcdir/maintMakefile"; then
390   MAINT_MAKEFILE="$srcdir/maintMakefile"
392 AC_SUBST_FILE(MAINT_MAKEFILE)
394 # Allow building with dmalloc
395 AM_WITH_DMALLOC
397 # Forcibly disable SET_MAKE.  If it's set it breaks things like the test
398 # scripts, etc.
399 SET_MAKE=
401 # Sanity check and inform the user of what we found
403 case "$make_badcust" in
404   yes) echo
405        echo "WARNING: --with-customs specified but no customs.h could be found;"
406        echo "         disabling Customs support."
407        echo ;;
408 esac
410 case "$with_customs" in
411   ""|n|no|y|ye|yes) ;;
412   *) if test -f "$with_customs/lib/libcustoms.a"; then
413        :
414      else
415        echo
416        echo "WARNING: '$with_customs/lib' does not appear to contain the"
417        echo "         Customs library.  You must build and install Customs"
418        echo "         before compiling GNU make."
419        echo
420      fi ;;
421 esac
423 case "$has_wait_nohang" in
424   no) echo
425       echo "WARNING: Your system has neither waitpid() nor wait3()."
426       echo "         Without one of these, signal handling is unreliable."
427       echo "         You should be aware that running GNU make with -j"
428       echo "         could result in erratic behavior."
429       echo ;;
430 esac
432 case "$make_cv_job_server/$user_job_server" in
433   no/yes) echo
434           echo "WARNING: Make job server requires a POSIX-ish system that"
435           echo "         supports the pipe(), sigaction(), and either"
436           echo "         waitpid() or wait3() functions.  Your system doesn't"
437           echo "         appear to provide one or more of those."
438           echo "         Disabling job server support."
439           echo ;;
440 esac
443 # Specify what files are to be created.
444 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile w32/Makefile)
446 # OK, do it!
448 AC_OUTPUT
450 # We only generate the build.sh if we have a build.sh.in; we won't have
451 # one before we've created a distribution.
452 if test -f "$srcdir/build.sh.in"; then
453   ./config.status --file build.sh
454   chmod +x build.sh
457 dnl Local Variables:
458 dnl comment-start: "dnl "
459 dnl comment-end: ""
460 dnl comment-start-skip: "\\bdnl\\b\\s *"
461 dnl compile-command: "make configure config.h.in"
462 dnl End: