Add back initial "\" which was accidentally removed a year ago! :-/.
[make.git] / configure.in
blob4a346d31cbd25f41cf6d4dcc8c2b02e097caa440
1 # Process this file with autoconf to produce a configure script.
3 AC_INIT(GNU make,3.79.2rc1,bug-make@gnu.org)
5 AC_PREREQ(2.53)
7 AC_REVISION([[$Id: configure.in,v 1.107 2002/04/22 04:35:20 psmith Exp $]])
9 # Autoconf setup
10 AC_CONFIG_AUX_DIR(config)
11 AC_CONFIG_SRCDIR(vpath.c)
12 AM_CONFIG_HEADER(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 # Enable gettext, in "external" mode.
34 # Maintainers: this requires gettext 0.11 or better!
35 AM_GNU_GETTEXT([external])
37 # This test must come as early as possible after the compiler configuration
38 # tests, because the choice of the file model can (in principle) affect
39 # whether functions and headers are available, whether they work, etc.
40 AC_SYS_LARGEFILE
42 # Checks for libraries.
43 AC_SEARCH_LIBS(getpwnam, [sun])
45 # Checks for header files.
46 AC_HEADER_STDC
47 AC_HEADER_DIRENT
48 AC_HEADER_STAT
49 AC_HEADER_TIME
50 AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/param.h fcntl.h string.h \
51                  memory.h sys/time.h sys/timeb.h)
53 AM_PROG_CC_C_O
54 AM_PROG_CC_STDC
55 AC_C_CONST
56 AC_TYPE_SIGNAL
57 AC_TYPE_UID_T
58 AC_TYPE_PID_T
60 # Find some definition for uintmax_t
62 AC_CHECK_TYPE(uintmax_t,,[
63   uintmax_t="unsigned long"
64   AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
65   AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,[Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
67 # Find out whether our struct stat returns nanosecond resolution timestamps.
69 AC_STRUCT_ST_MTIM_NSEC
70 AC_MSG_CHECKING([whether to use high resolution file timestamps])
71 AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
72   make_cv_file_timestamp_hi_res=no
73   if test $ac_cv_struct_st_mtim_nsec != no; then
74     AC_TRY_COMPILE([
75 #       if HAVE_INTTYPES_H
76 #        include <inttypes.h>
77 #       endif],
78       [char a[0x7fffffff < (uintmax_t) -1 >> 30 ? 1 : -1];],
79       make_cv_file_timestamp_hi_res=yes)
80   fi])
81 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
82 if test $make_cv_file_timestamp_hi_res = yes; then
83   val=1
84 else
85   val=0
87 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
88                    [Use high resolution file timestamps if nonzero.])
90 if test $make_cv_file_timestamp_hi_res = yes; then
91   # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
92   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
93   AC_SEARCH_LIBS(clock_gettime, [rt posix4])
94   if test "$ac_cv_search_clock_gettime" != no; then
95     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
96               [Define if you have the clock_gettime function.])
97   fi
101 # See if we have a standard version of gettimeofday().  Since actual
102 # implementations can differ, just make sure we have the most common
103 # one.
104 AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
105   [ac_cv_func_gettimeofday=no
106    AC_TRY_RUN([#include <sys/time.h>
107                int main ()
108                {
109                  struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
110                  exit (gettimeofday (&t, 0) != 0
111                        || t.tv_sec < 0 || t.tv_usec < 0);
112                }],
113               ac_cv_func_gettimeofday=yes,
114               ac_cv_func_gettimeofday=no,
115               ac_cv_func_gettimeofday="no (cross-compiling)")])
116 if test $ac_cv_func_gettimeofday = yes; then
117   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
118             [Define if you have a standard gettimeofday function])
121 AC_CHECK_FUNCS( memcpy strchr strdup mkstemp mktemp fdopen \
122                 bsd_signal dup2 getcwd sigsetmask sigaction getgroups \
123                 setlinebuf seteuid setegid setreuid setregid pipe \
124                 strerror strsignal)
126 AC_FUNC_ALLOCA
127 AC_FUNC_VFORK
128 AC_FUNC_VPRINTF
129 AC_FUNC_STRCOLL
130 AC_FUNC_CLOSEDIR_VOID
131 AC_FUNC_SETVBUF_REVERSED
132 AC_FUNC_GETLOADAVG
134 AC_DECL_SYS_SIGLIST
136 # Check out the wait reality.
137 AC_CHECK_HEADERS(sys/wait.h)
138 AC_CHECK_FUNCS(waitpid wait3)
139 AC_MSG_CHECKING(for union wait)
140 AC_CACHE_VAL(make_cv_union_wait, [dnl
141 AC_TRY_LINK([#include <sys/types.h>
142 #include <sys/wait.h>],
143             [union wait status; int pid; pid = wait (&status);
144 #ifdef WEXITSTATUS
145 /* Some POSIXoid systems have both the new-style macros and the old
146    union wait type, and they do not work together.  If union wait
147    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
148 if (WEXITSTATUS (status) != 0) pid = -1;
149 #ifdef WTERMSIG
150 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
151 -- blow chunks here --
152 #endif
153 #endif
154 #ifdef HAVE_WAITPID
155 /* Make sure union wait works with waitpid.  */
156 pid = waitpid (-1, &status, 0);
157 #endif
159             [make_cv_union_wait=yes], [make_cv_union_wait=no])])
160 if test "$make_cv_union_wait" = yes; then
161   AC_DEFINE(HAVE_UNION_WAIT, 1, [Define this if you have the \`union wait' type in <sys/wait.h>.])
163 AC_MSG_RESULT($make_cv_union_wait)
166 # See if the user wants to use pmake's "customs" distributed build capability
168 use_customs=false
169 AC_ARG_WITH(customs,
170   AC_HELP_STRING([--with-customs=DIR],
171                  [Enable remote jobs via Customs--see README.customs]),
172   [case $withval in
173     n|no) : ;;
174     *) make_cppflags="$CPPFLAGS"
175        case $withval in
176          y|ye|yes) : ;;
177          *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
178             make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
179        esac
180        CF_NETLIBS
181        AC_CHECK_HEADER(customs.h,
182                        [use_customs=true
183                          LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
184                        [with_customs=no
185                          CPPFLAGS="$make_cppflags" make_badcust=yes])
186        ;;
187   esac])
188 # Tell automake about this, so it can include the right .c files.
189 AM_CONDITIONAL(USE_CUSTOMS, test $use_customs = true)
191 # See if we can handle the job server feature, and if the user wants it.
193 AC_ARG_ENABLE(job-server,
194   AC_HELP_STRING([--disable-job-server],
195                  [Disallow recursive make communication during -jN]),
196   [make_cv_job_server="$enableval" user_job_server="$enableval"],
197   [make_cv_job_server="yes"])
199 has_wait_nohang=yes
200 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
201   no/no) has_wait_nohang=no ;;
202 esac
204 AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
205   AC_TRY_COMPILE([#include <signal.h>],
206       [return SA_RESTART;],
207       make_cv_sa_restart=yes,
208       make_cv_sa_restart=no)])
209 if test "$make_cv_sa_restart" != no; then
210   AC_DEFINE(HAVE_SA_RESTART, 1,
211      [Define if <signal.h> defines the SA_RESTART constant.])
214 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
215   yes/yes/yes/yes/yes)
216     AC_DEFINE(MAKE_JOBSERVER, 1,
217               [Define this to enable job server support in GNU make.]);;
218 esac
220 # Find the SCCS commands, so we can include them in our default rules.
222 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
223 if test -f /usr/sccs/get; then
224   make_cv_path_sccs_get=/usr/sccs/get
225 else
226   make_cv_path_sccs_get=get
227 fi])
228 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.])
230 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
231 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
232    test -f s.conftest; then
233   # We successfully created an SCCS file.
234   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
235     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
236        test -f conftoast; then
237        make_cv_sys_get_minus_G=yes
238     else
239        make_cv_sys_get_minus_G=no
240     fi])
241   case "$make_cv_sys_get_minus_G" in
242     yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
243            [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
244   esac
246 rm -f s.conftest conftoast
248 # Check the system to see if it provides GNU glob.  If not, use our
249 # local version.
251 AC_MSG_CHECKING(if system libc has GNU glob)
252 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
253  AC_EGREP_CPP(gnu glob,[
254 #include <features.h>
255 #include <glob.h>
256 #include <fnmatch.h>
258 #define GLOB_INTERFACE_VERSION 1
259 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
260 # include <gnu-versions.h>
261 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
262 #  gnu glob
263 # endif
264 #endif
265  ], [AC_MSG_RESULT(yes)
266 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
267 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
268 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
269 make_cv_sys_gnu_glob=no])])
270 # Tell automake about this, so it can build the right .c files.
271 AM_CONDITIONAL(USE_LOCAL_GLOB, test $make_cv_sys_gnu_glob = no)
273 # Let the makefile know what our build host is
275 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
276 MAKE_HOST="$host"
277 AC_SUBST(MAKE_HOST)
279 # Include the Maintainer's Makefile section, if it's here.
281 MAINT_MAKEFILE=/dev/null
282 if test -r "$srcdir/maintMakefile"; then
283   MAINT_MAKEFILE="$srcdir/maintMakefile"
285 AC_SUBST_FILE(MAINT_MAKEFILE)
287 # Allow building with dmalloc
288 AM_WITH_DMALLOC
291 # Sanity check and inform the user of what we found
293 case "$make_badcust" in
294   yes) echo
295        echo "WARNING: --with-customs specified but no customs.h could be found;"
296        echo "         disabling Customs support."
297        echo ;;
298 esac
300 case "$with_customs" in
301   ""|n|no|y|ye|yes) ;;
302   *) if test -f "$with_customs/lib/libcustoms.a"; then
303        :
304      else
305        echo
306        echo "WARNING: '$with_customs/lib' does not appear to contain the"
307        echo "         Customs library.  You must build and install Customs"
308        echo "         before compiling GNU make."
309        echo
310      fi ;;
311 esac
313 case "$has_wait_nohang" in
314   no) echo
315       echo "WARNING: Your system has neither waitpid() nor wait3()."
316       echo "         Without one of these, signal handling is unreliable."
317       echo "         You should be aware that running GNU make with -j"
318       echo "         could result in erratic behavior."
319       echo ;;
320 esac
322 case "$make_cv_job_server/$user_job_server" in
323   no/yes) echo
324           echo "WARNING: Make job server requires a POSIX-ish system that"
325           echo "         supports the pipe(), sigaction(), and either"
326           echo "         waitpid() or wait3() functions.  Your system doesn't"
327           echo "         appear to provide one or more of those."
328           echo "         Disabling job server support."
329           echo ;;
330 esac
333 # Specify what files are to be created.
334 # We only generate the build.sh if we have a build.sh.in; we won't have
335 # one before we've created a distribution.
337 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile)
339 if test -f $srcdir/build.sh.in; then
340   AC_CONFIG_FILES(build.sh)
344 # OK, do it!
346 AC_OUTPUT
349 dnl Local Variables:
350 dnl comment-start: "dnl "
351 dnl comment-end: ""
352 dnl comment-start-skip: "\\bdnl\\b\\s *"
353 dnl compile-command: "make configure config.h.in"
354 dnl End: