]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/configure.in
Import tzdata 2019c.
[FreeBSD/FreeBSD.git] / contrib / bmake / configure.in
1 dnl
2 dnl RCSid:
3 dnl     $Id: configure.in,v 1.59 2017/11/26 22:39:20 sjg Exp $
4 dnl
5 dnl Process this file with autoconf to produce a configure script
6 dnl
7 AC_PREREQ(2.50)
8 AC_INIT([bmake], [20171126], [sjg@NetBSD.org])
9 AC_CONFIG_HEADERS(config.h)
10
11 dnl make srcdir absolute
12 case "$srcdir" in
13 /*) ;;
14 *) srcdir=`cd $srcdir && pwd`;;
15 esac
16
17 dnl get _MAKE_VERSION
18 . $srcdir/VERSION
19
20 dnl
21 AC_ARG_WITH(defshell,
22 [  --with-defshell=SHELL  use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions],
23 [case "${withval}" in
24 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;;
25 no)    ;;
26 *)     case "$with_defshell" in
27        sh)  DEFSHELL_INDEX=DEFSHELL_INDEX_SH;;  # it's the default anyway
28        ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;;
29        csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; # kidding right?
30        *)   defshell_path=$with_defshell;;      # better be sh compatible!
31        esac
32        ;;
33        esac])
34 dnl
35 use_meta=yes
36 AC_ARG_WITH(meta,
37 [ --without-meta dissable use of meta-mode],
38 [case "${withval}" in
39 yes|no) use_meta=${withval};;
40 *) AC_MSG_ERROR(bad value ${withval} given for meta) ;;
41 esac])
42 dnl
43 AC_ARG_WITH(filemon,
44 [ --with-filemon=path/filemon.h indicate path to filemon.h for meta-mode],
45 [ case "/${withval}" in
46 /no|*/filemon.h) filemon_h="${withval}";;
47 */filemon*) filemon_h="${withval}/filemon.h";;
48 *) AC_MSG_ERROR(bad value ${withval} given for filemon) ;;
49 esac],
50 [
51 OS=`uname -s`
52 for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon"
53 do
54         for x in "/$OS" ""
55         do
56                 filemon_h="$d$x/filemon.h"
57                 test -s "$filemon_h" && break
58         done
59         test -s "$filemon_h" && break
60 done
61 test -s "${filemon_h:-/dev/null}" || filemon_h=no
62 ])
63 dnl echo "Note: use_meta=$use_meta filemon_h=$filemon_h" >&6
64 case "$use_meta" in
65 yes)
66         case "$filemon_h" in
67         *.h) echo "Using: filemon=$filemon_h" >&6;;
68         esac
69         ;;
70 esac
71 dnl
72 dnl Check for OS problems
73 dnl Solaris's signal.h only privides sigset_t etc if one of
74 dnl _EXTENSIONS_ _POSIX_C_SOURCE or _XOPEN_SOURCE are defined.
75 dnl The later two seem to cause more problems than they solve so if we
76 dnl see _EXTENSIONS_ we use it.
77 AC_USE_SYSTEM_EXTENSIONS
78 dnl Checks for programs.
79 AC_PROG_CC
80 AC_PROG_GCC_TRADITIONAL
81 AC_PROG_INSTALL
82 dnl Executable suffix - normally empty; .exe on os2.
83 AC_SUBST(ac_exe_suffix)dnl
84 dnl
85 dnl Hurd refuses to define PATH_MAX or MAXPATHLEN
86 if test -x /usr/bin/getconf; then
87    bmake_path_max=`getconf PATH_MAX / 2> /dev/null`
88    # only a numeric response is useful
89    test ${bmake_path_max:-0} -gt 0 2> /dev/null || bmake_path_max=
90 fi
91 bmake_path_max=${bmake_path_max:-1024}
92 if test $bmake_path_max -gt 1024; then
93    # this is all we expect
94    bmake_path_max=1024
95 fi
96 echo "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6
97 AC_SUBST(bmake_path_max)dnl
98 dnl
99 dnl AC_C_CROSS
100 dnl
101
102 dnl Checks for header files.
103 AC_HEADER_STDC
104 AC_HEADER_SYS_WAIT
105 AC_HEADER_DIRENT
106 dnl Keep this list sorted
107 AC_CHECK_HEADERS(sys/param.h)
108 dnl On BSDi at least we really need sys/param.h for sys/sysctl.h
109 AC_CHECK_HEADERS([sys/sysctl.h], [], [],
110 [#ifdef HAVE_SYS_PARAM_H
111 # include <sys/param.h>
112 # endif
113 ])
114
115 AC_CHECK_HEADERS( \
116         ar.h \
117         err.h \
118         fcntl.h \
119         libgen.h \
120         limits.h \
121         paths.h \
122         poll.h \
123         ranlib.h \
124         string.h \
125         sys/mman.h \
126         sys/select.h \
127         sys/socket.h \
128         sys/time.h \
129         sys/uio.h \
130         unistd.h \
131         utime.h \
132         )
133
134 dnl Both *BSD and Linux have sys/cdefs.h, most do not.
135 dnl If it is missing, we add -I${srcdir}/missing to CFLAGS
136 dnl also if sys/cdefs.h does not have __RCSID we need to use ours
137 dnl but we need to include the host's one too *sigh*
138 AC_CHECK_HEADER(sys/cdefs.h,
139 echo $ECHO_N "checking whether sys/cdefs.h is compatible... $ECHO_C" >&6
140 AC_EGREP_CPP(yes,
141 [#include <sys/cdefs.h>
142 #ifdef __RCSID
143 yes
144 #endif
145 ],
146 echo yes  >&6,
147 echo no  >&6; CPPFLAGS="${CPPFLAGS} -I`cd ${srcdir}/missing && pwd` -DNEED_HOST_CDEFS_H"),
148 CPPFLAGS="${CPPFLAGS} -I`cd ${srcdir}/missing && pwd`")
149
150 dnl Checks for typedefs, structures, and compiler characteristics.
151 AC_C___ATTRIBUTE__
152 AC_C_BIGENDIAN
153 AC_C_CONST
154 AC_TYPE_MODE_T
155 AC_TYPE_OFF_T
156 AC_TYPE_PID_T
157 AC_TYPE_SIZE_T
158 AC_TYPE_UINT32_T
159 AC_DECL_SYS_SIGLIST
160 AC_HEADER_TIME
161 AC_STRUCT_TM
162
163 dnl Checks for library functions.
164 AC_TYPE_SIGNAL
165 AC_FUNC_VFORK
166 AC_FUNC_VPRINTF
167 AC_FUNC_WAIT3
168 dnl Keep this list sorted
169 AC_CHECK_FUNCS( \
170         err \
171         errx \
172         getcwd \
173         getenv \
174         getopt \
175         getwd \
176         killpg \
177         mmap \
178         putenv \
179         select \
180         setenv \
181         setpgid \
182         setsid \
183         sigaction \
184         sigvec \
185         snprintf \
186         strerror \
187         strftime \
188         strsep \
189         strtod \
190         strtol \
191         sysctl \
192         unsetenv \
193         vsnprintf \
194         wait3 \
195         wait4 \
196         waitpid \
197         warn \
198         warnx \
199         )
200
201 dnl functions which we may need to provide
202 AC_REPLACE_FUNCS( \
203         realpath \
204         dirname \
205         stresep \
206         strlcpy \
207         )
208
209 AC_CHECK_LIB([util], [emalloc],
210     [ AC_CHECK_LIB([util], [erealloc],
211       [ AC_CHECK_LIB([util], [estrdup],
212         [ AC_CHECK_LIB([util], [estrndup],
213           [ LIBS="$LIBS -lutil"
214             CPPFLAGS="$CPPFLAGS -DUSE_EMALLOC" ])])])])
215
216 dnl
217 dnl Structures
218 dnl
219 AC_HEADER_STAT
220 AC_STRUCT_ST_RDEV
221 dnl
222 echo "checking if compiler supports __func__" >&6
223 AC_LANG(C)
224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *func = __func__;]])],,
225         AC_DEFINE(__func__, __FUNCTION__, C99 function name))
226 dnl
227 dnl we want this for unit-tests/Makefile
228 echo $ECHO_N "checking if diff -u works... $ECHO_C" >&6
229 if diff -u /dev/null /dev/null > /dev/null 2>&1; then
230    diff_u=-u
231    echo yes >&6
232 else
233    diff_u=
234    echo no >&6
235 fi
236 dnl
237 dnl AC_* don't quite cut it.
238 dnl 
239 echo "checking for MACHINE & MACHINE_ARCH..." >&6
240 cat > conftest.$ac_ext <<EOF
241 #include "confdefs.h"
242 #include <sys/param.h>
243 #ifdef MACHINE
244 machine=MACHINE
245 #endif
246 #ifdef MACHINE_ARCH
247 machine_arch=MACHINE_ARCH
248 #endif
249 EOF
250
251 default_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | 
252         egrep machine= | tr -d ' "'`
253 rm -rf conftest*
254 if test "$default_machine"; then
255         eval "$default_machine"
256 fi
257 machine=${machine:-`$srcdir/machine.sh`}
258 machine_arch=${machine_arch:-`$srcdir/machine.sh arch`}
259 echo "defaults: MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
260 dnl
261 dnl now allow overrides
262 dnl
263 AC_ARG_WITH(machine,
264 [  --with-machine=MACHINE  explicitly set MACHINE],
265 [case "${withval}" in
266 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE) ;;
267 no)    ;;
268 generic) machine=`$srcdir/machine.sh`;;
269 *)     machine=$with_machine;;
270 esac])
271 force_machine=
272 AC_ARG_WITH(force_machine,
273 [  --with-force-machine=MACHINE  set FORCE_MACHINE],
274 [case "${withval}" in
275 yes)   force_machine=FORCE_;;
276 no)    ;;
277 *)     force_machine=FORCE_; machine=$with_force_machine;;
278 esac])
279 dnl
280 force_machine_arch=
281 AC_ARG_WITH(force_machine_arch,
282 [  --with-force-machine-arch=MACHINE  set FORCE_MACHINE_ARCH],
283 [case "${withval}" in
284 yes)   force_machine_arch=FORCE_;;
285 no)    ;;
286 *)     force_machine_arch=FORCE_; machine_arch=$with_force_machine;;
287 esac])
288 dnl
289 AC_ARG_WITH(machine_arch,
290 [  --with-machine_arch=MACHINE_ARCH  explicitly set MACHINE_ARCH],
291 [case "${withval}" in
292 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE_ARCH) ;;
293 no)    ;;
294 *)     machine_arch=$with_machine_arch;;
295 esac])
296 dnl
297 dnl Tell them what we ended up with
298 dnl
299 echo "Using: ${force_machine}MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
300 dnl
301 dnl Allow folk to control _PATH_DEFSYSPATH
302 dnl
303 default_sys_path=\${prefix}/share/mk
304 AC_ARG_WITH(default-sys-path,
305 [  --with-default-sys-path=PATH:DIR:LIST  use an explicit _PATH_DEFSYSPATH
306         MAKESYSPATH is a ':' separated list of directories 
307         that bmake will search for system .mk files. 
308         _PATH_DEFSYSPATH is its default value.],
309 [case "${withval}" in
310 yes)    AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_DEFSYSPATH) ;;
311 no)     ;;
312 *)      default_sys_path="$with_default_sys_path"
313         ;;
314 esac])
315 dnl
316 dnl Some folk don't like this one
317 dnl
318 AC_ARG_WITH(path-objdirprefix,
319 [  --with-path-objdirprefix=PATH  override _PATH_OBJDIRPREFIX],
320 [case "${withval}" in
321 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_OBJDIRPREFIX) ;;
322 no)    CPPFLAGS="$CPPFLAGS -DNO_PATH_OBJDIRPREFIX" ;;
323 *)     CPPFLAGS="$CPPFLAGS \"-D_PATH_OBJDIRPREFIX=\\\"$with_path-objdir\\\"\"" ;;
324 esac])
325 dnl
326 dnl And this can be handy to do with out.
327 dnl
328 AC_ARG_ENABLE(pwd-override,
329 [  --disable-pwd-override  disable \$PWD overriding getcwd()],
330 [case "${enableval}" in
331 yes)   ;;
332 no)    CPPFLAGS="$CPPFLAGS -DNO_PWD_OVERRIDE" ;;
333 *)     AC_MSG_ERROR(bad value ${enableval} given for pwd-override option) ;;
334 esac])
335 dnl
336 dnl Just for grins
337 dnl
338 AC_ARG_ENABLE(check-make-chdir,
339 [  --disable-check-make-chdir disable make trying to guess 
340         when it should automatically cd \${.CURDIR}],
341 [case "${enableval}" in
342 yes)   ;;
343 no)    CPPFLAGS="$CPPFLAGS -DNO_CHECK_MAKE_CHDIR" ;;
344 *)     AC_MSG_ERROR(bad value ${enableval} given for check-make-chdir option) ;;
345 esac])
346 dnl
347 dnl On non-BSD systems, bootstrap won't work without mk
348 dnl
349 AC_ARG_WITH(mksrc,
350 [  --with-mksrc=PATH tell makefile.boot where to find mk src],
351 [case "${withval}" in
352 ""|yes|no) ;;
353 *) test -s $withval/install-mk && mksrc=$withval ||
354 AC_MSG_ERROR(bad value ${withval} given for mksrc cannot find install-mk)
355 ;;
356 esac
357 ])
358 dnl
359 dnl Now make sure we have a value
360 dnl
361 srcdir=`cd $srcdir && pwd`
362 for mksrc in $mksrc $srcdir/mk $srcdir/../mk mk
363 do
364         test -s $mksrc/install-mk || continue
365         mksrc=`cd $mksrc && pwd`
366         break
367 done
368 mksrc=`echo $mksrc | sed "s,$srcdir,\\\${srcdir},"`
369 echo "Using: MKSRC=$mksrc" 1>&6
370 dnl On some systems we want a different default shell by default
371 if test -x /usr/xpg4/bin/sh; then
372         defshell_path=${defshell_path:-/usr/xpg4/bin/sh}
373 fi
374 if test -n "$defshell_path"; then
375         echo "Using: SHELL=$defshell_path"  >&6
376         AC_DEFINE_UNQUOTED(DEFSHELL_CUSTOM, "$defshell_path", Path of default shell)
377 fi
378 if test -n "$DEFSHELL_INDEX"; then
379        AC_DEFINE_UNQUOTED(DEFSHELL_INDEX, $DEFSHELL_INDEX, Shell spec to use by default)
380 fi        
381 dnl
382 AC_SUBST(machine)
383 AC_SUBST(force_machine)
384 AC_SUBST(machine_arch)
385 AC_SUBST(mksrc)
386 AC_SUBST(default_sys_path)
387 AC_SUBST(INSTALL)
388 AC_SUBST(GCC)
389 AC_SUBST(diff_u)
390 AC_SUBST(use_meta)
391 AC_SUBST(filemon_h)
392 AC_SUBST(_MAKE_VERSION)
393 AC_OUTPUT(makefile Makefile.config make-bootstrap.sh unit-tests/Makefile)
394
395 cat <<EOF
396
397 You can now run
398
399         sh ./make-bootstrap.sh
400
401 to produce a fully functional bmake.
402
403 EOF