Fix K&R-isms found on SunOS 4.1.4 builds.
[make/kirr.git] / configure.in
blobbca2bd38d466ee22c67f0f40b9be72bb7fe1e3e5
1 # Process this file with autoconf to produce a configure script.
3 AC_INIT(GNU make,3.80,bug-make@gnu.org)
5 AC_PREREQ(2.54)
7 AC_REVISION([[$Id: configure.in,v 1.114 2002/10/03 05:46:12 psmith Exp $]])
9 # Autoconf setup
10 AC_CONFIG_AUX_DIR(config)
11 AC_CONFIG_SRCDIR(vpath.c)
12 AC_CONFIG_HEADERS(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.
35 AM_GNU_GETTEXT_VERSION(0.11.5)
36 AM_GNU_GETTEXT([external])
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.
41 AC_SYS_LARGEFILE
43 # Checks for libraries.
44 AC_SEARCH_LIBS(getpwnam, [sun])
46 # Checks for header files.
47 AC_HEADER_STDC
48 AC_HEADER_DIRENT
49 AC_HEADER_STAT
50 AC_HEADER_TIME
51 AC_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)
54 AM_PROG_CC_C_O
55 AM_PROG_CC_STDC
56 AC_C_CONST
57 AC_TYPE_SIGNAL
58 AC_TYPE_UID_T
59 AC_TYPE_PID_T
61 # Find some definition for uintmax_t
63 AC_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>.])])
68 # Find out whether our struct stat returns nanosecond resolution timestamps.
70 AC_STRUCT_ST_MTIM_NSEC
71 AC_MSG_CHECKING([whether to use high resolution file timestamps])
72 AC_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])
82 AC_MSG_RESULT($make_cv_file_timestamp_hi_res)
83 if test "$make_cv_file_timestamp_hi_res" = yes; then
84   val=1
85 else
86   val=0
88 AC_DEFINE_UNQUOTED(FILE_TIMESTAMP_HI_RES, $val,
89                    [Use high resolution file timestamps if nonzero.])
91 if 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
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.
105 AC_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)")])
117 if test "$ac_cv_func_gettimeofday" = yes; then
118   AC_DEFINE(HAVE_GETTIMEOFDAY, 1,
119             [Define if you have a standard gettimeofday function])
122 AC_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)
127 make_FUNC_SETVBUF_REVERSED
129 # strcoll() is used by the GNU glob library
130 AC_FUNC_STRCOLL
132 AC_FUNC_ALLOCA
133 AC_FUNC_VFORK
134 AC_FUNC_VPRINTF
135 AC_FUNC_CLOSEDIR_VOID
137 AC_FUNC_GETLOADAVG
139 # AC_FUNC_GETLOADAVG is documented to set the NLIST_STRUCT value, but it
140 # doesn't.  So, we will.
142 if 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
155 AC_DECL_SYS_SIGLIST
157 # Check out the wait reality.
158 AC_CHECK_HEADERS(sys/wait.h)
159 AC_CHECK_FUNCS(waitpid wait3)
160 AC_MSG_CHECKING(for union wait)
161 AC_CACHE_VAL(make_cv_union_wait, [dnl
162 AC_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.  */
169 if (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.  */
177 pid = waitpid (-1, &status, 0);
178 #endif
180             [make_cv_union_wait=yes], [make_cv_union_wait=no])])
181 if 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>.])
184 AC_MSG_RESULT($make_cv_union_wait)
187 # See if the user wants to use pmake's "customs" distributed build capability
189 use_customs=false
190 AC_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.
210 AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true)
212 # See if we can handle the job server feature, and if the user wants it.
214 AC_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"])
220 has_wait_nohang=yes
221 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
222   no/no) has_wait_nohang=no ;;
223 esac
225 AC_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)])
230 if test "$make_cv_sa_restart" != no; then
231   AC_DEFINE(HAVE_SA_RESTART, 1,
232      [Define if <signal.h> defines the SA_RESTART constant.])
235 case "$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.]);;
239 esac
241 # Find the SCCS commands, so we can include them in our default rules.
243 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
244 if test -f /usr/sccs/get; then
245   make_cv_path_sccs_get=/usr/sccs/get
246 else
247   make_cv_path_sccs_get=get
248 fi])
249 AC_DEFINE_UNQUOTED(SCCS_GET, ["$make_cv_path_sccs_get"], [Define to the name of the SCCS 'get' command.])
251 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
252 if ( /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
267 rm -f s.conftest conftoast
269 # Check the system to see if it provides GNU glob.  If not, use our
270 # local version.
272 AC_MSG_CHECKING(if system libc has GNU glob)
273 AC_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>
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)
287 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy])
288 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
289 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
290 make_cv_sys_gnu_glob=no])])
291 # Tell automake about this, so it can build the right .c files.
292 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
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
297 case "$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 "" ;;
307 esac
309 # Let the makefile know what our build host is
311 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
312 MAKE_HOST="$host"
313 AC_SUBST(MAKE_HOST)
315 # Include the Maintainer's Makefile section, if it's here.
317 MAINT_MAKEFILE=/dev/null
318 if test -r "$srcdir/maintMakefile"; then
319   MAINT_MAKEFILE="$srcdir/maintMakefile"
321 AC_SUBST_FILE(MAINT_MAKEFILE)
323 # Allow building with dmalloc
324 AM_WITH_DMALLOC
327 # Sanity check and inform the user of what we found
329 case "$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 ;;
334 esac
336 case "$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 ;;
347 esac
349 case "$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 ;;
356 esac
358 case "$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 ;;
366 esac
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.
373 AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile)
375 if test -f $srcdir/build.sh.in; then
376   AC_CONFIG_FILES(build.sh)
380 # OK, do it!
382 AC_OUTPUT
385 dnl Local Variables:
386 dnl comment-start: "dnl "
387 dnl comment-end: ""
388 dnl comment-start-skip: "\\bdnl\\b\\s *"
389 dnl compile-command: "make configure config.h.in"
390 dnl End: