1 # Process this file with autoconf to produce a configure script.
3 AC_INIT([GNU make],[3.81beta1],[bug-make@gnu.org])
6 AC_REVISION([[$Id: configure.in,v 1.130 2004/12/06 15:03:45 psmith Exp $]])
9 AC_CONFIG_AUX_DIR(config)
10 AC_CONFIG_SRCDIR(vpath.c)
11 AC_CONFIG_HEADERS(config.h)
14 AM_INIT_AUTOMAKE([1.8.2])
16 # Checks for programs.
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
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.
44 # Checks for libraries.
45 AC_SEARCH_LIBS(getpwnam, [sun])
47 # Checks for header files.
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 # Set a flag if we have an ANSI C compiler
56 if test "$ac_cv_prog_cc_stdc" != no; then
57 AC_DEFINE(HAVE_ANSI_COMPILER, 1,
58 [Define if your compiler conforms to the ANSI C standard.])
62 # Determine what kind of variadic function calls we support
63 AC_CHECK_HEADERS(stdarg.h varargs.h, break)
71 # Find some definition for uintmax_t
73 AC_CHECK_TYPE(uintmax_t,,[
74 uintmax_t="unsigned long"
75 AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
76 AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,
77 [Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
79 # Find out whether our struct stat returns nanosecond resolution timestamps.
81 AC_STRUCT_ST_MTIM_NSEC
82 AC_MSG_CHECKING([whether to use high resolution file timestamps])
83 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
84 make_cv_file_timestamp_hi_res=no
85 if test "$ac_cv_struct_st_mtim_nsec" != no; then
86 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
88 # include <inttypes.h>
90 [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
91 [make_cv_file_timestamp_hi_res=yes],
94 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
95 if test "$make_cv_file_timestamp_hi_res" = yes; then
100 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
101 [Use high resolution file timestamps if nonzero.])
103 if test "$make_cv_file_timestamp_hi_res" = yes; then
104 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
105 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
106 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
107 if test "$ac_cv_search_clock_gettime" != no; then
108 AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
109 [Define if you have the clock_gettime function.])
113 # Check for DOS-style pathnames.
116 # See if we have a standard version of gettimeofday(). Since actual
117 # implementations can differ, just make sure we have the most common
119 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
120 [ac_cv_func_gettimeofday=no
121 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
124 struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
125 exit (gettimeofday (&t, 0) != 0
126 || t.tv_sec < 0 || t.tv_usec < 0);
128 [ac_cv_func_gettimeofday=yes],
129 [ac_cv_func_gettimeofday=no],
130 [ac_cv_func_gettimeofday="no (cross-compiling)"])])
131 if test "$ac_cv_func_gettimeofday" = yes; then
132 AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
133 [Define if you have a standard gettimeofday function])
136 AC_CHECK_FUNCS( memcpy memmove strchr strdup mkstemp mktemp fdopen \
137 bsd_signal dup2 getcwd realpath sigsetmask sigaction \
138 getgroups seteuid setegid setlinebuf setreuid setregid \
139 setvbuf pipe strerror strsignal)
141 AC_FUNC_SETVBUF_REVERSED
143 # strcoll() is used by the GNU glob library
149 AC_FUNC_CLOSEDIR_VOID
153 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
154 # doesn't. So, we will.
156 if test "$ac_cv_header_nlist_h" = yes; then
157 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
159 nl.n_name = "string";
161 [make_cv_nlist_struct=yes],
162 [make_cv_nlist_struct=no])
163 if test "$make_cv_nlist_struct" = yes; then
164 AC_DEFINE(NLIST_STRUCT, 1,
165 [Define if struct nlist.n_name is a pointer rather than an array.])
169 AC_CHECK_DECLS([sys_siglist])
172 # Check out the wait reality.
173 AC_CHECK_HEADERS(sys/wait.h)
174 AC_CHECK_FUNCS(waitpid wait3)
175 AC_MSG_CHECKING(for union wait)
176 AC_CACHE_VAL(make_cv_union_wait, [dnl
177 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
178 #include <sys/wait.h>]],
179 [[union wait status; int pid; pid = wait (&status);
181 /* Some POSIXoid systems have both the new-style macros and the old
182 union wait type, and they do not work together. If union wait
183 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
184 if (WEXITSTATUS (status) != 0) pid = -1;
186 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
187 -- blow chunks here --
191 /* Make sure union wait works with waitpid. */
192 pid = waitpid (-1, &status, 0);
195 [make_cv_union_wait=yes],
196 [make_cv_union_wait=no])])
197 if test "$make_cv_union_wait" = yes; then
198 AC_DEFINE(HAVE_UNION_WAIT, 1,
199 [Define this if you have the \`union wait' type in <sys/wait.h>.])
201 AC_MSG_RESULT($make_cv_union_wait)
204 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
205 if test "$PATH_SEPARATOR" = ';'; then
206 AC_DEFINE(HAVE_DOS_PATHS, 1,
207 [Define this if your system requires backslashes or drive specs in pathnames.])
211 # See if the user wants to use pmake's "customs" distributed build capability
213 AC_SUBST(REMOTE) REMOTE=stub
216 AC_HELP_STRING([--with-customs=DIR],
217 [enable remote jobs via Customs--see README.customs]),
220 *) make_cppflags="$CPPFLAGS"
223 *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
224 make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
227 AC_CHECK_HEADER(customs.h,
230 LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
232 CPPFLAGS="$make_cppflags" make_badcust=yes])
235 # Tell automake about this, so it can include the right .c files.
236 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
238 # See if we can handle the job server feature, and if the user wants it.
240 AC_ARG_ENABLE(job-server,
241 AC_HELP_STRING([--disable-job-server],
242 [disallow recursive make communication during -jN]),
243 [make_cv_job_server="$enableval" user_job_server="$enableval"],
244 [make_cv_job_server="yes"])
247 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
248 no/no) has_wait_nohang=no ;;
251 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
252 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
253 [[return SA_RESTART;]])],
254 [make_cv_sa_restart=yes],
255 [make_cv_sa_restart=no])])
257 if test "$make_cv_sa_restart" != no; then
258 AC_DEFINE(HAVE_SA_RESTART, 1,
259 [Define if <signal.h> defines the SA_RESTART constant.])
262 # enable make_cv_sa_restart for OS/2 so that the jobserver will be enabled,
263 # but do it after HAVE_SA_RESTART has been defined.
265 os2*) make_cv_sa_restart=yes ;;
268 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
270 AC_DEFINE(MAKE_JOBSERVER, 1,
271 [Define this to enable job server support in GNU make.]);;
274 # Find the SCCS commands, so we can include them in our default rules.
276 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
277 if test -f /usr/sccs/get; then
278 make_cv_path_sccs_get=/usr/sccs/get
280 make_cv_path_sccs_get=get
282 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"],
283 [Define to the name of the SCCS 'get' command.])
285 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
286 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
287 test -f s.conftest; then
288 # We successfully created an SCCS file.
289 AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
290 if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
291 test -f conftoast; then
292 make_cv_sys_get_minus_G=yes
294 make_cv_sys_get_minus_G=no
296 case "$make_cv_sys_get_minus_G" in
297 yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
298 [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
301 rm -f s.conftest conftoast
303 # Check the system to see if it provides GNU glob. If not, use our
306 AC_MSG_CHECKING(if system libc has GNU glob)
307 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
308 AC_EGREP_CPP(gnu glob,[
309 #include <features.h>
313 #define GLOB_INTERFACE_VERSION 1
314 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
315 # include <gnu-versions.h>
316 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
320 ], [AC_MSG_RESULT(yes)
321 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
322 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
323 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
324 make_cv_sys_gnu_glob=no])])
325 # Tell automake about this, so it can build the right .c files.
326 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
328 # Let the makefile know what our build host is
330 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
334 # Include the Maintainer's Makefile section, if it's here.
336 MAINT_MAKEFILE=/dev/null
337 if test -r "$srcdir/maintMakefile"; then
338 MAINT_MAKEFILE="$srcdir/maintMakefile"
340 AC_SUBST_FILE(MAINT_MAKEFILE)
342 # Allow building with dmalloc
345 # Forcibly disable SET_MAKE. If it's set it breaks things like the test
349 # Sanity check and inform the user of what we found
351 case "$make_badcust" in
353 echo "WARNING: --with-customs specified but no customs.h could be found;"
354 echo " disabling Customs support."
358 case "$with_customs" in
360 *) if test -f "$with_customs/lib/libcustoms.a"; then
364 echo "WARNING: '$with_customs/lib' does not appear to contain the"
365 echo " Customs library. You must build and install Customs"
366 echo " before compiling GNU make."
371 case "$has_wait_nohang" in
373 echo "WARNING: Your system has neither waitpid() nor wait3()."
374 echo " Without one of these, signal handling is unreliable."
375 echo " You should be aware that running GNU make with -j"
376 echo " could result in erratic behavior."
380 case "$make_cv_job_server/$user_job_server" in
382 echo "WARNING: Make job server requires a POSIX-ish system that"
383 echo " supports the pipe(), sigaction(), and either"
384 echo " waitpid() or wait3() functions. Your system doesn't"
385 echo " appear to provide one or more of those."
386 echo " Disabling job server support."
391 # Specify what files are to be created.
392 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
398 # We only generate the build.sh if we have a build.sh.in; we won't have
399 # one before we've created a distribution.
400 if test -f build.sh.in; then
401 ./config.status --file build.sh
406 dnl comment-start: "dnl "
408 dnl comment-start-skip: "\\bdnl\\b\\s *"
409 dnl compile-command: "make configure config.h.in"