1 # Process this file with autoconf to produce a configure script.
3 AC_INIT(GNU make,3.80b2,bug-make@gnu.org)
7 AC_REVISION([[$Id: configure.in,v 1.110 2002/08/08 05:39:17 psmith Exp $]])
10 AC_CONFIG_AUX_DIR(config)
11 AC_CONFIG_SRCDIR(vpath.c)
12 AM_CONFIG_HEADER(config.h)
18 # Checks for programs.
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
33 # Enable gettext, in "external" mode.
35 AM_GNU_GETTEXT_VERSION(0.11.5)
36 AM_GNU_GETTEXT([external])
38 # This test must come as early as possible after the compiler configuration
39 # tests, because the choice of the file model can (in principle) affect
40 # whether functions and headers are available, whether they work, etc.
43 # Checks for libraries.
44 AC_SEARCH_LIBS(getpwnam, [sun])
46 # Checks for header files.
51 AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
52 memory.h sys/param.h sys/time.h sys/timeb.h)
61 # Find some definition for uintmax_t
63 AC_CHECK_TYPE(uintmax_t,,[
64 uintmax_t="unsigned long"
65 AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
66 AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,[Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
68 # Find out whether our struct stat returns nanosecond resolution timestamps.
70 AC_STRUCT_ST_MTIM_NSEC
71 AC_MSG_CHECKING([whether to use high resolution file timestamps])
72 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
73 make_cv_file_timestamp_hi_res=no
74 if test "$ac_cv_struct_st_mtim_nsec" != no; then
77 # include <inttypes.h>
79 [char a[0x7fffffff < (uintmax_t) -1 >> 30 ? 1 : -1];],
80 make_cv_file_timestamp_hi_res=yes)
82 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
83 if test "$make_cv_file_timestamp_hi_res" = yes; then
88 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
89 [Use high resolution file timestamps if nonzero.])
91 if test "$make_cv_file_timestamp_hi_res" = yes; then
92 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
93 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
94 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
95 if test "$ac_cv_search_clock_gettime" != no; then
96 AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
97 [Define if you have the clock_gettime function.])
102 # See if we have a standard version of gettimeofday(). Since actual
103 # implementations can differ, just make sure we have the most common
105 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
106 [ac_cv_func_gettimeofday=no
107 AC_TRY_RUN([#include <sys/time.h>
110 struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
111 exit (gettimeofday (&t, 0) != 0
112 || t.tv_sec < 0 || t.tv_usec < 0);
114 ac_cv_func_gettimeofday=yes,
115 ac_cv_func_gettimeofday=no,
116 ac_cv_func_gettimeofday="no (cross-compiling)")])
117 if test "$ac_cv_func_gettimeofday" = yes; then
118 AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
119 [Define if you have a standard gettimeofday function])
122 AC_CHECK_FUNCS( memcpy strchr strdup mkstemp mktemp fdopen \
123 bsd_signal dup2 getcwd sigsetmask sigaction getgroups \
124 seteuid setegid setlinebuf setreuid setregid setvbuf pipe \
127 make_FUNC_SETVBUF_REVERSED
129 # strcoll() is used by the GNU glob library
135 AC_FUNC_CLOSEDIR_VOID
139 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
140 # doesn't. So, we will.
142 if test "$ac_cv_header_nlist_h" = yes; then
143 AC_TRY_COMPILE([#include <nlist.h>],
145 nl.n_name = "string";
147 make_cv_nlist_struct=yes,
148 make_cv_nlist_struct=no)
149 if test "$make_cv_nlist_struct" = yes; then
150 AC_DEFINE(NLIST_STRUCT, 1,
151 [Define if struct nlist.n_name is a pointer rather than an array.])
157 # Check out the wait reality.
158 AC_CHECK_HEADERS(sys/wait.h)
159 AC_CHECK_FUNCS(waitpid wait3)
160 AC_MSG_CHECKING(for union wait)
161 AC_CACHE_VAL(make_cv_union_wait, [dnl
162 AC_TRY_LINK([#include <sys/types.h>
163 #include <sys/wait.h>],
164 [union wait status; int pid; pid = wait (&status);
166 /* Some POSIXoid systems have both the new-style macros and the old
167 union wait type, and they do not work together. If union wait
168 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
169 if (WEXITSTATUS (status) != 0) pid = -1;
171 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints. */
172 -- blow chunks here --
176 /* Make sure union wait works with waitpid. */
177 pid = waitpid (-1, &status, 0);
180 [make_cv_union_wait=yes], [make_cv_union_wait=no])])
181 if test "$make_cv_union_wait" = yes; then
182 AC_DEFINE(HAVE_UNION_WAIT, 1, [Define this if you have the \`union wait' type in <sys/wait.h>.])
184 AC_MSG_RESULT($make_cv_union_wait)
187 # See if the user wants to use pmake's "customs" distributed build capability
191 AC_HELP_STRING([--with-customs=DIR],
192 [enable remote jobs via Customs--see README.customs]),
195 *) make_cppflags="$CPPFLAGS"
198 *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
199 make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
202 AC_CHECK_HEADER(customs.h,
204 LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
206 CPPFLAGS="$make_cppflags" make_badcust=yes])
209 # Tell automake about this, so it can include the right .c files.
210 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
212 # See if we can handle the job server feature, and if the user wants it.
214 AC_ARG_ENABLE(job-server,
215 AC_HELP_STRING([--disable-job-server],
216 [disallow recursive make communication during -jN]),
217 [make_cv_job_server="$enableval" user_job_server="$enableval"],
218 [make_cv_job_server="yes"])
221 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
222 no/no) has_wait_nohang=no ;;
225 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
226 AC_TRY_COMPILE([#include <signal.h>],
227 [return SA_RESTART;],
228 make_cv_sa_restart=yes,
229 make_cv_sa_restart=no)])
230 if test "$make_cv_sa_restart" != no; then
231 AC_DEFINE(HAVE_SA_RESTART, 1,
232 [Define if <signal.h> defines the SA_RESTART constant.])
235 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
237 AC_DEFINE(MAKE_JOBSERVER, 1,
238 [Define this to enable job server support in GNU make.]);;
241 # Find the SCCS commands, so we can include them in our default rules.
243 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
244 if test -f /usr/sccs/get; then
245 make_cv_path_sccs_get=/usr/sccs/get
247 make_cv_path_sccs_get=get
249 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.])
251 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
252 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
253 test -f s.conftest; then
254 # We successfully created an SCCS file.
255 AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
256 if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
257 test -f conftoast; then
258 make_cv_sys_get_minus_G=yes
260 make_cv_sys_get_minus_G=no
262 case "$make_cv_sys_get_minus_G" in
263 yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
264 [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
267 rm -f s.conftest conftoast
269 # Check the system to see if it provides GNU glob. If not, use our
272 AC_MSG_CHECKING(if system libc has GNU glob)
273 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
274 AC_EGREP_CPP(gnu glob,[
275 #include <features.h>
279 #define GLOB_INTERFACE_VERSION 1
280 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
281 # include <gnu-versions.h>
282 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
286 ], [AC_MSG_RESULT(yes)
287 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
288 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
289 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
290 make_cv_sys_gnu_glob=no])])
291 # Tell automake about this, so it can build the right .c files.
292 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
294 # Let the makefile know what our build host is
296 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
300 # Include the Maintainer's Makefile section, if it's here.
302 MAINT_MAKEFILE=/dev/null
303 if test -r "$srcdir/maintMakefile"; then
304 MAINT_MAKEFILE="$srcdir/maintMakefile"
306 AC_SUBST_FILE(MAINT_MAKEFILE)
308 # Allow building with dmalloc
312 # Sanity check and inform the user of what we found
314 case "$make_badcust" in
316 echo "WARNING: --with-customs specified but no customs.h could be found;"
317 echo " disabling Customs support."
321 case "$with_customs" in
323 *) if test -f "$with_customs/lib/libcustoms.a"; then
327 echo "WARNING: '$with_customs/lib' does not appear to contain the"
328 echo " Customs library. You must build and install Customs"
329 echo " before compiling GNU make."
334 case "$has_wait_nohang" in
336 echo "WARNING: Your system has neither waitpid() nor wait3()."
337 echo " Without one of these, signal handling is unreliable."
338 echo " You should be aware that running GNU make with -j"
339 echo " could result in erratic behavior."
343 case "$make_cv_job_server/$user_job_server" in
345 echo "WARNING: Make job server requires a POSIX-ish system that"
346 echo " supports the pipe(), sigaction(), and either"
347 echo " waitpid() or wait3() functions. Your system doesn't"
348 echo " appear to provide one or more of those."
349 echo " Disabling job server support."
354 # Specify what files are to be created.
355 # We only generate the build.sh if we have a build.sh.in; we won't have
356 # one before we've created a distribution.
358 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
360 if test -f $srcdir/build.sh.in; then
361 AC_CONFIG_FILES(build.sh)
371 dnl comment-start: "dnl "
373 dnl comment-start-skip: "\\bdnl\\b\\s *"
374 dnl compile-command: "make configure config.h.in"