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