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