Release GNU make 3.81.
[make.git] / configure.in
bloba3a60a64534674dd86f51bbd43197ff9ff9a047b
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],[bug-make@gnu.org])
21 AC_PREREQ(2.59)
22 AC_REVISION([[$Id: configure.in,v 1.142 2006/04/01 06:36:40 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 # Needed for ansi2knr
48 AM_C_PROTOTYPES
50 # Enable gettext, in "external" mode.
52 AM_GNU_GETTEXT_VERSION(0.14.1)
53 AM_GNU_GETTEXT([external])
55 # This test must come as early as possible after the compiler configuration
56 # tests, because the choice of the file model can (in principle) affect
57 # whether functions and headers are available, whether they work, etc.
58 AC_SYS_LARGEFILE
60 # Checks for libraries.
61 AC_SEARCH_LIBS(getpwnam, [sun])
63 # Checks for header files.
64 AC_HEADER_STDC
65 AC_HEADER_DIRENT
66 AC_HEADER_STAT
67 AC_HEADER_TIME
68 AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
69                  memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h)
71 # Set a flag if we have an ANSI C compiler
72 if test "$ac_cv_prog_cc_stdc" != no; then
73   AC_DEFINE(HAVE_ANSI_COMPILER, 1,
74               [Define if your compiler conforms to the ANSI C standard.])
78 # Determine what kind of variadic function calls we support
79 AC_CHECK_HEADERS(stdarg.h varargs.h, break)
81 AM_PROG_CC_C_O
82 AC_C_CONST
83 AC_TYPE_SIGNAL
84 AC_TYPE_UID_T
85 AC_TYPE_PID_T
87 # Find some definition for uintmax_t
89 AC_CHECK_TYPE(uintmax_t,,[
90   uintmax_t="unsigned long"
91   AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
92   AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,
93     [Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
95 # Find out whether our struct stat returns nanosecond resolution timestamps.
97 AC_STRUCT_ST_MTIM_NSEC
98 AC_MSG_CHECKING([whether to use high resolution file timestamps])
99 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
100   make_cv_file_timestamp_hi_res=no
101   if test "$ac_cv_struct_st_mtim_nsec" != no; then
102     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
103 #       if HAVE_INTTYPES_H
104 #        include <inttypes.h>
105 #       endif]],
106                       [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
107       [make_cv_file_timestamp_hi_res=yes],
108       [])
109   fi])
110 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
111 if test "$make_cv_file_timestamp_hi_res" = yes; then
112   val=1
113 else
114   val=0
116 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
117                    [Use high resolution file timestamps if nonzero.])
119 if test "$make_cv_file_timestamp_hi_res" = yes; then
120   # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
121   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
122   AC_SEARCH_LIBS(clock_gettime, [rt posix4])
123   if test "$ac_cv_search_clock_gettime" != no; then
124     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
125               [Define if you have the clock_gettime function.])
126   fi
129 # Check for DOS-style pathnames.
130 pds_AC_DOS_PATHS
132 # See if we have a standard version of gettimeofday().  Since actual
133 # implementations can differ, just make sure we have the most common
134 # one.
135 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
136   [ac_cv_func_gettimeofday=no
137    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
138                   int main ()
139                   {
140                     struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
141                     exit (gettimeofday (&t, 0) != 0
142                           || t.tv_sec < 0 || t.tv_usec < 0);
143                   }]])],
144                   [ac_cv_func_gettimeofday=yes],
145                   [ac_cv_func_gettimeofday=no],
146                   [ac_cv_func_gettimeofday="no (cross-compiling)"])])
147 if test "$ac_cv_func_gettimeofday" = yes; then
148   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
149             [Define if you have a standard gettimeofday function])
152 AC_CHECK_FUNCS( memcpy memmove strchr strdup mkstemp mktemp fdopen \
153                 bsd_signal dup2 getcwd realpath sigsetmask sigaction \
154                 getgroups seteuid setegid setlinebuf setreuid setregid \
155                 getrlimit setrlimit setvbuf pipe strerror strsignal \
156                 lstat readlink atexit)
158 AC_FUNC_SETVBUF_REVERSED
160 # strcoll() is used by the GNU glob library
161 AC_FUNC_STRCOLL
163 AC_FUNC_ALLOCA
164 AC_FUNC_FORK([])
165 AC_FUNC_VPRINTF
166 AC_FUNC_CLOSEDIR_VOID
168 AC_FUNC_GETLOADAVG
170 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
171 # doesn't.  So, we will.
173 if test "$ac_cv_header_nlist_h" = yes; then
174   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
175         [[struct nlist nl;
176           nl.n_name = "string";
177           return 0;]])],
178         [make_cv_nlist_struct=yes],
179         [make_cv_nlist_struct=no])
180   if test "$make_cv_nlist_struct" = yes; then
181     AC_DEFINE(NLIST_STRUCT, 1,
182        [Define if struct nlist.n_name is a pointer rather than an array.])
183   fi
186 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
187   [AC_INCLUDES_DEFAULT
188 #include <signal.h>
189 /* NetBSD declares sys_siglist in unistd.h.  */
190 #if HAVE_UNISTD_H
191 # include <unistd.h>
192 #endif
196 # Check out the wait reality.
197 AC_CHECK_HEADERS(sys/wait.h)
198 AC_CHECK_FUNCS(waitpid wait3)
199 AC_MSG_CHECKING(for union wait)
200 AC_CACHE_VAL(make_cv_union_wait, [dnl
201     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
202 #include <sys/wait.h>]],
203      [[union wait status; int pid; pid = wait (&status);
204 #ifdef WEXITSTATUS
205 /* Some POSIXoid systems have both the new-style macros and the old
206    union wait type, and they do not work together.  If union wait
207    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
208         if (WEXITSTATUS (status) != 0) pid = -1;
209 #ifdef WTERMSIG
210         /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
211         -- blow chunks here --
212 #endif
213 #endif
214 #ifdef HAVE_WAITPID
215         /* Make sure union wait works with waitpid.  */
216         pid = waitpid (-1, &status, 0);
217 #endif
218       ]])],
219     [make_cv_union_wait=yes],
220     [make_cv_union_wait=no])])
221 if test "$make_cv_union_wait" = yes; then
222   AC_DEFINE(HAVE_UNION_WAIT, 1,
223             [Define this if you have the \`union wait' type in <sys/wait.h>.])
225 AC_MSG_RESULT($make_cv_union_wait)
228 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
229 if test "$PATH_SEPARATOR" = ';'; then
230   AC_DEFINE(HAVE_DOS_PATHS, 1,
231             [Define this if your system requires backslashes or drive specs in pathnames.])
235 # See if the user wants to use pmake's "customs" distributed build capability
237 AC_SUBST(REMOTE) REMOTE=stub
238 use_customs=false
239 AC_ARG_WITH(customs,
240   AC_HELP_STRING([--with-customs=DIR],
241                  [enable remote jobs via Customs--see README.customs]),
242   [case $withval in
243     n|no) : ;;
244     *) make_cppflags="$CPPFLAGS"
245        case $withval in
246          y|ye|yes) : ;;
247          *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
248             make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
249        esac
250        CF_NETLIBS
251        AC_CHECK_HEADER(customs.h,
252                        [use_customs=true
253                          REMOTE=cstms
254                          LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
255                        [with_customs=no
256                          CPPFLAGS="$make_cppflags" make_badcust=yes])
257        ;;
258   esac])
259 # Tell automake about this, so it can include the right .c files.
260 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
262 # See if the user asked to handle case insensitive file systems.
264 AH_TEMPLATE(HAVE_CASE_INSENSITIVE_FS, [Use case insensitive file names])
265 AC_ARG_ENABLE(case-insensitive-file-system,
266   AC_HELP_STRING([--enable-case-insensitive-file-system],
267                  [enable case insensitive file system support]),
268   case_insensitive_fs="yes" AC_DEFINE(HAVE_CASE_INSENSITIVE_FS),
269   case_insensitive_fs="no")
271 # See if we can handle the job server feature, and if the user wants it.
273 AC_ARG_ENABLE(job-server,
274   AC_HELP_STRING([--disable-job-server],
275                  [disallow recursive make communication during -jN]),
276   [make_cv_job_server="$enableval" user_job_server="$enableval"],
277   [make_cv_job_server="yes"])
279 has_wait_nohang=yes
280 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
281   no/no) has_wait_nohang=no ;;
282 esac
284 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
285   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
286       [[return SA_RESTART;]])],
287     [make_cv_sa_restart=yes],
288     [make_cv_sa_restart=no])])
290 if test "$make_cv_sa_restart" != no; then
291   AC_DEFINE(HAVE_SA_RESTART, 1,
292      [Define if <signal.h> defines the SA_RESTART constant.])
295 # enable make_cv_sa_restart for OS/2 so that the jobserver will be enabled,
296 # but do it after HAVE_SA_RESTART has been defined.
297 case "$host_os" in
298   os2*) make_cv_sa_restart=yes ;;
299 esac
301 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
302   yes/yes/yes/yes/yes)
303     AC_DEFINE(MAKE_JOBSERVER, 1,
304               [Define this to enable job server support in GNU make.]);;
305 esac
307 # if we have both lstat() and readlink() then we can support symlink
308 # timechecks.
309 case "$ac_cv_func_lstat/$ac_cv_func_readlink" in
310   yes/yes)
311     AC_DEFINE(MAKE_SYMLINKS, 1,
312               [Define this to enable symbolic link timestamp checking.]);;
313 esac
315 # Find the SCCS commands, so we can include them in our default rules.
317 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
318 if test -f /usr/sccs/get; then
319   make_cv_path_sccs_get=/usr/sccs/get
320 else
321   make_cv_path_sccs_get=get
322 fi])
323 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"],
324                    [Define to the name of the SCCS 'get' command.])
326 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
327 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
328    test -f s.conftest; then
329   # We successfully created an SCCS file.
330   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
331     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
332        test -f conftoast; then
333        make_cv_sys_get_minus_G=yes
334     else
335        make_cv_sys_get_minus_G=no
336     fi])
337   case "$make_cv_sys_get_minus_G" in
338     yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
339            [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
340   esac
342 rm -f s.conftest conftoast
344 # Check the system to see if it provides GNU glob.  If not, use our
345 # local version.
347 AC_MSG_CHECKING(if system libc has GNU glob)
348 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
349  AC_EGREP_CPP(gnu glob,[
350 #include <features.h>
351 #include <glob.h>
352 #include <fnmatch.h>
354 #define GLOB_INTERFACE_VERSION 1
355 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
356 # include <gnu-versions.h>
357 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
358    gnu glob
359 # endif
360 #endif
361  ], [AC_MSG_RESULT(yes)
362 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
363 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
364 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
365 make_cv_sys_gnu_glob=no])])
366 # Tell automake about this, so it can build the right .c files.
367 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
369 # Let the makefile know what our build host is
371 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
372 MAKE_HOST="$host"
373 AC_SUBST(MAKE_HOST)
375 w32_target_env=no
376 AM_CONDITIONAL([WINDOWSENV], false)
378 case "$host" in
379   *-*-mingw32)
380     AM_CONDITIONAL(WINDOWSENV, true)
381     w32_target_env=yes
382     AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
383     AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
384     ;;
385 esac
387 # Include the Maintainer's Makefile section, if it's here.
389 MAINT_MAKEFILE=/dev/null
390 if test -r "$srcdir/maintMakefile"; then
391   MAINT_MAKEFILE="$srcdir/maintMakefile"
393 AC_SUBST_FILE(MAINT_MAKEFILE)
395 # Allow building with dmalloc
396 AM_WITH_DMALLOC
398 # Forcibly disable SET_MAKE.  If it's set it breaks things like the test
399 # scripts, etc.
400 SET_MAKE=
402 # Sanity check and inform the user of what we found
404 case "$make_badcust" in
405   yes) echo
406        echo "WARNING: --with-customs specified but no customs.h could be found;"
407        echo "         disabling Customs support."
408        echo ;;
409 esac
411 case "$with_customs" in
412   ""|n|no|y|ye|yes) ;;
413   *) if test -f "$with_customs/lib/libcustoms.a"; then
414        :
415      else
416        echo
417        echo "WARNING: '$with_customs/lib' does not appear to contain the"
418        echo "         Customs library.  You must build and install Customs"
419        echo "         before compiling GNU make."
420        echo
421      fi ;;
422 esac
424 case "$has_wait_nohang" in
425   no) echo
426       echo "WARNING: Your system has neither waitpid() nor wait3()."
427       echo "         Without one of these, signal handling is unreliable."
428       echo "         You should be aware that running GNU make with -j"
429       echo "         could result in erratic behavior."
430       echo ;;
431 esac
433 case "$make_cv_job_server/$user_job_server" in
434   no/yes) echo
435           echo "WARNING: Make job server requires a POSIX-ish system that"
436           echo "         supports the pipe(), sigaction(), and either"
437           echo "         waitpid() or wait3() functions.  Your system doesn't"
438           echo "         appear to provide one or more of those."
439           echo "         Disabling job server support."
440           echo ;;
441 esac
444 # Specify what files are to be created.
445 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile w32/Makefile)
447 # OK, do it!
449 AC_OUTPUT
451 # We only generate the build.sh if we have a build.sh.in; we won't have
452 # one before we've created a distribution.
453 if test -f "$srcdir/build.sh.in"; then
454   ./config.status --file build.sh
455   chmod +x build.sh
458 dnl Local Variables:
459 dnl comment-start: "dnl "
460 dnl comment-end: ""
461 dnl comment-start-skip: "\\bdnl\\b\\s *"
462 dnl compile-command: "make configure config.h.in"
463 dnl End: