* Oops. Fix a problem running submakes like $(MAKE) $(MFLAGS).
[make.git] / configure.in
blobf642c07974e1a0300831c9d7752a1466bffa1bac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION([$Id: configure.in,v 1.83 1999/09/17 03:15:46 psmith Exp $])
3 AC_PREREQ(2.13)dnl              dnl Minimum Autoconf version required.
4 AC_INIT(vpath.c)dnl             dnl A distinctive file to look for in srcdir.
6 AM_INIT_AUTOMAKE(make, 3.78)
7 AM_CONFIG_HEADER(config.h)
9 dnl Regular configure stuff
11 AC_CANONICAL_HOST
12 AC_PROG_MAKE_SET
13 AC_PROG_CC
14 AC_PROG_INSTALL
15 AC_CHECK_PROG(AR, ar, ar, ar)
16 AC_PROG_RANLIB
17 AC_PROG_CPP                     dnl Later checks need this.
18 AC_AIX
19 AC_ISC_POSIX
20 AC_MINIX
22 AC_CHECK_PROG(PERL, perl, perl, perl)   dnl Needed for the test suite (only)
25 dnl This test must come as early as possible after the compiler configuration
26 dnl tests, because the choice of the file model can (in principle) affect
27 dnl whether functions and headers are available, whether they work, etc.
28 AC_SYS_LARGEFILE
30 AC_HEADER_STDC
31 AC_HEADER_DIRENT
32 AC_TYPE_UID_T                   dnl Also does gid_t.
33 AC_TYPE_PID_T
34 AC_TYPE_SIGNAL
35 AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/param.h fcntl.h string.h \
36                  memory.h sys/timeb.h)
37 AC_PROG_CC_C_O
38 AM_PROG_CC_STDC
39 AC_C_CONST                      dnl getopt needs this.
40 AC_HEADER_STAT
42 AC_STRUCT_ST_MTIM_NSEC
43 jm_AC_TYPE_UINTMAX_T
45 AC_SUBST(LIBOBJS)
47 AC_DEFUN(AC_CHECK_SYMBOL, [dnl
48 AC_MSG_CHECKING(for $1)
49 AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
50 AC_TRY_LINK(, [extern char *sys_siglist[]; puts(*sys_siglist);],
51             ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
52 if test "$ac_cv_check_symbol_$1" = yes; then
53 changequote(,)dnl
54   ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
55 changequote([,])dnl
56   AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
58 AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
60 # clock_gettime is in -lposix4 in Solaris 2.6.
61 AC_CHECK_LIB(posix4, clock_gettime)
63 AC_CHECK_FUNCS(memmove strdup psignal mktemp pstat_getdynamic \
64                clock_gettime dup2 getcwd sigsetmask sigaction getgroups \
65                setlinebuf seteuid setegid setreuid setregid pipe \
66                strerror strsignal)
67 AC_CHECK_SYMBOL(sys_siglist)
68 AC_FUNC_ALLOCA
69 AC_FUNC_VFORK
70 AC_FUNC_VPRINTF
71 AC_FUNC_STRCOLL
72 AC_FUNC_CLOSEDIR_VOID
73 AC_FUNC_SETVBUF_REVERSED
74 AC_FUNC_SELECT
76 AC_CHECK_LIB(kstat, kstat_open) dnl _Must_ come before AC_FUNC_GETLOADAVG.
77 AC_FUNC_GETLOADAVG
79 # Check out the wait reality.
80 AC_CHECK_HEADERS(sys/wait.h)
81 AC_CHECK_FUNCS(waitpid wait3)
82 AC_MSG_CHECKING(for union wait)
83 AC_CACHE_VAL(make_cv_union_wait, [dnl
84 AC_TRY_LINK([#include <sys/types.h>
85 #include <sys/wait.h>],
86             [union wait status; int pid; pid = wait (&status);
87 #ifdef WEXITSTATUS
88 /* Some POSIXoid systems have both the new-style macros and the old
89    union wait type, and they do not work together.  If union wait
90    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
91 if (WEXITSTATUS (status) != 0) pid = -1;
92 #ifdef WTERMSIG
93 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
94 -- blow chunks here --
95 #endif
96 #endif
97 #ifdef HAVE_WAITPID
98 /* Make sure union wait works with waitpid.  */
99 pid = waitpid (-1, &status, 0);
100 #endif
102             [make_cv_union_wait=yes], [make_cv_union_wait=no])])
103 if test "$make_cv_union_wait" = yes; then
104   AC_DEFINE(HAVE_UNION_WAIT)
106 AC_MSG_RESULT($make_cv_union_wait)
108 AC_DECL_SYS_SIGLIST
110 # The presence of the following is not meant to imply
111 # that make necessarily works on those systems.
112 AC_CHECK_LIB(sun, getpwnam)
114 AC_SUBST(REMOTE) REMOTE=stub
115 make_try_customs=no
116 AC_ARG_WITH(customs,
117 [  --with-customs=DIR      Enable remote jobs via Customs--see README.customs],
118 [case "$withval" in
119   n|no) ;;
120   *) make_cppflags="$CPPFLAGS"
121      case "$withval" in
122        y|ye|yes) ;;
123        *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
124           make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
125      esac
126      CF_NETLIBS
127      AC_CHECK_HEADER(customs.h,
128                      REMOTE=cstms
129                        LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags",
130                      with_customs=no
131                        CPPFLAGS="$make_cppflags" make_badcust=yes)
132      ;;
133 esac])
135 dnl See if we can handle the job server feature, and if the user wants it.
137 AC_ARG_ENABLE(job-server,
138   [  --disable-job-server    Disallow recursive make communication during -jN],
139   [make_cv_job_server="$enableval" user_job_server="$enableval"],
140   [make_cv_job_server="yes"])
142 has_wait_nohang=yes
143 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
144   no/no) has_wait_nohang=no ;;
145 esac
147 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$has_wait_nohang/$make_cv_job_server" in
148   yes/yes/yes/yes) AC_DEFINE(MAKE_JOBSERVER) ;;
149 esac
151 dnl Allow building with dmalloc
153 AC_ARG_ENABLE(dmalloc,
154   [  --enable-dmalloc        Enable support for the dmalloc debugging library],
155   [make_cv_dmalloc="$enableval"],
156   [make_cv_dmalloc="no"])
158 case "$make_cv_dmalloc" in
159   yes) AC_CHECK_HEADERS(dmalloc.h)
160        AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
161        CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;;
162 esac
164 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
165 if test -f /usr/sccs/get; then
166   make_cv_path_sccs_get=/usr/sccs/get
167 else
168   make_cv_path_sccs_get=get
169 fi])
170 AC_DEFINE_UNQUOTED(SCCS_GET,["$make_cv_path_sccs_get"])
172 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
173 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
174    test -f s.conftest; then
175   # We successfully created an SCCS file.
176   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
177     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
178        test -f conftoast; then
179        make_cv_sys_get_minus_G=yes
180     else
181        make_cv_sys_get_minus_G=no
182     fi])
183   case "$make_cv_sys_get_minus_G" in
184     yes) AC_DEFINE(SCCS_GET_MINUS_G);;
185   esac
187 rm -f s.conftest conftoast
189 AC_MSG_CHECKING(if system libc has GNU glob)
190 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
191  AC_TRY_CPP([
192 #include <features.h>
193 #include <glob.h>
194 #include <fnmatch.h>
196 #define GLOB_INTERFACE_VERSION 1
197 #if defined _LIBC || !defined __GNU_LIBRARY__ || __GNU_LIBRARY__ <= 1
198 # error no gnu glob
199 #else
200 # include <gnu-versions.h>
201 # if _GNU_GLOB_INTERFACE_VERSION != GLOB_INTERFACE_VERSION
202 #  error no gnu glob
203 # endif
204 #endif
205  ], make_cv_sys_gnu_glob=yes, make_cv_sys_gnu_glob=no)])
206 case "$make_cv_sys_gnu_glob" in
207   yes) AC_MSG_RESULT(yes) ;;
208   no)  AC_MSG_RESULT([no; using local copy])
209        CPPFLAGS="$CPPFLAGS -I$srcdir/glob"
210        AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
211        ;;
212 esac
214 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
215 MAKE_HOST="$host"
216 AC_SUBST(MAKE_HOST)
218 MAINT_MAKEFILE=/dev/null
219 if test -r "$srcdir/maintMakefile"; then
220   MAINT_MAKEFILE="$srcdir/maintMakefile"
222 AC_SUBST_FILE(MAINT_MAKEFILE)
224 AC_OUTPUT(build.sh Makefile glob/Makefile)
226 dnl If we don't yet have build.sh.in, build.sh is a bogus 0-length file
227 dnl so remove it.
228 dnl Can't do this because then remote builds with build.sh don't work.
229 dnl test -f build.sh.in || rm -f build.sh
232 case "$make_badcust" in
233   yes) echo
234        echo "WARNING: --with-customs specified but no customs.h could be found;"
235        echo "         disabling Customs support."
236        echo ;;
237 esac
239 case "$with_customs" in
240   ""|n|no|y|ye|yes) ;;
241   *) if test -f "$with_customs/lib/libcustoms.a"; then
242        :
243      else
244        echo
245        echo "WARNING: \`$with_customs/lib' does not appear to contain the"
246        echo "         Customs library.  You must build and install Customs"
247        echo "         before compiling GNU make."
248        echo
249      fi ;;
250 esac
252 case "$has_wait_nohang" in
253   no) echo
254       echo "WARNING: Your system has neither waitpid() nor wait3()."
255       echo "         Without one of these, signal handling is unreliable."
256       echo "         You should be aware that running GNU make with -j"
257       echo "         could result in erratic behavior."
258       echo ;;
259 esac
261 case "$make_cv_job_server/$user_job_server" in
262   no/yes) echo
263           echo "WARNING: Make job server requires a POSIX-ish system that"
264           echo "         supports the pipe(), sigaction(), and either"
265           echo "         waitpid() or wait3() functions.  Your system doesn't"
266           echo "         appear to provide one or more of those."
267           echo "         Disabling job server support."
268           echo ;;
269 esac
271 dnl Local Variables:
272 dnl comment-start: "dnl "
273 dnl comment-end: ""
274 dnl comment-start-skip: "\\bdnl\\b\\s *"
275 dnl compile-command: "make configure config.h.in"
276 dnl End: