Fix bug #2238: the read.c:eval() function was not entirely reentrant.
[make/kirr.git] / configure.in
blob8d6c3d89abb5322d192a18b0a7b8211eeffa7092
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.54)
7 AC_REVISION([[$Id: configure.in,v 1.116 2003/01/30 05:22:52 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,[Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
71 # Find out whether our struct stat returns nanosecond resolution timestamps.
73 AC_STRUCT_ST_MTIM_NSEC
74 AC_MSG_CHECKING([whether to use high resolution file timestamps])
75 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
76   make_cv_file_timestamp_hi_res=no
77   if test "$ac_cv_struct_st_mtim_nsec" != no; then
78     AC_TRY_COMPILE([
79 #       if HAVE_INTTYPES_H
80 #        include <inttypes.h>
81 #       endif],
82       [char a[0x7fffffff < (uintmax_t) -1 >> 30 ? 1 : -1];],
83       make_cv_file_timestamp_hi_res=yes)
84   fi])
85 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
86 if test "$make_cv_file_timestamp_hi_res" = yes; then
87   val=1
88 else
89   val=0
91 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
92                    [Use high resolution file timestamps if nonzero.])
94 if test "$make_cv_file_timestamp_hi_res" = yes; then
95   # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
96   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
97   AC_SEARCH_LIBS(clock_gettime, [rt posix4])
98   if test "$ac_cv_search_clock_gettime" != no; then
99     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
100               [Define if you have the clock_gettime function.])
101   fi
105 # See if we have a standard version of gettimeofday().  Since actual
106 # implementations can differ, just make sure we have the most common
107 # one.
108 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
109   [ac_cv_func_gettimeofday=no
110    AC_TRY_RUN([#include <sys/time.h>
111                int main ()
112                {
113                  struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
114                  exit (gettimeofday (&t, 0) != 0
115                        || t.tv_sec < 0 || t.tv_usec < 0);
116                }],
117               ac_cv_func_gettimeofday=yes,
118               ac_cv_func_gettimeofday=no,
119               ac_cv_func_gettimeofday="no (cross-compiling)")])
120 if test "$ac_cv_func_gettimeofday" = yes; then
121   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
122             [Define if you have a standard gettimeofday function])
125 AC_CHECK_FUNCS( memcpy memmove strchr strdup mkstemp mktemp fdopen \
126                 bsd_signal dup2 getcwd sigsetmask sigaction getgroups \
127                 seteuid setegid setlinebuf setreuid setregid setvbuf pipe \
128                 strerror strsignal)
130 make_FUNC_SETVBUF_REVERSED
132 # strcoll() is used by the GNU glob library
133 AC_FUNC_STRCOLL
135 AC_FUNC_ALLOCA
136 AC_FUNC_VFORK
137 AC_FUNC_VPRINTF
138 AC_FUNC_CLOSEDIR_VOID
140 AC_FUNC_GETLOADAVG
142 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
143 # doesn't.  So, we will.
145 if test "$ac_cv_header_nlist_h" = yes; then
146   AC_TRY_COMPILE([#include <nlist.h>],
147       [struct nlist nl;
148        nl.n_name = "string";
149        return 0;],
150       make_cv_nlist_struct=yes,
151       make_cv_nlist_struct=no)
152   if test "$make_cv_nlist_struct" = yes; then
153     AC_DEFINE(NLIST_STRUCT, 1,
154        [Define if struct nlist.n_name is a pointer rather than an array.])
155   fi
158 AC_DECL_SYS_SIGLIST
160 # Check out the wait reality.
161 AC_CHECK_HEADERS(sys/wait.h)
162 AC_CHECK_FUNCS(waitpid wait3)
163 AC_MSG_CHECKING(for union wait)
164 AC_CACHE_VAL(make_cv_union_wait, [dnl
165 AC_TRY_LINK([#include <sys/types.h>
166 #include <sys/wait.h>],
167             [union wait status; int pid; pid = wait (&status);
168 #ifdef WEXITSTATUS
169 /* Some POSIXoid systems have both the new-style macros and the old
170    union wait type, and they do not work together.  If union wait
171    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
172 if (WEXITSTATUS (status) != 0) pid = -1;
173 #ifdef WTERMSIG
174 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
175 -- blow chunks here --
176 #endif
177 #endif
178 #ifdef HAVE_WAITPID
179 /* Make sure union wait works with waitpid.  */
180 pid = waitpid (-1, &status, 0);
181 #endif
183             [make_cv_union_wait=yes], [make_cv_union_wait=no])])
184 if test "$make_cv_union_wait" = yes; then
185   AC_DEFINE(HAVE_UNION_WAIT, 1, [Define this if you have the \`union wait' type in <sys/wait.h>.])
187 AC_MSG_RESULT($make_cv_union_wait)
190 # See if the user wants to use pmake's "customs" distributed build capability
192 use_customs=false
193 AC_ARG_WITH(customs,
194   AC_HELP_STRING([--with-customs=DIR],
195                  [enable remote jobs via Customs--see README.customs]),
196   [case $withval in
197     n|no) : ;;
198     *) make_cppflags="$CPPFLAGS"
199        case $withval in
200          y|ye|yes) : ;;
201          *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
202             make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
203        esac
204        CF_NETLIBS
205        AC_CHECK_HEADER(customs.h,
206                        [use_customs=true
207                          LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
208                        [with_customs=no
209                          CPPFLAGS="$make_cppflags" make_badcust=yes])
210        ;;
211   esac])
212 # Tell automake about this, so it can include the right .c files.
213 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
215 # See if we can handle the job server feature, and if the user wants it.
217 AC_ARG_ENABLE(job-server,
218   AC_HELP_STRING([--disable-job-server],
219                  [disallow recursive make communication during -jN]),
220   [make_cv_job_server="$enableval" user_job_server="$enableval"],
221   [make_cv_job_server="yes"])
223 has_wait_nohang=yes
224 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
225   no/no) has_wait_nohang=no ;;
226 esac
228 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
229   AC_TRY_COMPILE([#include <signal.h>],
230       [return SA_RESTART;],
231       make_cv_sa_restart=yes,
232       make_cv_sa_restart=no)])
233 if test "$make_cv_sa_restart" != no; then
234   AC_DEFINE(HAVE_SA_RESTART, 1,
235      [Define if <signal.h> defines the SA_RESTART constant.])
238 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
239   yes/yes/yes/yes/yes)
240     AC_DEFINE(MAKE_JOBSERVER, 1,
241               [Define this to enable job server support in GNU make.]);;
242 esac
244 # Find the SCCS commands, so we can include them in our default rules.
246 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
247 if test -f /usr/sccs/get; then
248   make_cv_path_sccs_get=/usr/sccs/get
249 else
250   make_cv_path_sccs_get=get
251 fi])
252 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.])
254 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
255 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
256    test -f s.conftest; then
257   # We successfully created an SCCS file.
258   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
259     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
260        test -f conftoast; then
261        make_cv_sys_get_minus_G=yes
262     else
263        make_cv_sys_get_minus_G=no
264     fi])
265   case "$make_cv_sys_get_minus_G" in
266     yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
267            [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
268   esac
270 rm -f s.conftest conftoast
272 # Check the system to see if it provides GNU glob.  If not, use our
273 # local version.
275 AC_MSG_CHECKING(if system libc has GNU glob)
276 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
277  AC_EGREP_CPP(gnu glob,[
278 #include <features.h>
279 #include <glob.h>
280 #include <fnmatch.h>
282 #define GLOB_INTERFACE_VERSION 1
283 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
284 # include <gnu-versions.h>
285 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
286    gnu glob
287 # endif
288 #endif
289  ], [AC_MSG_RESULT(yes)
290 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
291 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
292 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
293 make_cv_sys_gnu_glob=no])])
294 # Tell automake about this, so it can build the right .c files.
295 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
297 # Let the makefile know what our build host is
299 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
300 MAKE_HOST="$host"
301 AC_SUBST(MAKE_HOST)
303 # Include the Maintainer's Makefile section, if it's here.
305 MAINT_MAKEFILE=/dev/null
306 if test -r "$srcdir/maintMakefile"; then
307   MAINT_MAKEFILE="$srcdir/maintMakefile"
309 AC_SUBST_FILE(MAINT_MAKEFILE)
311 # Allow building with dmalloc
312 AM_WITH_DMALLOC
315 # Sanity check and inform the user of what we found
317 case "$make_badcust" in
318   yes) echo
319        echo "WARNING: --with-customs specified but no customs.h could be found;"
320        echo "         disabling Customs support."
321        echo ;;
322 esac
324 case "$with_customs" in
325   ""|n|no|y|ye|yes) ;;
326   *) if test -f "$with_customs/lib/libcustoms.a"; then
327        :
328      else
329        echo
330        echo "WARNING: '$with_customs/lib' does not appear to contain the"
331        echo "         Customs library.  You must build and install Customs"
332        echo "         before compiling GNU make."
333        echo
334      fi ;;
335 esac
337 case "$has_wait_nohang" in
338   no) echo
339       echo "WARNING: Your system has neither waitpid() nor wait3()."
340       echo "         Without one of these, signal handling is unreliable."
341       echo "         You should be aware that running GNU make with -j"
342       echo "         could result in erratic behavior."
343       echo ;;
344 esac
346 case "$make_cv_job_server/$user_job_server" in
347   no/yes) echo
348           echo "WARNING: Make job server requires a POSIX-ish system that"
349           echo "         supports the pipe(), sigaction(), and either"
350           echo "         waitpid() or wait3() functions.  Your system doesn't"
351           echo "         appear to provide one or more of those."
352           echo "         Disabling job server support."
353           echo ;;
354 esac
357 # Specify what files are to be created.
358 # We only generate the build.sh if we have a build.sh.in; we won't have
359 # one before we've created a distribution.
361 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
363 if test -f $srcdir/build.sh.in; then
364   AC_CONFIG_FILES(build.sh)
368 # OK, do it!
370 AC_OUTPUT
373 dnl Local Variables:
374 dnl comment-start: "dnl "
375 dnl comment-end: ""
376 dnl comment-start-skip: "\\bdnl\\b\\s *"
377 dnl compile-command: "make configure config.h.in"
378 dnl End: