Modify backslash/newline handling for POSIX.
[make.git] / configure.in
blobd2d33876a83fad87d0e57325cf5a28e557e01069
1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
5 # Foundation, Inc.
6 # This file is part of GNU Make.
8 # GNU Make is free software; you can redistribute it and/or modify it under
9 # the terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 3 of the License, or (at your option) any later
11 # version.
13 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16 # details.
18 # You should have received a copy of the GNU General Public License along with
19 # this program.  If not, see <http://www.gnu.org/licenses/>.
21 AC_INIT([GNU make],[3.82.90],[bug-make@gnu.org])
23 AC_PREREQ([2.59])
24 AC_REVISION([$Id: configure.in,v 1.162 2012/01/29 18:12:22 psmith Exp $])
26 # Autoconf setup
27 AC_CONFIG_AUX_DIR([config])
28 AC_CONFIG_SRCDIR([vpath.c])
29 AC_CONFIG_HEADERS([config.h])
31 # Automake setup
32 AM_INIT_AUTOMAKE([1.9])
34 # Checks for programs.
35 AC_PROG_CC
36 AC_PROG_INSTALL
37 AC_PROG_RANLIB
38 AC_PROG_CPP
39 AC_CHECK_PROG([AR], [ar], [ar], [ar])
40 # Perl is needed for the test suite (only)
41 AC_CHECK_PROG([PERL], [perl], [perl], [perl])
43 # Specialized system macros
44 AC_CANONICAL_HOST
45 AC_AIX
46 AC_ISC_POSIX
47 AC_MINIX
49 # Enable gettext, in "external" mode.
51 AM_GNU_GETTEXT_VERSION([0.14.1])
52 AM_GNU_GETTEXT([external])
54 # This test must come as early as possible after the compiler configuration
55 # tests, because the choice of the file model can (in principle) affect
56 # whether functions and headers are available, whether they work, etc.
57 AC_SYS_LARGEFILE
59 # Checks for libraries.
60 AC_SEARCH_LIBS([getpwnam], [sun])
62 # Checks for header files.
63 AC_HEADER_STDC
64 AC_HEADER_DIRENT
65 AC_HEADER_STAT
66 AC_HEADER_TIME
67 AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
68                   memory.h sys/param.h sys/resource.h sys/time.h sys/timeb.h])
70 # Set a flag if we have an ANSI C compiler
71 AS_IF([test "$ac_cv_prog_cc_stdc" != no],
72 [ AC_DEFINE([HAVE_ANSI_COMPILER], [1],
73             [Define to 1 if your compiler conforms to the ANSI C standard.])
77 # Determine what kind of variadic function calls we support
78 AC_CHECK_HEADERS([stdarg.h varargs.h], [break])
80 AM_PROG_CC_C_O
81 AC_C_CONST
82 AC_TYPE_SIGNAL
83 AC_TYPE_UID_T
84 AC_TYPE_PID_T
86 # Find some definition for uintmax_t
88 AC_CHECK_TYPE([uintmax_t],[],
89 [ uintmax_t="unsigned long"
90   AC_CHECK_TYPE([unsigned long long],[uintmax_t="unsigned long long"])
91   AC_DEFINE_UNQUOTED([uintmax_t], [$uintmax_t],
92     [Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])
95 # Find out whether our struct stat returns nanosecond resolution timestamps.
97 AC_STRUCT_ST_MTIM_NSEC
98 AC_CACHE_CHECK([whether to use high resolution file timestamps],
99                [make_cv_file_timestamp_hi_res],
100 [ make_cv_file_timestamp_hi_res=no
101   AS_IF([test "$ac_cv_struct_st_mtim_nsec" != no],
102         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
103 #if HAVE_INTTYPES_H
104 # include <inttypes.h>
105 #endif]],
106                       [[char a[0x7fffffff < (uintmax_t)-1 >> 30 ? 1 : -1];]])],
107         [make_cv_file_timestamp_hi_res=yes])
108   ])])
109 AS_IF([test "$make_cv_file_timestamp_hi_res" = yes], [val=1], [val=0])
110 AC_DEFINE_UNQUOTED([FILE_TIMESTAMP_HI_RES], [$val],
111                    [Use high resolution file timestamps if nonzero.])
113 AS_IF([test "$make_cv_file_timestamp_hi_res" = yes],
114 [ # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
115   # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
116   AC_SEARCH_LIBS([clock_gettime], [rt posix4])
117   AS_IF([test "$ac_cv_search_clock_gettime" != no],
118   [ AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
119               [Define to 1 if you have the clock_gettime function.])
120   ])
123 # Check for DOS-style pathnames.
124 pds_AC_DOS_PATHS
126 # See if we have a standard version of gettimeofday().  Since actual
127 # implementations can differ, just make sure we have the most common
128 # one.
129 AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday],
130   [ac_cv_func_gettimeofday=no
131    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/time.h>
132                   int main ()
133                   {
134                     struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
135                     exit (gettimeofday (&t, 0) != 0
136                           || t.tv_sec < 0 || t.tv_usec < 0);
137                   }]])],
138                   [ac_cv_func_gettimeofday=yes],
139                   [ac_cv_func_gettimeofday=no],
140                   [ac_cv_func_gettimeofday="no (cross-compiling)"])])
141 AS_IF([test "$ac_cv_func_gettimeofday" = yes],
142 [ AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
143             [Define to 1 if you have a standard gettimeofday function])
146 AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \
147                 dup2 getcwd realpath sigsetmask sigaction \
148                 getgroups seteuid setegid setlinebuf setreuid setregid \
149                 getrlimit setrlimit setvbuf pipe strerror strsignal \
150                 lstat readlink atexit])
152 # We need to check declarations, not just existence, because on Tru64 this
153 # function is not declared without special flags, which themselves cause
154 # other problems.  We'll just use our own.
155 AC_CHECK_DECLS([bsd_signal], [], [], [[#include <signal.h>]])
157 AC_FUNC_SETVBUF_REVERSED
159 # Rumor has it that strcasecmp lives in -lresolv on some odd systems.
160 # It doesn't hurt much to use our own if we can't find it so I don't
161 # make the effort here.
162 AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
164 # strcoll() is used by the GNU glob library
165 AC_FUNC_STRCOLL
167 AC_FUNC_ALLOCA
168 AC_FUNC_FORK([])
169 AC_FUNC_VPRINTF
170 AC_FUNC_CLOSEDIR_VOID
172 # See if the user wants to add (or not) GNU Guile support
173 PKG_PROG_PKG_CONFIG
174 AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
175             [Support GNU Guile for embedded scripting])])
177 # For some strange reason, at least on Ubuntu, each version of Guile
178 # comes with it's own PC file so we have to specify them as individual
179 # packages.  Ugh.
180 AS_IF([test "x$with_guile" != xno],
181 [ PKG_CHECK_MODULES([GUILE], [guile-2.0], [have_guile=yes],
182   [PKG_CHECK_MODULES([GUILE], [guile-1.8], [have_guile=yes],
183     [have_guile=no])])
186 AS_IF([test "$have_guile" = yes],
187       [AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])])
189 AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
191 AC_FUNC_GETLOADAVG
193 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
194 # doesn't.  So, we will.
196 AS_IF([test "$ac_cv_header_nlist_h" = yes],
197 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
198         [[struct nlist nl;
199           nl.n_name = "string";
200           return 0;]])],
201         [make_cv_nlist_struct=yes],
202         [make_cv_nlist_struct=no])
203   AS_IF([test "$make_cv_nlist_struct" = yes],
204   [ AC_DEFINE([NLIST_STRUCT], [1],
205        [Define to 1 if struct nlist.n_name is a pointer rather than an array.])
206   ])
209 AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
210   [AC_INCLUDES_DEFAULT
211 #include <signal.h>
212 /* NetBSD declares sys_siglist in unistd.h.  */
213 #if HAVE_UNISTD_H
214 # include <unistd.h>
215 #endif
219 # Check out the wait reality.
220 AC_CHECK_HEADERS([sys/wait.h],[],[],[[#include <sys/types.h>]])
221 AC_CHECK_FUNCS([waitpid wait3])
222 AC_CACHE_CHECK([for union wait], [make_cv_union_wait],
223 [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
224 #include <sys/wait.h>]],
225      [[union wait status; int pid; pid = wait (&status);
226 #ifdef WEXITSTATUS
227 /* Some POSIXoid systems have both the new-style macros and the old
228    union wait type, and they do not work together.  If union wait
229    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
230         if (WEXITSTATUS (status) != 0) pid = -1;
231 #ifdef WTERMSIG
232         /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
233         -- blow chunks here --
234 #endif
235 #endif
236 #ifdef HAVE_WAITPID
237         /* Make sure union wait works with waitpid.  */
238         pid = waitpid (-1, &status, 0);
239 #endif
240       ]])],
241     [make_cv_union_wait=yes],
242     [make_cv_union_wait=no])
244 AS_IF([test "$make_cv_union_wait" = yes],
245 [ AC_DEFINE([HAVE_UNION_WAIT], [1],
246             [Define to 1 if you have the \`union wait' type in <sys/wait.h>.])
250 # If we're building on Windows/DOS/OS/2, add some support for DOS drive specs.
251 AS_IF([test "$PATH_SEPARATOR" = ';'],
252 [ AC_DEFINE([HAVE_DOS_PATHS], [1],
253             [Define to 1 if your system requires backslashes or drive specs in pathnames.])
257 # See if the user wants to use pmake's "customs" distributed build capability
259 AC_SUBST([REMOTE]) REMOTE=stub
260 use_customs=false
261 AC_ARG_WITH([customs],
262 [ AC_HELP_STRING([--with-customs=DIR],
263                  [enable remote jobs via Customs--see README.customs])],
264 [ AS_CASE([$withval], [n|no], [:],
265     [make_cppflags="$CPPFLAGS"
266      AS_CASE([$withval],
267              [y|ye|yes], [:],
268              [CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
269               make_ldflags="$LDFLAGS -L$with_customs/lib"])
270      CF_NETLIBS
271      AC_CHECK_HEADER([customs.h],
272                      [use_customs=true
273                       REMOTE=cstms
274                       LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
275                      [with_customs=no
276                       CPPFLAGS="$make_cppflags" make_badcust=yes])
277     ])
280 # Tell automake about this, so it can include the right .c files.
281 AM_CONDITIONAL([USE_CUSTOMS], [test "$use_customs" = true])
283 # See if the user asked to handle case insensitive file systems.
285 AH_TEMPLATE([HAVE_CASE_INSENSITIVE_FS], [Use case insensitive file names])
286 AC_ARG_ENABLE([case-insensitive-file-system],
287   AC_HELP_STRING([--enable-case-insensitive-file-system],
288                  [assume file systems are case insensitive]),
289   [AS_IF([test "$enableval" = yes], [AC_DEFINE([HAVE_CASE_INSENSITIVE_FS])])])
291 # See if we can handle the job server feature, and if the user wants it.
293 AC_ARG_ENABLE([job-server],
294   AC_HELP_STRING([--disable-job-server],
295                  [disallow recursive make communication during -jN]),
296   [make_cv_job_server="$enableval" user_job_server="$enableval"],
297   [make_cv_job_server="yes"])
299 AS_IF([test "$ac_cv_func_waitpid" = no && test "$ac_cv_func_wait3" = no],
300       [has_wait_nohang=no],
301       [has_wait_nohang=yes])
303 AC_CACHE_CHECK([for SA_RESTART], [make_cv_sa_restart], [
304   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
305       [[return SA_RESTART;]])],
306     [make_cv_sa_restart=yes],
307     [make_cv_sa_restart=no])])
309 AS_IF([test "$make_cv_sa_restart" != no],
310 [ AC_DEFINE([HAVE_SA_RESTART], [1],
311      [Define to 1 if <signal.h> defines the SA_RESTART constant.])
314 # Only allow jobserver on systems that support it
315 AS_CASE([/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/],
316   [*/no/*], [make_cv_job_server=no])
318 # Also supported on OS2 and MinGW
319 AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes])
321 # If we support it and the user didn't disable it, build with jobserver
322 AS_CASE([/$make_cv_job_server/$user_job_server/],
323   [*/no/*], [: no jobserver],
324   [AC_DEFINE(MAKE_JOBSERVER, 1,
325              [Define to 1 to enable job server support in GNU make.])
326   ])
328 # if we have both lstat() and readlink() then we can support symlink
329 # timechecks.
330 AS_IF([test "$ac_cv_func_lstat" = yes && test "$ac_cv_func_readlink" = yes],
331 [ AC_DEFINE([MAKE_SYMLINKS], [1],
332             [Define to 1 to enable symbolic link timestamp checking.])
335 # Find the SCCS commands, so we can include them in our default rules.
337 AC_CACHE_CHECK([for location of SCCS get command], [make_cv_path_sccs_get], [
338   AS_IF([test -f /usr/sccs/get],
339         [make_cv_path_sccs_get=/usr/sccs/get],
340         [make_cv_path_sccs_get=get])
342 AC_DEFINE_UNQUOTED([SCCS_GET], ["$make_cv_path_sccs_get"],
343                    [Define to the name of the SCCS 'get' command.])
345 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
346 AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
347    test -f s.conftest],
348 [ # We successfully created an SCCS file.
349   AC_CACHE_CHECK([if SCCS get command understands -G], [make_cv_sys_get_minus_G],
350     [AS_IF([$make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
351             test -f conftoast],
352            [make_cv_sys_get_minus_G=yes],
353            [make_cv_sys_get_minus_G=no])
354     ])
355   AS_IF([test "$make_cv_sys_get_minus_G" = yes],
356     [AC_DEFINE([SCCS_GET_MINUS_G], [1],
357      [Define to 1 if the SCCS 'get' command understands the '-G<file>' option.])
358     ])
360 rm -f s.conftest conftoast
362 # Check the system to see if it provides GNU glob.  If not, use our
363 # local version.
364 AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
365 [ AC_EGREP_CPP([gnu glob],[
366 #include <features.h>
367 #include <glob.h>
368 #include <fnmatch.h>
370 #define GLOB_INTERFACE_VERSION 1
371 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
372 # include <gnu-versions.h>
373 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
374    gnu glob
375 # endif
376 #endif],
377         [make_cv_sys_gnu_glob=yes],
378         [make_cv_sys_gnu_glob=no])])
379 AS_IF([test "$make_cv_sys_gnu_glob" = no],
380 [ GLOBINC='-I$(srcdir)/glob'
381   GLOBLIB=glob/libglob.a
383 AC_SUBST([GLOBINC])
384 AC_SUBST([GLOBLIB])
386 # Tell automake about this, so it can build the right .c files.
387 AM_CONDITIONAL([USE_LOCAL_GLOB], [test "$make_cv_sys_gnu_glob" = no])
389 # Let the makefile know what our build host is
391 AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
392 MAKE_HOST="$host"
393 AC_SUBST([MAKE_HOST])
395 w32_target_env=no
396 AM_CONDITIONAL([WINDOWSENV], [false])
398 AS_CASE([$host],
399   [*-*-mingw32],
400    [AM_CONDITIONAL([WINDOWSENV], [true])
401     w32_target_env=yes
402     AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
403     AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
404   ])
406 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
407         [Define to the character that separates directories in PATH.])
409 # Include the Maintainer's Makefile section, if it's here.
411 MAINT_MAKEFILE=/dev/null
412 AS_IF([test -r "$srcdir/maintMakefile"],
413 [ MAINT_MAKEFILE="$srcdir/maintMakefile"
415 AC_SUBST_FILE([MAINT_MAKEFILE])
417 # Allow building with dmalloc
418 AM_WITH_DMALLOC
420 # Forcibly disable SET_MAKE.  If it's set it breaks things like the test
421 # scripts, etc.
422 SET_MAKE=
424 # Sanity check and inform the user of what we found
426 AS_IF([test "x$make_badcust" = xyes], [
427 echo
428 echo "WARNING: --with-customs specified but no customs.h could be found;"
429 echo "         disabling Customs support."
430 echo
433 AS_CASE([$with_customs],
434 [""|n|no|y|ye|yes], [:],
435 [AS_IF([test -f "$with_customs/lib/libcustoms.a"], [:],
436 [ echo
437   echo "WARNING: '$with_customs/lib' does not appear to contain the"
438   echo "         Customs library.  You must build and install Customs"
439   echo "         before compiling GNU make."
440   echo
441 ])])
443 AS_IF([test "x$has_wait_nohang" = xno],
444 [ echo
445   echo "WARNING: Your system has neither waitpid() nor wait3()."
446   echo "         Without one of these, signal handling is unreliable."
447   echo "         You should be aware that running GNU make with -j"
448   echo "         could result in erratic behavior."
449   echo
452 AS_IF([test "x$make_cv_job_server" = xno && test "x$user_job_server" = xyes],
453 [ echo
454   echo "WARNING: Make job server requires a POSIX-ish system that"
455   echo "         supports the pipe(), sigaction(), and either"
456   echo "         waitpid() or wait3() functions.  Your system doesn't"
457   echo "         appear to provide one or more of those."
458   echo "         Disabling job server support."
459   echo
462 # Specify what files are to be created.
463 AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
464                  doc/Makefile w32/Makefile])
466 # OK, do it!
468 AC_OUTPUT
470 # We only generate the build.sh if we have a build.sh.in; we won't have
471 # one before we've created a distribution.
472 AS_IF([test -f "$srcdir/build.sh.in"],
473 [ ./config.status --file build.sh
474   chmod +x build.sh
477 dnl Local Variables:
478 dnl comment-start: "dnl "
479 dnl comment-end: ""
480 dnl comment-start-skip: "\\bdnl\\b\\s *"
481 dnl compile-command: "make configure config.h.in"
482 dnl End: