Fix bug #2846.
[make.git] / configure.in
blobe1131f03f570ee21ab031da6a6d05e375dfe55f9
1 # Process this file with autoconf to produce a configure script.
3 AC_INIT([GNU make],[3.81a1],[bug-make@gnu.org])
5 AC_PREREQ(2.56)
7 AC_REVISION([[$Id: configure.in,v 1.117 2003/03/25 00:15:25 psmith Exp $]])
9 # Autoconf setup
10 AC_CONFIG_AUX_DIR(config)
11 AC_CONFIG_SRCDIR(vpath.c)
12 AC_CONFIG_HEADERS(config.h)
14 # Automake setup
15 AM_INIT_AUTOMAKE
16 AC_PROG_MAKE_SET
18 # Checks for programs.
19 AC_PROG_CC
20 AC_PROG_INSTALL
21 AC_PROG_RANLIB
22 AC_PROG_CPP
23 AC_CHECK_PROG(AR, ar, ar, ar)
24 # Perl is needed for the test suite (only)
25 AC_CHECK_PROG(PERL, perl, perl, perl)
27 # Specialized system macros
28 AC_CANONICAL_HOST
29 AC_AIX
30 AC_ISC_POSIX
31 AC_MINIX
33 # Needed for ansi2knr
34 AM_C_PROTOTYPES
36 # Enable gettext, in "external" mode.
38 AM_GNU_GETTEXT_VERSION(0.11.5)
39 AM_GNU_GETTEXT([external])
41 # This test must come as early as possible after the compiler configuration
42 # tests, because the choice of the file model can (in principle) affect
43 # whether functions and headers are available, whether they work, etc.
44 AC_SYS_LARGEFILE
46 # Checks for libraries.
47 AC_SEARCH_LIBS(getpwnam, [sun])
49 # Checks for header files.
50 AC_HEADER_STDC
51 AC_HEADER_DIRENT
52 AC_HEADER_STAT
53 AC_HEADER_TIME
54 AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
55                  memory.h sys/param.h sys/time.h sys/timeb.h)
57 AM_PROG_CC_C_O
58 AM_PROG_CC_STDC
59 AC_C_CONST
60 AC_TYPE_SIGNAL
61 AC_TYPE_UID_T
62 AC_TYPE_PID_T
64 # Find some definition for uintmax_t
66 AC_CHECK_TYPE(uintmax_t,,[
67   uintmax_t="unsigned long"
68   AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
69   AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,
70     [Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
72 # Find out whether our struct stat returns nanosecond resolution timestamps.
74 AC_STRUCT_ST_MTIM_NSEC
75 AC_MSG_CHECKING([whether to use high resolution file timestamps])
76 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
77   make_cv_file_timestamp_hi_res=no
78   if test "$ac_cv_struct_st_mtim_nsec" != no; then
79     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
80 #       if HAVE_INTTYPES_H
81 #        include <inttypes.h>
82 #       endif]],
83                       [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
84       [make_cv_file_timestamp_hi_res=yes],
85       [])
86   fi])
87 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
88 if test "$make_cv_file_timestamp_hi_res" = yes; then
89   val=1
90 else
91   val=0
93 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
94                    [Use high resolution file timestamps if nonzero.])
96 if test "$make_cv_file_timestamp_hi_res" = yes; then
97   # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
98   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
99   AC_SEARCH_LIBS(clock_gettime, [rt posix4])
100   if test "$ac_cv_search_clock_gettime" != no; then
101     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
102               [Define if you have the clock_gettime function.])
103   fi
107 # See if we have a standard version of gettimeofday().  Since actual
108 # implementations can differ, just make sure we have the most common
109 # one.
110 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
111   [ac_cv_func_gettimeofday=no
112    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
113                   int main ()
114                   {
115                     struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
116                     exit (gettimeofday (&t, 0) != 0
117                           || t.tv_sec < 0 || t.tv_usec < 0);
118                   }]])],
119                   [ac_cv_func_gettimeofday=yes],
120                   [ac_cv_func_gettimeofday=no],
121                   [ac_cv_func_gettimeofday="no (cross-compiling)"])])
122 if test "$ac_cv_func_gettimeofday" = yes; then
123   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
124             [Define if you have a standard gettimeofday function])
127 AC_CHECK_FUNCS( memcpy memmove strchr strdup mkstemp mktemp fdopen \
128                 bsd_signal dup2 getcwd sigsetmask sigaction getgroups \
129                 seteuid setegid setlinebuf setreuid setregid setvbuf pipe \
130                 strerror strsignal)
132 make_FUNC_SETVBUF_REVERSED
134 # strcoll() is used by the GNU glob library
135 AC_FUNC_STRCOLL
137 AC_FUNC_ALLOCA
138 AC_FUNC_FORK([])
139 AC_FUNC_VPRINTF
140 AC_FUNC_CLOSEDIR_VOID
142 AC_FUNC_GETLOADAVG
144 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
145 # doesn't.  So, we will.
147 if test "$ac_cv_header_nlist_h" = yes; then
148   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
149         [[struct nlist nl;
150           nl.n_name = "string";
151           return 0;]])],
152         [make_cv_nlist_struct=yes],
153         [make_cv_nlist_struct=no])
154   if test "$make_cv_nlist_struct" = yes; then
155     AC_DEFINE(NLIST_STRUCT, 1,
156        [Define if struct nlist.n_name is a pointer rather than an array.])
157   fi
160 AC_CHECK_DECLS([sys_siglist])
163 # Check out the wait reality.
164 AC_CHECK_HEADERS(sys/wait.h)
165 AC_CHECK_FUNCS(waitpid wait3)
166 AC_MSG_CHECKING(for union wait)
167 AC_CACHE_VAL(make_cv_union_wait, [dnl
168     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
169 #include <sys/wait.h>]],
170      [[union wait status; int pid; pid = wait (&status);
171 #ifdef WEXITSTATUS
172 /* Some POSIXoid systems have both the new-style macros and the old
173    union wait type, and they do not work together.  If union wait
174    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
175         if (WEXITSTATUS (status) != 0) pid = -1;
176 #ifdef WTERMSIG
177         /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
178         -- blow chunks here --
179 #endif
180 #endif
181 #ifdef HAVE_WAITPID
182         /* Make sure union wait works with waitpid.  */
183         pid = waitpid (-1, &status, 0);
184 #endif
185       ]])],
186     [make_cv_union_wait=yes],
187     [make_cv_union_wait=no])])
188 if test "$make_cv_union_wait" = yes; then
189   AC_DEFINE(HAVE_UNION_WAIT, 1,
190             [Define this if you have the \`union wait' type in <sys/wait.h>.])
192 AC_MSG_RESULT($make_cv_union_wait)
195 # See if the user wants to use pmake's "customs" distributed build capability
197 AC_SUBST(REMOTE) REMOTE=stub
198 use_customs=false
199 AC_ARG_WITH(customs,
200   AC_HELP_STRING([--with-customs=DIR],
201                  [enable remote jobs via Customs--see README.customs]),
202   [case $withval in
203     n|no) : ;;
204     *) make_cppflags="$CPPFLAGS"
205        case $withval in
206          y|ye|yes) : ;;
207          *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
208             make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
209        esac
210        CF_NETLIBS
211        AC_CHECK_HEADER(customs.h,
212                        [use_customs=true
213                          REMOTE=cstms
214                          LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
215                        [with_customs=no
216                          CPPFLAGS="$make_cppflags" make_badcust=yes])
217        ;;
218   esac])
219 # Tell automake about this, so it can include the right .c files.
220 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
222 # See if we can handle the job server feature, and if the user wants it.
224 AC_ARG_ENABLE(job-server,
225   AC_HELP_STRING([--disable-job-server],
226                  [disallow recursive make communication during -jN]),
227   [make_cv_job_server="$enableval" user_job_server="$enableval"],
228   [make_cv_job_server="yes"])
230 has_wait_nohang=yes
231 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
232   no/no) has_wait_nohang=no ;;
233 esac
235 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
236   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
237       [[return SA_RESTART;]])],
238     [make_cv_sa_restart=yes],
239     [make_cv_sa_restart=no])])
240 if test "$make_cv_sa_restart" != no; then
241   AC_DEFINE(HAVE_SA_RESTART, 1,
242      [Define if <signal.h> defines the SA_RESTART constant.])
245 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
246   yes/yes/yes/yes/yes)
247     AC_DEFINE(MAKE_JOBSERVER, 1,
248               [Define this to enable job server support in GNU make.]);;
249 esac
251 # Find the SCCS commands, so we can include them in our default rules.
253 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
254 if test -f /usr/sccs/get; then
255   make_cv_path_sccs_get=/usr/sccs/get
256 else
257   make_cv_path_sccs_get=get
258 fi])
259 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"],
260                    [Define to the name of the SCCS 'get' command.])
262 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
263 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
264    test -f s.conftest; then
265   # We successfully created an SCCS file.
266   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
267     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
268        test -f conftoast; then
269        make_cv_sys_get_minus_G=yes
270     else
271        make_cv_sys_get_minus_G=no
272     fi])
273   case "$make_cv_sys_get_minus_G" in
274     yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
275            [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
276   esac
278 rm -f s.conftest conftoast
280 # Check the system to see if it provides GNU glob.  If not, use our
281 # local version.
283 AC_MSG_CHECKING(if system libc has GNU glob)
284 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
285  AC_EGREP_CPP(gnu glob,[
286 #include <features.h>
287 #include <glob.h>
288 #include <fnmatch.h>
290 #define GLOB_INTERFACE_VERSION 1
291 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
292 # include <gnu-versions.h>
293 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
294    gnu glob
295 # endif
296 #endif
297  ], [AC_MSG_RESULT(yes)
298 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
299 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
300 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
301 make_cv_sys_gnu_glob=no])])
302 # Tell automake about this, so it can build the right .c files.
303 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
305 # Let the makefile know what our build host is
307 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
308 MAKE_HOST="$host"
309 AC_SUBST(MAKE_HOST)
311 # Include the Maintainer's Makefile section, if it's here.
313 MAINT_MAKEFILE=/dev/null
314 if test -r "$srcdir/maintMakefile"; then
315   MAINT_MAKEFILE="$srcdir/maintMakefile"
317 AC_SUBST_FILE(MAINT_MAKEFILE)
319 # Allow building with dmalloc
320 AM_WITH_DMALLOC
323 # Sanity check and inform the user of what we found
325 case "$make_badcust" in
326   yes) echo
327        echo "WARNING: --with-customs specified but no customs.h could be found;"
328        echo "         disabling Customs support."
329        echo ;;
330 esac
332 case "$with_customs" in
333   ""|n|no|y|ye|yes) ;;
334   *) if test -f "$with_customs/lib/libcustoms.a"; then
335        :
336      else
337        echo
338        echo "WARNING: '$with_customs/lib' does not appear to contain the"
339        echo "         Customs library.  You must build and install Customs"
340        echo "         before compiling GNU make."
341        echo
342      fi ;;
343 esac
345 case "$has_wait_nohang" in
346   no) echo
347       echo "WARNING: Your system has neither waitpid() nor wait3()."
348       echo "         Without one of these, signal handling is unreliable."
349       echo "         You should be aware that running GNU make with -j"
350       echo "         could result in erratic behavior."
351       echo ;;
352 esac
354 case "$make_cv_job_server/$user_job_server" in
355   no/yes) echo
356           echo "WARNING: Make job server requires a POSIX-ish system that"
357           echo "         supports the pipe(), sigaction(), and either"
358           echo "         waitpid() or wait3() functions.  Your system doesn't"
359           echo "         appear to provide one or more of those."
360           echo "         Disabling job server support."
361           echo ;;
362 esac
365 # Specify what files are to be created.
366 # We only generate the build.sh if we have a build.sh.in; we won't have
367 # one before we've created a distribution.
369 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
371 if test -f $srcdir/build.sh.in; then
372   AC_CONFIG_FILES(build.sh)
376 # OK, do it!
378 AC_OUTPUT
381 dnl Local Variables:
382 dnl comment-start: "dnl "
383 dnl comment-end: ""
384 dnl comment-start-skip: "\\bdnl\\b\\s *"
385 dnl compile-command: "make configure config.h.in"
386 dnl End: