1# Process this file with autoconf to produce a configure script.
2
3AC_INIT(GNU make,3.80,bug-make@gnu.org)
4
5AC_PREREQ(2.54)
6
7AC_REVISION([[$Id: configure.in,v 1.1.1.1 2006/03/29 21:09:20 jmc Exp $]])
8
9# Autoconf setup
10AC_CONFIG_AUX_DIR(config)
11AC_CONFIG_SRCDIR(vpath.c)
12AC_CONFIG_HEADERS(config.h)
13
14# Automake setup
15AM_INIT_AUTOMAKE
16AC_PROG_MAKE_SET
17
18# Checks for programs.
19AC_PROG_CC
20AC_PROG_INSTALL
21AC_PROG_RANLIB
22AC_PROG_CPP
23AC_CHECK_PROG(AR, ar, ar, ar)
24# Perl is needed for the test suite (only)
25AC_CHECK_PROG(PERL, perl, perl, perl)
26
27# Specialized system macros
28AC_CANONICAL_HOST
29AC_AIX
30AC_ISC_POSIX
31AC_MINIX
32
33# Enable gettext, in "external" mode.
34
35AM_GNU_GETTEXT_VERSION(0.11.5)
36AM_GNU_GETTEXT([external])
37
38# This test must come as early as possible after the compiler configuration
39# tests, because the choice of the file model can (in principle) affect
40# whether functions and headers are available, whether they work, etc.
41AC_SYS_LARGEFILE
42
43# Checks for libraries.
44AC_SEARCH_LIBS(getpwnam, [sun])
45
46# Checks for header files.
47AC_HEADER_STDC
48AC_HEADER_DIRENT
49AC_HEADER_STAT
50AC_HEADER_TIME
51AC_CHECK_HEADERS(stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
52		 memory.h sys/param.h sys/time.h sys/timeb.h)
53
54AM_PROG_CC_C_O
55AM_PROG_CC_STDC
56AC_C_CONST
57AC_TYPE_SIGNAL
58AC_TYPE_UID_T
59AC_TYPE_PID_T
60
61# Find some definition for uintmax_t
62
63AC_CHECK_TYPE(uintmax_t,,[
64  uintmax_t="unsigned long"
65  AC_CHECK_TYPE(unsigned long long,[uintmax_t="unsigned long long"])
66  AC_DEFINE_UNQUOTED(uintmax_t,$uintmax_t,[Define uintmax_t if not defined in <stdint.h> or <inttypes.h>.])])
67
68# Find out whether our struct stat returns nanosecond resolution timestamps.
69
70AC_STRUCT_ST_MTIM_NSEC
71AC_MSG_CHECKING([whether to use high resolution file timestamps])
72AC_CACHE_VAL(make_cv_file_timestamp_hi_res, [
73  make_cv_file_timestamp_hi_res=no
74  if test "$ac_cv_struct_st_mtim_nsec" != no; then
75    AC_TRY_COMPILE([
76#	if HAVE_INTTYPES_H
77#	 include <inttypes.h>
78#	endif],
79      [char a[0x7fffffff < (uintmax_t) -1 >> 30 ? 1 : -1];],
80      make_cv_file_timestamp_hi_res=yes)
81  fi])
82AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
83if test "$make_cv_file_timestamp_hi_res" = yes; then
84  val=1
85else
86  val=0
87fi
88AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
89		   [Use high resolution file timestamps if nonzero.])
90
91if test "$make_cv_file_timestamp_hi_res" = yes; then
92  # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
93  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
94  AC_SEARCH_LIBS(clock_gettime, [rt posix4])
95  if test "$ac_cv_search_clock_gettime" != no; then
96    AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
97	      [Define if you have the clock_gettime function.])
98  fi
99fi
100
101
102# See if we have a standard version of gettimeofday().  Since actual
103# implementations can differ, just make sure we have the most common
104# one.
105AC_CACHE_CHECK([for standard gettimeofday], ac_cv_func_gettimeofday,
106  [ac_cv_func_gettimeofday=no
107   AC_TRY_RUN([#include <sys/time.h>
108	       int main ()
109	       {
110		 struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
111		 exit (gettimeofday (&t, 0) != 0
112		       || t.tv_sec < 0 || t.tv_usec < 0);
113	       }],
114	      ac_cv_func_gettimeofday=yes,
115	      ac_cv_func_gettimeofday=no,
116	      ac_cv_func_gettimeofday="no (cross-compiling)")])
117if test "$ac_cv_func_gettimeofday" = yes; then
118  AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
119	    [Define if you have a standard gettimeofday function])
120fi
121
122AC_CHECK_FUNCS(	memcpy memmove strchr strdup mkstemp mktemp fdopen \
123	        bsd_signal dup2 getcwd sigsetmask sigaction getgroups \
124		seteuid setegid setlinebuf setreuid setregid setvbuf pipe \
125		strerror strsignal)
126
127make_FUNC_SETVBUF_REVERSED
128
129# strcoll() is used by the GNU glob library
130AC_FUNC_STRCOLL
131
132AC_FUNC_ALLOCA
133AC_FUNC_VFORK
134AC_FUNC_VPRINTF
135AC_FUNC_CLOSEDIR_VOID
136
137AC_FUNC_GETLOADAVG
138
139# AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
140# doesn't.  So, we will.
141
142if test "$ac_cv_header_nlist_h" = yes; then
143  AC_TRY_COMPILE([#include <nlist.h>],
144      [struct nlist nl;
145       nl.n_name = "string";
146       return 0;],
147      make_cv_nlist_struct=yes,
148      make_cv_nlist_struct=no)
149  if test "$make_cv_nlist_struct" = yes; then
150    AC_DEFINE(NLIST_STRUCT, 1,
151       [Define if struct nlist.n_name is a pointer rather than an array.])
152  fi
153fi
154
155AC_DECL_SYS_SIGLIST
156
157# Check out the wait reality.
158AC_CHECK_HEADERS(sys/wait.h)
159AC_CHECK_FUNCS(waitpid wait3)
160AC_MSG_CHECKING(for union wait)
161AC_CACHE_VAL(make_cv_union_wait, [dnl
162AC_TRY_LINK([#include <sys/types.h>
163#include <sys/wait.h>],
164	    [union wait status; int pid; pid = wait (&status);
165#ifdef WEXITSTATUS
166/* Some POSIXoid systems have both the new-style macros and the old
167   union wait type, and they do not work together.  If union wait
168   conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
169if (WEXITSTATUS (status) != 0) pid = -1;
170#ifdef WTERMSIG
171/* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
172-- blow chunks here --
173#endif
174#endif
175#ifdef HAVE_WAITPID
176/* Make sure union wait works with waitpid.  */
177pid = waitpid (-1, &status, 0);
178#endif
179],
180	    [make_cv_union_wait=yes], [make_cv_union_wait=no])])
181if test "$make_cv_union_wait" = yes; then
182  AC_DEFINE(HAVE_UNION_WAIT, 1, [Define this if you have the \`union wait' type in <sys/wait.h>.])
183fi
184AC_MSG_RESULT($make_cv_union_wait)
185
186
187# See if the user wants to use pmake's "customs" distributed build capability
188
189use_customs=false
190AC_ARG_WITH(customs,
191  AC_HELP_STRING([--with-customs=DIR],
192		 [enable remote jobs via Customs--see README.customs]),
193  [case $withval in
194    n|no) : ;;
195    *) make_cppflags="$CPPFLAGS"
196       case $withval in
197	 y|ye|yes) : ;;
198	 *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
199	    make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
200       esac
201       CF_NETLIBS
202       AC_CHECK_HEADER(customs.h,
203		       [use_customs=true
204			 LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags"],
205		       [with_customs=no
206			 CPPFLAGS="$make_cppflags" make_badcust=yes])
207       ;;
208  esac])
209# Tell automake about this, so it can include the right .c files.
210AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
211
212# See if we can handle the job server feature, and if the user wants it.
213
214AC_ARG_ENABLE(job-server,
215  AC_HELP_STRING([--disable-job-server],
216                 [disallow recursive make communication during -jN]),
217  [make_cv_job_server="$enableval" user_job_server="$enableval"],
218  [make_cv_job_server="yes"])
219
220has_wait_nohang=yes
221case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
222  no/no) has_wait_nohang=no ;;
223esac
224
225AC_CACHE_CHECK(for SA_RESTART, make_cv_sa_restart, [
226  AC_TRY_COMPILE([#include <signal.h>],
227      [return SA_RESTART;],
228      make_cv_sa_restart=yes,
229      make_cv_sa_restart=no)])
230if test "$make_cv_sa_restart" != no; then
231  AC_DEFINE(HAVE_SA_RESTART, 1,
232     [Define if <signal.h> defines the SA_RESTART constant.])
233fi
234
235case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
236  yes/yes/yes/yes/yes)
237    AC_DEFINE(MAKE_JOBSERVER, 1,
238              [Define this to enable job server support in GNU make.]);;
239esac
240
241# Find the SCCS commands, so we can include them in our default rules.
242
243AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
244if test -f /usr/sccs/get; then
245  make_cv_path_sccs_get=/usr/sccs/get
246else
247  make_cv_path_sccs_get=get
248fi])
249AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.])
250
251ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
252if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
253   test -f s.conftest; then
254  # We successfully created an SCCS file.
255  AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
256    if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
257       test -f conftoast; then
258       make_cv_sys_get_minus_G=yes
259    else
260       make_cv_sys_get_minus_G=no
261    fi])
262  case "$make_cv_sys_get_minus_G" in
263    yes) AC_DEFINE(SCCS_GET_MINUS_G, 1,
264           [Define this if the SCCS 'get' command understands the '-G<file>' option.]);;
265  esac
266fi
267rm -f s.conftest conftoast
268
269# Check the system to see if it provides GNU glob.  If not, use our
270# local version.
271
272AC_MSG_CHECKING(if system libc has GNU glob)
273AC_CACHE_VAL(make_cv_sys_gnu_glob, [
274 AC_EGREP_CPP(gnu glob,[
275#include <features.h>
276#include <glob.h>
277#include <fnmatch.h>
278
279#define GLOB_INTERFACE_VERSION 1
280#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
281# include <gnu-versions.h>
282# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
283   gnu glob
284# endif
285#endif
286 ], [AC_MSG_RESULT(yes)
287make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
288AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
289AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
290make_cv_sys_gnu_glob=no])])
291# Tell automake about this, so it can build the right .c files.
292AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
293
294# PTX systems have a broken implementation of SA_RESTART.  I know of
295# no way to test for this behavior, so I'll just test for PTX
296
297case "$host" in
298  i386-sequent-sysv4)
299    AC_DEFINE(HAVE_BROKEN_RESTART, 1, [This system has SA_RESTART, but it doesn't work properly.])
300    echo ""
301    echo "WARNING: The SA_RESTART sigaction() flag does not work on PTX."
302    echo "         This causes 'make -j' to fail at random times."
303    echo "         I am installing a workaround, which is mostly but not 100%"
304    echo "         effective.  If you see random failures during 'make -j'"
305    echo "         you should either contact the bug list, or not use -j."
306    echo "" ;;
307esac
308
309# Let the makefile know what our build host is
310
311AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
312MAKE_HOST="$host"
313AC_SUBST(MAKE_HOST)
314
315# Include the Maintainer's Makefile section, if it's here.
316
317MAINT_MAKEFILE=/dev/null
318if test -r "$srcdir/maintMakefile"; then
319  MAINT_MAKEFILE="$srcdir/maintMakefile"
320fi
321AC_SUBST_FILE(MAINT_MAKEFILE)
322
323# Allow building with dmalloc
324AM_WITH_DMALLOC
325
326
327# Sanity check and inform the user of what we found
328
329case "$make_badcust" in
330  yes) echo
331       echo "WARNING: --with-customs specified but no customs.h could be found;"
332       echo "         disabling Customs support."
333       echo ;;
334esac
335
336case "$with_customs" in
337  ""|n|no|y|ye|yes) ;;
338  *) if test -f "$with_customs/lib/libcustoms.a"; then
339       :
340     else
341       echo
342       echo "WARNING: '$with_customs/lib' does not appear to contain the"
343       echo "         Customs library.  You must build and install Customs"
344       echo "         before compiling GNU make."
345       echo
346     fi ;;
347esac
348
349case "$has_wait_nohang" in
350  no) echo
351      echo "WARNING: Your system has neither waitpid() nor wait3()."
352      echo "         Without one of these, signal handling is unreliable."
353      echo "         You should be aware that running GNU make with -j"
354      echo "         could result in erratic behavior."
355      echo ;;
356esac
357
358case "$make_cv_job_server/$user_job_server" in
359  no/yes) echo
360	  echo "WARNING: Make job server requires a POSIX-ish system that"
361	  echo "         supports the pipe(), sigaction(), and either"
362          echo "         waitpid() or wait3() functions.  Your system doesn't"
363	  echo "         appear to provide one or more of those."
364	  echo "         Disabling job server support."
365          echo ;;
366esac
367
368
369# Specify what files are to be created.
370# We only generate the build.sh if we have a build.sh.in; we won't have
371# one before we've created a distribution.
372
373AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
374
375if test -f $srcdir/build.sh.in; then
376  AC_CONFIG_FILES(build.sh)
377fi
378
379
380# OK, do it!
381
382AC_OUTPUT
383
384
385dnl Local Variables:
386dnl comment-start: "dnl "
387dnl comment-end: ""
388dnl comment-start-skip: "\\bdnl\\b\\s *"
389dnl compile-command: "make configure config.h.in"
390dnl End:
391