- Fix bug #1405: allow multiple pattern-specific variables to match a target.
[make.git] / configure.in
blob9d8d07b8742650ccebbe9835ee234d6c8775fc8b
1 # Process this file with autoconf to produce a configure script.
3 AC_INIT([GNU make],[3.81a2],[bug-make@gnu.org])
5 AC_PREREQ(2.57)
7 AC_REVISION([[$Id: configure.in,v 1.119 2003/05/02 01:44:59 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
106 # Check for DOS-style pathnames.
107 pds_AC_DOS_PATHS
109 # See if we have a standard version of gettimeofday().  Since actual
110 # implementations can differ, just make sure we have the most common
111 # one.
112 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
113   [ac_cv_func_gettimeofday=no
114    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
115                   int main ()
116                   {
117                     struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
118                     exit (gettimeofday (&t, 0) != 0
119                           || t.tv_sec < 0 || t.tv_usec < 0);
120                   }]])],
121                   [ac_cv_func_gettimeofday=yes],
122                   [ac_cv_func_gettimeofday=no],
123                   [ac_cv_func_gettimeofday="no (cross-compiling)"])])
124 if test "$ac_cv_func_gettimeofday" = yes; then
125   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
126             [Define if you have a standard gettimeofday function])
129 AC_CHECK_FUNCS( memcpy memmove strchr strdup mkstemp mktemp fdopen \
130                 bsd_signal dup2 getcwd sigsetmask sigaction getgroups \
131                 seteuid setegid setlinebuf setreuid setregid setvbuf pipe \
132                 strerror strsignal)
134 make_FUNC_SETVBUF_REVERSED
136 # strcoll() is used by the GNU glob library
137 AC_FUNC_STRCOLL
139 AC_FUNC_ALLOCA
140 AC_FUNC_FORK([])
141 AC_FUNC_VPRINTF
142 AC_FUNC_CLOSEDIR_VOID
144 AC_FUNC_GETLOADAVG
146 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
147 # doesn't.  So, we will.
149 if test "$ac_cv_header_nlist_h" = yes; then
150   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
151         [[struct nlist nl;
152           nl.n_name = "string";
153           return 0;]])],
154         [make_cv_nlist_struct=yes],
155         [make_cv_nlist_struct=no])
156   if test "$make_cv_nlist_struct" = yes; then
157     AC_DEFINE(NLIST_STRUCT, 1,
158        [Define if struct nlist.n_name is a pointer rather than an array.])
159   fi
162 AC_CHECK_DECLS([sys_siglist])
165 # Check out the wait reality.
166 AC_CHECK_HEADERS(sys/wait.h)
167 AC_CHECK_FUNCS(waitpid wait3)
168 AC_MSG_CHECKING(for union wait)
169 AC_CACHE_VAL(make_cv_union_wait, [dnl
170     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
171 #include <sys/wait.h>]],
172      [[union wait status; int pid; pid = wait (&status);
173 #ifdef WEXITSTATUS
174 /* Some POSIXoid systems have both the new-style macros and the old
175    union wait type, and they do not work together.  If union wait
176    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
177         if (WEXITSTATUS (status) != 0) pid = -1;
178 #ifdef WTERMSIG
179         /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
180         -- blow chunks here --
181 #endif
182 #endif
183 #ifdef HAVE_WAITPID
184         /* Make sure union wait works with waitpid.  */
185         pid = waitpid (-1, &status, 0);
186 #endif
187       ]])],
188     [make_cv_union_wait=yes],
189     [make_cv_union_wait=no])])
190 if test "$make_cv_union_wait" = yes; then
191   AC_DEFINE(HAVE_UNION_WAIT, 1,
192             [Define this if you have the \`union wait' type in <sys/wait.h>.])
194 AC_MSG_RESULT($make_cv_union_wait)
197 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
198 if test "$PATH_SEPARATOR" = ';'; then
199   AC_DEFINE(HAVE_DOS_PATHS, 1,
200             [Define this if your system requires backslashes or drive specs in pathnames.])
204 # See if the user wants to use pmake's "customs" distributed build capability
206 AC_SUBST(REMOTE) REMOTE=stub
207 use_customs=false
208 AC_ARG_WITH(customs,
209   AC_HELP_STRING([--with-customs=DIR],
210                  [enable remote jobs via Customs--see README.customs]),
211   [case $withval in
212     n|no) : ;;
213     *) make_cppflags="$CPPFLAGS"
214        case $withval in
215          y|ye|yes) : ;;
216          *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
217             make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
218        esac
219        CF_NETLIBS
220        AC_CHECK_HEADER(customs.h,
221                        [use_customs=true
222                          REMOTE=cstms
223                          LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
224                        [with_customs=no
225                          CPPFLAGS="$make_cppflags" make_badcust=yes])
226        ;;
227   esac])
228 # Tell automake about this, so it can include the right .c files.
229 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
231 # See if we can handle the job server feature, and if the user wants it.
233 AC_ARG_ENABLE(job-server,
234   AC_HELP_STRING([--disable-job-server],
235                  [disallow recursive make communication during -jN]),
236   [make_cv_job_server="$enableval" user_job_server="$enableval"],
237   [make_cv_job_server="yes"])
239 has_wait_nohang=yes
240 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
241   no/no) has_wait_nohang=no ;;
242 esac
244 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
245   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
246       [[return SA_RESTART;]])],
247     [make_cv_sa_restart=yes],
248     [make_cv_sa_restart=no])])
249 if test "$make_cv_sa_restart" != no; then
250   AC_DEFINE(HAVE_SA_RESTART, 1,
251      [Define if <signal.h> defines the SA_RESTART constant.])
254 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
255   yes/yes/yes/yes/yes)
256     AC_DEFINE(MAKE_JOBSERVER, 1,
257               [Define this to enable job server support in GNU make.]);;
258 esac
260 # Find the SCCS commands, so we can include them in our default rules.
262 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
263 if test -f /usr/sccs/get; then
264   make_cv_path_sccs_get=/usr/sccs/get
265 else
266   make_cv_path_sccs_get=get
267 fi])
268 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"],
269                    [Define to the name of the SCCS 'get' command.])
271 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
272 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
273    test -f s.conftest; then
274   # We successfully created an SCCS file.
275   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
276     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
277        test -f conftoast; then
278        make_cv_sys_get_minus_G=yes
279     else
280        make_cv_sys_get_minus_G=no
281     fi])
282   case "$make_cv_sys_get_minus_G" in
283     yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
284            [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
285   esac
287 rm -f s.conftest conftoast
289 # Check the system to see if it provides GNU glob.  If not, use our
290 # local version.
292 AC_MSG_CHECKING(if system libc has GNU glob)
293 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
294  AC_EGREP_CPP(gnu glob,[
295 #include <features.h>
296 #include <glob.h>
297 #include <fnmatch.h>
299 #define GLOB_INTERFACE_VERSION 1
300 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
301 # include <gnu-versions.h>
302 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
303    gnu glob
304 # endif
305 #endif
306  ], [AC_MSG_RESULT(yes)
307 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
308 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
309 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
310 make_cv_sys_gnu_glob=no])])
311 # Tell automake about this, so it can build the right .c files.
312 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
314 # Let the makefile know what our build host is
316 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
317 MAKE_HOST="$host"
318 AC_SUBST(MAKE_HOST)
320 # Include the Maintainer's Makefile section, if it's here.
322 MAINT_MAKEFILE=/dev/null
323 if test -r "$srcdir/maintMakefile"; then
324   MAINT_MAKEFILE="$srcdir/maintMakefile"
326 AC_SUBST_FILE(MAINT_MAKEFILE)
328 # Allow building with dmalloc
329 AM_WITH_DMALLOC
332 # Sanity check and inform the user of what we found
334 case "$make_badcust" in
335   yes) echo
336        echo "WARNING: --with-customs specified but no customs.h could be found;"
337        echo "         disabling Customs support."
338        echo ;;
339 esac
341 case "$with_customs" in
342   ""|n|no|y|ye|yes) ;;
343   *) if test -f "$with_customs/lib/libcustoms.a"; then
344        :
345      else
346        echo
347        echo "WARNING: '$with_customs/lib' does not appear to contain the"
348        echo "         Customs library.  You must build and install Customs"
349        echo "         before compiling GNU make."
350        echo
351      fi ;;
352 esac
354 case "$has_wait_nohang" in
355   no) echo
356       echo "WARNING: Your system has neither waitpid() nor wait3()."
357       echo "         Without one of these, signal handling is unreliable."
358       echo "         You should be aware that running GNU make with -j"
359       echo "         could result in erratic behavior."
360       echo ;;
361 esac
363 case "$make_cv_job_server/$user_job_server" in
364   no/yes) echo
365           echo "WARNING: Make job server requires a POSIX-ish system that"
366           echo "         supports the pipe(), sigaction(), and either"
367           echo "         waitpid() or wait3() functions.  Your system doesn't"
368           echo "         appear to provide one or more of those."
369           echo "         Disabling job server support."
370           echo ;;
371 esac
374 # Specify what files are to be created.
375 # We only generate the build.sh if we have a build.sh.in; we won't have
376 # one before we've created a distribution.
378 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
380 if test -f $srcdir/build.sh.in; then
381   AC_CONFIG_FILES(build.sh)
385 # OK, do it!
387 AC_OUTPUT
390 dnl Local Variables:
391 dnl comment-start: "dnl "
392 dnl comment-end: ""
393 dnl comment-start-skip: "\\bdnl\\b\\s *"
394 dnl compile-command: "make configure config.h.in"
395 dnl End: