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