* New config.sub and config.guess
[platform/upstream/make.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION([$Id$])
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.
5
6 AM_INIT_AUTOMAKE(make, 3.78.92)
7 AM_CONFIG_HEADER(config.h)
8
9 dnl Regular configure stuff
10
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
21
22 AC_CHECK_PROG(PERL, perl, perl, perl)   dnl Needed for the test suite (only)
23
24 dnl This test must come as early as possible after the compiler configuration
25 dnl tests, because the choice of the file model can (in principle) affect
26 dnl whether functions and headers are available, whether they work, etc.
27 AC_SYS_LARGEFILE
28
29 AC_HEADER_STDC
30 AC_HEADER_DIRENT
31 AC_TYPE_UID_T                   dnl Also does gid_t.
32 AC_TYPE_PID_T
33 AC_TYPE_SIGNAL
34 AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/param.h fcntl.h string.h \
35                  memory.h sys/timeb.h)
36 AC_PROG_CC_C_O
37 AM_PROG_CC_STDC
38 AC_C_CONST                      dnl getopt needs this.
39 AC_C_INLINE                     dnl gettext needs this.
40 AC_HEADER_STAT
41
42 AC_STRUCT_ST_MTIM_NSEC
43 jm_AC_TYPE_UINTMAX_T
44
45 AC_SUBST(LIBOBJS)
46
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})
57 fi
58 AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
59
60 # clock_gettime is in -lposix4 in Solaris 2.6.
61 AC_CHECK_LIB(posix4, clock_gettime)
62
63 AC_CHECK_FUNCS(memmove strchr memcpy strdup psignal mkstemp mktemp fdopen \
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
75
76 AC_CHECK_LIB(kstat, kstat_open) dnl _Must_ come before AC_FUNC_GETLOADAVG.
77 AC_CHECK_FUNCS(pstat_getdynamic) dnl Supposedly in AC_FUNC_GETLOADAVG, but...?
78 AC_FUNC_GETLOADAVG
79
80 # Check out the wait reality.
81 AC_CHECK_HEADERS(sys/wait.h)
82 AC_CHECK_FUNCS(waitpid wait3)
83 AC_MSG_CHECKING(for union wait)
84 AC_CACHE_VAL(make_cv_union_wait, [dnl
85 AC_TRY_LINK([#include <sys/types.h>
86 #include <sys/wait.h>],
87             [union wait status; int pid; pid = wait (&status);
88 #ifdef WEXITSTATUS
89 /* Some POSIXoid systems have both the new-style macros and the old
90    union wait type, and they do not work together.  If union wait
91    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
92 if (WEXITSTATUS (status) != 0) pid = -1;
93 #ifdef WTERMSIG
94 /* If we have WEXITSTATUS and WTERMSIG, just use them on ints.  */
95 -- blow chunks here --
96 #endif
97 #endif
98 #ifdef HAVE_WAITPID
99 /* Make sure union wait works with waitpid.  */
100 pid = waitpid (-1, &status, 0);
101 #endif
102 ],
103             [make_cv_union_wait=yes], [make_cv_union_wait=no])])
104 if test "$make_cv_union_wait" = yes; then
105   AC_DEFINE(HAVE_UNION_WAIT)
106 fi
107 AC_MSG_RESULT($make_cv_union_wait)
108
109 AC_DECL_SYS_SIGLIST
110
111 dnl Handle internationalization
112
113 ALL_LINGUAS="de es fr ko nl pl ru"
114 fp_WITH_GETTEXT
115
116 # The presence of the following is not meant to imply
117 # that make necessarily works on those systems.
118 AC_CHECK_LIB(sun, getpwnam)
119
120 AC_SUBST(REMOTE) REMOTE=stub
121 make_try_customs=no
122 AC_ARG_WITH(customs,
123 [  --with-customs=DIR      Enable remote jobs via Customs--see README.customs],
124 [case "$withval" in
125   n|no) ;;
126   *) make_cppflags="$CPPFLAGS"
127      case "$withval" in
128        y|ye|yes) ;;
129        *) CPPFLAGS="$CPPFLAGS -I$with_customs/include/customs"
130           make_ldflags="$LDFLAGS -L$with_customs/lib" ;;
131      esac
132      CF_NETLIBS
133      AC_CHECK_HEADER(customs.h,
134                      REMOTE=cstms
135                        LIBS="$LIBS -lcustoms" LDFLAGS="$make_ldflags",
136                      with_customs=no
137                        CPPFLAGS="$make_cppflags" make_badcust=yes)
138      ;;
139 esac])
140
141 dnl See if we can handle the job server feature, and if the user wants it.
142
143 AC_ARG_ENABLE(job-server,
144   [  --disable-job-server    Disallow recursive make communication during -jN],
145   [make_cv_job_server="$enableval" user_job_server="$enableval"],
146   [make_cv_job_server="yes"])
147
148 has_wait_nohang=yes
149 case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
150   no/no) has_wait_nohang=no ;;
151 esac
152
153 case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$has_wait_nohang/$make_cv_job_server" in
154   yes/yes/yes/yes) AC_DEFINE(MAKE_JOBSERVER) ;;
155 esac
156
157 dnl Allow building with dmalloc
158
159 AC_ARG_ENABLE(dmalloc,
160   [  --enable-dmalloc        Enable support for the dmalloc debugging library],
161   [make_cv_dmalloc="$enableval"],
162   [make_cv_dmalloc="no"])
163
164 case "$make_cv_dmalloc" in
165   yes) AC_CHECK_HEADERS(dmalloc.h)
166        AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
167        CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;;
168 esac
169
170 AC_CACHE_CHECK(for location of SCCS get command, make_cv_path_sccs_get, [
171 if test -f /usr/sccs/get; then
172   make_cv_path_sccs_get=/usr/sccs/get
173 else
174   make_cv_path_sccs_get=get
175 fi])
176 AC_DEFINE_UNQUOTED(SCCS_GET,["$make_cv_path_sccs_get"])
177
178 ac_clean_files="$ac_clean_files s.conftest conftoast" # Remove these later.
179 if ( /usr/sccs/admin -n s.conftest || admin -n s.conftest ) >/dev/null 2>&1 &&
180    test -f s.conftest; then
181   # We successfully created an SCCS file.
182   AC_CACHE_CHECK(if SCCS get command understands -G, make_cv_sys_get_minus_G, [
183     if $make_cv_path_sccs_get -Gconftoast s.conftest >/dev/null 2>&1 &&
184        test -f conftoast; then
185        make_cv_sys_get_minus_G=yes
186     else
187        make_cv_sys_get_minus_G=no
188     fi])
189   case "$make_cv_sys_get_minus_G" in
190     yes) AC_DEFINE(SCCS_GET_MINUS_G);;
191   esac
192 fi
193 rm -f s.conftest conftoast
194
195 AC_MSG_CHECKING(if system libc has GNU glob)
196 AC_CACHE_VAL(make_cv_sys_gnu_glob, [
197  AC_TRY_CPP([
198 #include <features.h>
199 #include <glob.h>
200 #include <fnmatch.h>
201
202 #define GLOB_INTERFACE_VERSION 1
203 #if defined _LIBC || !defined __GNU_LIBRARY__ || __GNU_LIBRARY__ <= 1
204 # error no gnu glob
205 #else
206 # include <gnu-versions.h>
207 # if _GNU_GLOB_INTERFACE_VERSION != GLOB_INTERFACE_VERSION
208 #  error no gnu glob
209 # endif
210 #endif
211  ], make_cv_sys_gnu_glob=yes, make_cv_sys_gnu_glob=no)])
212 case "$make_cv_sys_gnu_glob" in
213   yes) AC_MSG_RESULT(yes) ;;
214   no)  AC_MSG_RESULT([no; using local copy])
215        AC_SUBST(GLOBDIR) GLOBDIR=glob
216        AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'
217        AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a
218        ;;
219 esac
220
221 AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
222 MAKE_HOST="$host"
223 AC_SUBST(MAKE_HOST)
224
225 MAINT_MAKEFILE=/dev/null
226 if test -r "$srcdir/maintMakefile"; then
227   MAINT_MAKEFILE="$srcdir/maintMakefile"
228 fi
229 AC_SUBST_FILE(MAINT_MAKEFILE)
230
231 AC_OUTPUT(build.sh Makefile glob/Makefile i18n/Makefile)
232
233 dnl If we don't yet have build.sh.in, build.sh is a bogus 0-length file
234 dnl so remove it.
235 dnl Can't do this because then remote builds with build.sh don't work.
236 dnl test -f build.sh.in || rm -f build.sh
237
238
239 case "$make_badcust" in
240   yes) echo
241        echo "WARNING: --with-customs specified but no customs.h could be found;"
242        echo "         disabling Customs support."
243        echo ;;
244 esac
245
246 case "$with_customs" in
247   ""|n|no|y|ye|yes) ;;
248   *) if test -f "$with_customs/lib/libcustoms.a"; then
249        :
250      else
251        echo
252        echo "WARNING: \`$with_customs/lib' does not appear to contain the"
253        echo "         Customs library.  You must build and install Customs"
254        echo "         before compiling GNU make."
255        echo
256      fi ;;
257 esac
258
259 case "$has_wait_nohang" in
260   no) echo
261       echo "WARNING: Your system has neither waitpid() nor wait3()."
262       echo "         Without one of these, signal handling is unreliable."
263       echo "         You should be aware that running GNU make with -j"
264       echo "         could result in erratic behavior."
265       echo ;;
266 esac
267
268 case "$make_cv_job_server/$user_job_server" in
269   no/yes) echo
270           echo "WARNING: Make job server requires a POSIX-ish system that"
271           echo "         supports the pipe(), sigaction(), and either"
272           echo "         waitpid() or wait3() functions.  Your system doesn't"
273           echo "         appear to provide one or more of those."
274           echo "         Disabling job server support."
275           echo ;;
276 esac
277
278 dnl Local Variables:
279 dnl comment-start: "dnl "
280 dnl comment-end: ""
281 dnl comment-start-skip: "\\bdnl\\b\\s *"
282 dnl compile-command: "make configure config.h.in"
283 dnl End: