xref: /dragonfly/contrib/bmake/configure.in (revision ca58f742)
101e196c8SJohn Marinodnl
201e196c8SJohn Marinodnl RCSid:
3ca58f742SDaniel Fojtdnl	$Id: configure.in,v 1.66 2020/07/10 16:34:38 sjg Exp $
401e196c8SJohn Marinodnl
501e196c8SJohn Marinodnl Process this file with autoconf to produce a configure script
601e196c8SJohn Marinodnl
76a91b982SJohn MarinoAC_PREREQ(2.50)
8ca58f742SDaniel FojtAC_INIT([bmake], [20200710], [sjg@NetBSD.org])
96a91b982SJohn MarinoAC_CONFIG_HEADERS(config.h)
1001e196c8SJohn Marino
115f1e34d9SAlexandre Perrindnl make srcdir absolute
125f1e34d9SAlexandre Perrincase "$srcdir" in
135f1e34d9SAlexandre Perrin/*) ;;
145f1e34d9SAlexandre Perrin*) srcdir=`cd $srcdir && pwd`;;
155f1e34d9SAlexandre Perrinesac
165f1e34d9SAlexandre Perrin
17ca58f742SDaniel Fojtdnl get _MAKE_VERSION
18ca58f742SDaniel Fojt. $srcdir/VERSION
19ca58f742SDaniel FojtOS=`uname -s`
20ca58f742SDaniel Fojt
2101e196c8SJohn Marinodnl
2201e196c8SJohn MarinoAC_ARG_WITH(defshell,
2301e196c8SJohn Marino[  --with-defshell=SHELL  use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions],
2401e196c8SJohn Marino[case "${withval}" in
2501e196c8SJohn Marinoyes)   AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;;
2601e196c8SJohn Marinono)    ;;
2701e196c8SJohn Marino*)     case "$with_defshell" in
2801e196c8SJohn Marino       sh)  DEFSHELL_INDEX=DEFSHELL_INDEX_SH;;	# it's the default anyway
2901e196c8SJohn Marino       ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;;
3001e196c8SJohn Marino       csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;;	# kidding right?
3101e196c8SJohn Marino       *)   defshell_path=$with_defshell;;	# better be sh compatible!
3201e196c8SJohn Marino       esac
3301e196c8SJohn Marino       ;;
3401e196c8SJohn Marino       esac])
3501e196c8SJohn Marinodnl
36ca58f742SDaniel Fojtcase "$OS" in
37ca58f742SDaniel FojtCYGWIN*|MINGW*) use_makefile=no;;
38ca58f742SDaniel Fojt*) use_makefile=yes;;
39ca58f742SDaniel Fojtesac
40ca58f742SDaniel FojtAC_ARG_WITH(makefile,
41ca58f742SDaniel Fojt[ --without-makefile dissable use of generated makefile],
42ca58f742SDaniel Fojt[case "${withval}" in
43ca58f742SDaniel Fojtyes|no) use_makefile=${withval};;
44ca58f742SDaniel Fojt*) AC_MSG_ERROR(bad value ${withval} given for makefile) ;;
45ca58f742SDaniel Fojtesac])
46ca58f742SDaniel Fojtdnl
4701e196c8SJohn Marinouse_meta=yes
4801e196c8SJohn MarinoAC_ARG_WITH(meta,
4901e196c8SJohn Marino[ --without-meta dissable use of meta-mode],
5001e196c8SJohn Marino[case "${withval}" in
5101e196c8SJohn Marinoyes|no) use_meta=${withval};;
5201e196c8SJohn Marino*) AC_MSG_ERROR(bad value ${withval} given for meta) ;;
5301e196c8SJohn Marinoesac])
5401e196c8SJohn Marinodnl
5501e196c8SJohn MarinoAC_ARG_WITH(filemon,
56ca58f742SDaniel Fojt[ --with-filemon={no,dev,ktrace,path/filemon.h} indicate filemon method for meta-mode. Path to filemon.h implies dev],
5701e196c8SJohn Marino[ case "/${withval}" in
58ca58f742SDaniel Fojt/no) use_filemon=no;;
59ca58f742SDaniel Fojt/*trace) filemon_h=no use_filemon="${withval}";;
60ca58f742SDaniel Fojt*/filemon.h) filemon_h="${withval}";;
6101e196c8SJohn Marino*/filemon*) filemon_h="${withval}/filemon.h";;
6201e196c8SJohn Marino*) AC_MSG_ERROR(bad value ${withval} given for filemon) ;;
63ca58f742SDaniel Fojtesac
64ca58f742SDaniel Fojtcase "$use_filemon,$filemon_h" in
65ca58f742SDaniel Fojt,*.h) use_filemon=dev;;
66ca58f742SDaniel Fojtesac
67ca58f742SDaniel Fojt],
6801e196c8SJohn Marino[
69ca58f742SDaniel Fojtcase "$OS" in
70ca58f742SDaniel FojtNetBSD) filemon_h=no use_filemon=ktrace;;
71ca58f742SDaniel Fojt*)
72ca58f742SDaniel Fojt    for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/../../sys/dev/filemon"
7301e196c8SJohn Marino    do
7401e196c8SJohn Marino        for x in "/$OS" ""
7501e196c8SJohn Marino        do
7601e196c8SJohn Marino            filemon_h="$d$x/filemon.h"
7701e196c8SJohn Marino            test -s "$filemon_h" && break
7801e196c8SJohn Marino        done
79ca58f742SDaniel Fojt        test -s "$filemon_h" && { use_filemon=dev; break; }
8001e196c8SJohn Marino    done
81ca58f742SDaniel Fojt    ;;
82ca58f742SDaniel Fojtesac
83ca58f742SDaniel Fojtuse_filemon=${use_filemon:-no}
84ca58f742SDaniel Fojtcase "$use_filemon" in
85ca58f742SDaniel Fojtdev) ;;
86ca58f742SDaniel Fojt*) filemon_h=no;;
87ca58f742SDaniel Fojtesac
8801e196c8SJohn Marino])
89ca58f742SDaniel Fojtdnl echo "Note: use_meta=$use_meta use_filemon=$use_filemon filemon_h=$filemon_h" >&6
9001e196c8SJohn Marinocase "$use_meta" in
9101e196c8SJohn Marinoyes)
92ca58f742SDaniel Fojt	case "$use_filemon" in
93ca58f742SDaniel Fojt	no) ;;
94ca58f742SDaniel Fojt	*) echo "Using: filemon_${use_filemon}.c" >&6;;
9501e196c8SJohn Marino	esac
9601e196c8SJohn Marino	;;
9701e196c8SJohn Marinoesac
9801e196c8SJohn Marinodnl
9901e196c8SJohn Marinodnl Check for OS problems
10001e196c8SJohn Marinodnl Solaris's signal.h only privides sigset_t etc if one of
10101e196c8SJohn Marinodnl _EXTENSIONS_ _POSIX_C_SOURCE or _XOPEN_SOURCE are defined.
10201e196c8SJohn Marinodnl The later two seem to cause more problems than they solve so if we
10301e196c8SJohn Marinodnl see _EXTENSIONS_ we use it.
10401e196c8SJohn MarinoAC_USE_SYSTEM_EXTENSIONS
10501e196c8SJohn Marinodnl Checks for programs.
10601e196c8SJohn MarinoAC_PROG_CC
107ca58f742SDaniel FojtAC_PROG_CC_C99
108ca58f742SDaniel Fojtdnl AC_PROG_GCC_TRADITIONAL
10901e196c8SJohn MarinoAC_PROG_INSTALL
11001e196c8SJohn Marinodnl Executable suffix - normally empty; .exe on os2.
11101e196c8SJohn MarinoAC_SUBST(ac_exe_suffix)dnl
1126a91b982SJohn Marinodnl
1136a91b982SJohn Marinodnl Hurd refuses to define PATH_MAX or MAXPATHLEN
1146a91b982SJohn Marinoif test -x /usr/bin/getconf; then
1156a91b982SJohn Marino   bmake_path_max=`getconf PATH_MAX / 2> /dev/null`
1166a91b982SJohn Marino   # only a numeric response is useful
1176a91b982SJohn Marino   test ${bmake_path_max:-0} -gt 0 2> /dev/null || bmake_path_max=
1186a91b982SJohn Marinofi
1196a91b982SJohn Marinobmake_path_max=${bmake_path_max:-1024}
1206a91b982SJohn Marinoif test $bmake_path_max -gt 1024; then
1216a91b982SJohn Marino   # this is all we expect
1226a91b982SJohn Marino   bmake_path_max=1024
1236a91b982SJohn Marinofi
1246a91b982SJohn Marinoecho "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6
1256a91b982SJohn MarinoAC_SUBST(bmake_path_max)dnl
12601e196c8SJohn Marinodnl
12701e196c8SJohn Marinodnl AC_C_CROSS
12801e196c8SJohn Marinodnl
12901e196c8SJohn Marino
13001e196c8SJohn Marinodnl Checks for header files.
131ca58f742SDaniel FojtAC_INCLUDES_DEFAULT
13201e196c8SJohn MarinoAC_HEADER_SYS_WAIT
13301e196c8SJohn MarinoAC_HEADER_DIRENT
13401e196c8SJohn Marinodnl Keep this list sorted
135f445c897SJohn MarinoAC_CHECK_HEADERS(sys/param.h)
136f445c897SJohn Marinodnl On BSDi at least we really need sys/param.h for sys/sysctl.h
137f445c897SJohn MarinoAC_CHECK_HEADERS([sys/sysctl.h], [], [],
138f445c897SJohn Marino[#ifdef HAVE_SYS_PARAM_H
139f445c897SJohn Marino# include <sys/param.h>
140f445c897SJohn Marino# endif
141f445c897SJohn Marino])
142f445c897SJohn Marino
14301e196c8SJohn MarinoAC_CHECK_HEADERS( \
14401e196c8SJohn Marino	ar.h \
14501e196c8SJohn Marino	err.h \
14601e196c8SJohn Marino	fcntl.h \
147f445c897SJohn Marino	libgen.h \
148f445c897SJohn Marino	limits.h \
14901e196c8SJohn Marino	paths.h \
15001e196c8SJohn Marino	poll.h \
15101e196c8SJohn Marino	ranlib.h \
15201e196c8SJohn Marino	sys/mman.h \
15301e196c8SJohn Marino	sys/select.h \
15401e196c8SJohn Marino	sys/socket.h \
15501e196c8SJohn Marino	sys/time.h \
15601e196c8SJohn Marino	sys/uio.h \
15701e196c8SJohn Marino	utime.h \
15801e196c8SJohn Marino	)
15901e196c8SJohn Marino
16001e196c8SJohn Marinodnl Both *BSD and Linux have sys/cdefs.h, most do not.
16101e196c8SJohn Marinodnl If it is missing, we add -I${srcdir}/missing to CFLAGS
16201e196c8SJohn Marinodnl also if sys/cdefs.h does not have __RCSID we need to use ours
16301e196c8SJohn Marinodnl but we need to include the host's one too *sigh*
16401e196c8SJohn MarinoAC_CHECK_HEADER(sys/cdefs.h,
16501e196c8SJohn Marinoecho $ECHO_N "checking whether sys/cdefs.h is compatible... $ECHO_C" >&6
16601e196c8SJohn MarinoAC_EGREP_CPP(yes,
16701e196c8SJohn Marino[#include <sys/cdefs.h>
16801e196c8SJohn Marino#ifdef __RCSID
16901e196c8SJohn Marinoyes
17001e196c8SJohn Marino#endif
17101e196c8SJohn Marino],
17201e196c8SJohn Marinoecho yes  >&6,
17301e196c8SJohn Marinoecho no  >&6; CPPFLAGS="${CPPFLAGS} -I`cd ${srcdir}/missing && pwd` -DNEED_HOST_CDEFS_H"),
17401e196c8SJohn MarinoCPPFLAGS="${CPPFLAGS} -I`cd ${srcdir}/missing && pwd`")
17501e196c8SJohn Marino
17601e196c8SJohn Marinodnl Checks for typedefs, structures, and compiler characteristics.
17701e196c8SJohn MarinoAC_C___ATTRIBUTE__
17801e196c8SJohn MarinoAC_C_BIGENDIAN
17901e196c8SJohn MarinoAC_C_CONST
180f445c897SJohn MarinoAC_TYPE_MODE_T
18101e196c8SJohn MarinoAC_TYPE_OFF_T
18201e196c8SJohn MarinoAC_TYPE_PID_T
18301e196c8SJohn MarinoAC_TYPE_SIZE_T
184f445c897SJohn MarinoAC_TYPE_UINT32_T
18501e196c8SJohn MarinoAC_DECL_SYS_SIGLIST
18601e196c8SJohn MarinoAC_HEADER_TIME
18701e196c8SJohn MarinoAC_STRUCT_TM
18801e196c8SJohn Marino
18901e196c8SJohn Marinodnl Checks for library functions.
19001e196c8SJohn MarinoAC_TYPE_SIGNAL
19101e196c8SJohn MarinoAC_FUNC_VFORK
19201e196c8SJohn MarinoAC_FUNC_VPRINTF
19301e196c8SJohn MarinoAC_FUNC_WAIT3
19401e196c8SJohn Marinodnl Keep this list sorted
19501e196c8SJohn MarinoAC_CHECK_FUNCS( \
19601e196c8SJohn Marino	err \
19701e196c8SJohn Marino	errx \
19801e196c8SJohn Marino	getcwd \
19901e196c8SJohn Marino	getenv \
20001e196c8SJohn Marino	getopt \
20101e196c8SJohn Marino	getwd \
20201e196c8SJohn Marino	killpg \
20301e196c8SJohn Marino	mmap \
20401e196c8SJohn Marino	putenv \
20501e196c8SJohn Marino	select \
20601e196c8SJohn Marino	setenv \
20701e196c8SJohn Marino	setpgid \
20801e196c8SJohn Marino	setsid \
20901e196c8SJohn Marino	sigaction \
21001e196c8SJohn Marino	sigvec \
21101e196c8SJohn Marino	snprintf \
21201e196c8SJohn Marino	strerror \
21301e196c8SJohn Marino	strftime \
21401e196c8SJohn Marino	strsep \
21501e196c8SJohn Marino	strtod \
21601e196c8SJohn Marino	strtol \
2176a91b982SJohn Marino	sysctl \
21801e196c8SJohn Marino	unsetenv \
21901e196c8SJohn Marino	vsnprintf \
22001e196c8SJohn Marino	wait3 \
22101e196c8SJohn Marino	wait4 \
22201e196c8SJohn Marino	waitpid \
22301e196c8SJohn Marino	warn \
22401e196c8SJohn Marino	warnx \
22501e196c8SJohn Marino	)
22601e196c8SJohn Marino
22701e196c8SJohn Marinodnl functions which we may need to provide
22801e196c8SJohn MarinoAC_REPLACE_FUNCS( \
22901e196c8SJohn Marino	realpath \
23001e196c8SJohn Marino	dirname \
23101e196c8SJohn Marino	stresep \
23201e196c8SJohn Marino	strlcpy \
23301e196c8SJohn Marino	)
23401e196c8SJohn Marino
23501e196c8SJohn MarinoAC_CHECK_LIB([util], [emalloc],
23601e196c8SJohn Marino    [ AC_CHECK_LIB([util], [erealloc],
23701e196c8SJohn Marino      [ AC_CHECK_LIB([util], [estrdup],
23801e196c8SJohn Marino        [ AC_CHECK_LIB([util], [estrndup],
23901e196c8SJohn Marino	  [ LIBS="$LIBS -lutil"
24001e196c8SJohn Marino	    CPPFLAGS="$CPPFLAGS -DUSE_EMALLOC" ])])])])
24101e196c8SJohn Marino
24201e196c8SJohn Marinodnl
24301e196c8SJohn Marinodnl Structures
24401e196c8SJohn Marinodnl
24501e196c8SJohn MarinoAC_HEADER_STAT
24601e196c8SJohn MarinoAC_STRUCT_ST_RDEV
24701e196c8SJohn Marinodnl
2486a91b982SJohn Marinoecho "checking if compiler supports __func__" >&6
2496a91b982SJohn MarinoAC_LANG(C)
2506a91b982SJohn MarinoAC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *func = __func__;]])],,
2516a91b982SJohn Marino	AC_DEFINE(__func__, __FUNCTION__, C99 function name))
2526a91b982SJohn Marinodnl
25301e196c8SJohn Marinodnl we want this for unit-tests/Makefile
25401e196c8SJohn Marinoecho $ECHO_N "checking if diff -u works... $ECHO_C" >&6
25501e196c8SJohn Marinoif diff -u /dev/null /dev/null > /dev/null 2>&1; then
25601e196c8SJohn Marino   diff_u=-u
25701e196c8SJohn Marino   echo yes >&6
25801e196c8SJohn Marinoelse
25901e196c8SJohn Marino   diff_u=
26001e196c8SJohn Marino   echo no >&6
26101e196c8SJohn Marinofi
26201e196c8SJohn Marinodnl
26301e196c8SJohn Marinodnl AC_* don't quite cut it.
26401e196c8SJohn Marinodnl
26501e196c8SJohn Marinoecho "checking for MACHINE & MACHINE_ARCH..." >&6
26601e196c8SJohn Marinocat > conftest.$ac_ext <<EOF
26701e196c8SJohn Marino#include "confdefs.h"
26801e196c8SJohn Marino#include <sys/param.h>
26901e196c8SJohn Marino#ifdef MACHINE
27001e196c8SJohn Marinomachine=MACHINE
27101e196c8SJohn Marino#endif
27201e196c8SJohn Marino#ifdef MACHINE_ARCH
27301e196c8SJohn Marinomachine_arch=MACHINE_ARCH
27401e196c8SJohn Marino#endif
27501e196c8SJohn MarinoEOF
27601e196c8SJohn Marino
27701e196c8SJohn Marinodefault_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 |
27801e196c8SJohn Marino	egrep machine= | tr -d ' "'`
27901e196c8SJohn Marinorm -rf conftest*
28001e196c8SJohn Marinoif test "$default_machine"; then
28101e196c8SJohn Marino	eval "$default_machine"
28201e196c8SJohn Marinofi
28301e196c8SJohn Marinomachine=${machine:-`$srcdir/machine.sh`}
28401e196c8SJohn Marinomachine_arch=${machine_arch:-`$srcdir/machine.sh arch`}
28501e196c8SJohn Marinoecho "defaults: MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
28601e196c8SJohn Marinodnl
28701e196c8SJohn Marinodnl now allow overrides
28801e196c8SJohn Marinodnl
28901e196c8SJohn MarinoAC_ARG_WITH(machine,
29001e196c8SJohn Marino[  --with-machine=MACHINE  explicitly set MACHINE],
29101e196c8SJohn Marino[case "${withval}" in
29201e196c8SJohn Marinoyes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE) ;;
29301e196c8SJohn Marinono)    ;;
29401e196c8SJohn Marinogeneric) machine=`$srcdir/machine.sh`;;
29501e196c8SJohn Marino*)     machine=$with_machine;;
29601e196c8SJohn Marinoesac])
29701e196c8SJohn Marinoforce_machine=
29801e196c8SJohn MarinoAC_ARG_WITH(force_machine,
29901e196c8SJohn Marino[  --with-force-machine=MACHINE  set FORCE_MACHINE],
30001e196c8SJohn Marino[case "${withval}" in
30101e196c8SJohn Marinoyes)   force_machine=FORCE_;;
30201e196c8SJohn Marinono)    ;;
30301e196c8SJohn Marino*)     force_machine=FORCE_; machine=$with_force_machine;;
30401e196c8SJohn Marinoesac])
30501e196c8SJohn Marinodnl
30601e196c8SJohn Marinoforce_machine_arch=
30701e196c8SJohn MarinoAC_ARG_WITH(force_machine_arch,
30801e196c8SJohn Marino[  --with-force-machine-arch=MACHINE  set FORCE_MACHINE_ARCH],
30901e196c8SJohn Marino[case "${withval}" in
31001e196c8SJohn Marinoyes)   force_machine_arch=FORCE_;;
31101e196c8SJohn Marinono)    ;;
31201e196c8SJohn Marino*)     force_machine_arch=FORCE_; machine_arch=$with_force_machine;;
31301e196c8SJohn Marinoesac])
31401e196c8SJohn Marinodnl
31501e196c8SJohn MarinoAC_ARG_WITH(machine_arch,
31601e196c8SJohn Marino[  --with-machine_arch=MACHINE_ARCH  explicitly set MACHINE_ARCH],
31701e196c8SJohn Marino[case "${withval}" in
31801e196c8SJohn Marinoyes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE_ARCH) ;;
31901e196c8SJohn Marinono)    ;;
32001e196c8SJohn Marino*)     machine_arch=$with_machine_arch;;
32101e196c8SJohn Marinoesac])
32201e196c8SJohn Marinodnl
32301e196c8SJohn Marinodnl Tell them what we ended up with
32401e196c8SJohn Marinodnl
32501e196c8SJohn Marinoecho "Using: ${force_machine}MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
32601e196c8SJohn Marinodnl
32701e196c8SJohn Marinodnl Allow folk to control _PATH_DEFSYSPATH
32801e196c8SJohn Marinodnl
32901e196c8SJohn Marinodefault_sys_path=\${prefix}/share/mk
33001e196c8SJohn MarinoAC_ARG_WITH(default-sys-path,
33101e196c8SJohn Marino[  --with-default-sys-path=PATH:DIR:LIST  use an explicit _PATH_DEFSYSPATH
33201e196c8SJohn Marino	MAKESYSPATH is a ':' separated list of directories
33301e196c8SJohn Marino	that bmake will search for system .mk files.
33401e196c8SJohn Marino	_PATH_DEFSYSPATH is its default value.],
33501e196c8SJohn Marino[case "${withval}" in
33601e196c8SJohn Marinoyes)	AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_DEFSYSPATH) ;;
33701e196c8SJohn Marinono)	;;
33801e196c8SJohn Marino*)	default_sys_path="$with_default_sys_path"
33901e196c8SJohn Marino	;;
34001e196c8SJohn Marinoesac])
34101e196c8SJohn Marinodnl
34201e196c8SJohn Marinodnl Some folk don't like this one
34301e196c8SJohn Marinodnl
34401e196c8SJohn MarinoAC_ARG_WITH(path-objdirprefix,
34501e196c8SJohn Marino[  --with-path-objdirprefix=PATH  override _PATH_OBJDIRPREFIX],
34601e196c8SJohn Marino[case "${withval}" in
34701e196c8SJohn Marinoyes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_OBJDIRPREFIX) ;;
34801e196c8SJohn Marinono)    CPPFLAGS="$CPPFLAGS -DNO_PATH_OBJDIRPREFIX" ;;
34901e196c8SJohn Marino*)     CPPFLAGS="$CPPFLAGS \"-D_PATH_OBJDIRPREFIX=\\\"$with_path-objdir\\\"\"" ;;
35001e196c8SJohn Marinoesac])
35101e196c8SJohn Marinodnl
35201e196c8SJohn Marinodnl And this can be handy to do with out.
35301e196c8SJohn Marinodnl
35401e196c8SJohn MarinoAC_ARG_ENABLE(pwd-override,
35501e196c8SJohn Marino[  --disable-pwd-override  disable \$PWD overriding getcwd()],
35601e196c8SJohn Marino[case "${enableval}" in
35701e196c8SJohn Marinoyes)   ;;
35801e196c8SJohn Marinono)    CPPFLAGS="$CPPFLAGS -DNO_PWD_OVERRIDE" ;;
35901e196c8SJohn Marino*)     AC_MSG_ERROR(bad value ${enableval} given for pwd-override option) ;;
36001e196c8SJohn Marinoesac])
36101e196c8SJohn Marinodnl
36201e196c8SJohn Marinodnl Just for grins
36301e196c8SJohn Marinodnl
36401e196c8SJohn MarinoAC_ARG_ENABLE(check-make-chdir,
36501e196c8SJohn Marino[  --disable-check-make-chdir disable make trying to guess
36601e196c8SJohn Marino	when it should automatically cd \${.CURDIR}],
36701e196c8SJohn Marino[case "${enableval}" in
36801e196c8SJohn Marinoyes)   ;;
36901e196c8SJohn Marinono)    CPPFLAGS="$CPPFLAGS -DNO_CHECK_MAKE_CHDIR" ;;
37001e196c8SJohn Marino*)     AC_MSG_ERROR(bad value ${enableval} given for check-make-chdir option) ;;
37101e196c8SJohn Marinoesac])
37201e196c8SJohn Marinodnl
37301e196c8SJohn Marinodnl On non-BSD systems, bootstrap won't work without mk
37401e196c8SJohn Marinodnl
37501e196c8SJohn MarinoAC_ARG_WITH(mksrc,
37601e196c8SJohn Marino[  --with-mksrc=PATH tell makefile.boot where to find mk src],
37701e196c8SJohn Marino[case "${withval}" in
37801e196c8SJohn Marino""|yes|no) ;;
37901e196c8SJohn Marino*) test -s $withval/install-mk && mksrc=$withval ||
38001e196c8SJohn MarinoAC_MSG_ERROR(bad value ${withval} given for mksrc cannot find install-mk)
38101e196c8SJohn Marino;;
38201e196c8SJohn Marinoesac
38301e196c8SJohn Marino])
38401e196c8SJohn Marinodnl
38501e196c8SJohn Marinodnl Now make sure we have a value
38601e196c8SJohn Marinodnl
38701e196c8SJohn Marinosrcdir=`cd $srcdir && pwd`
38801e196c8SJohn Marinofor mksrc in $mksrc $srcdir/mk $srcdir/../mk mk
38901e196c8SJohn Marinodo
39001e196c8SJohn Marino	test -s $mksrc/install-mk || continue
39101e196c8SJohn Marino	mksrc=`cd $mksrc && pwd`
39201e196c8SJohn Marino	break
39301e196c8SJohn Marinodone
39401e196c8SJohn Marinomksrc=`echo $mksrc | sed "s,$srcdir,\\\${srcdir},"`
39501e196c8SJohn Marinoecho "Using: MKSRC=$mksrc" 1>&6
39601e196c8SJohn Marinodnl On some systems we want a different default shell by default
39701e196c8SJohn Marinoif test -x /usr/xpg4/bin/sh; then
39801e196c8SJohn Marino        defshell_path=${defshell_path:-/usr/xpg4/bin/sh}
39901e196c8SJohn Marinofi
40001e196c8SJohn Marinoif test -n "$defshell_path"; then
40101e196c8SJohn Marino	echo "Using: SHELL=$defshell_path"  >&6
40201e196c8SJohn Marino	AC_DEFINE_UNQUOTED(DEFSHELL_CUSTOM, "$defshell_path", Path of default shell)
40301e196c8SJohn Marinofi
40401e196c8SJohn Marinoif test -n "$DEFSHELL_INDEX"; then
40501e196c8SJohn Marino       AC_DEFINE_UNQUOTED(DEFSHELL_INDEX, $DEFSHELL_INDEX, Shell spec to use by default)
40601e196c8SJohn Marinofi
40701e196c8SJohn Marinodnl
40801e196c8SJohn MarinoAC_SUBST(machine)
40901e196c8SJohn MarinoAC_SUBST(force_machine)
41001e196c8SJohn MarinoAC_SUBST(machine_arch)
41101e196c8SJohn MarinoAC_SUBST(mksrc)
41201e196c8SJohn MarinoAC_SUBST(default_sys_path)
41301e196c8SJohn MarinoAC_SUBST(INSTALL)
41401e196c8SJohn MarinoAC_SUBST(GCC)
41501e196c8SJohn MarinoAC_SUBST(diff_u)
41601e196c8SJohn MarinoAC_SUBST(use_meta)
417ca58f742SDaniel FojtAC_SUBST(use_filemon)
41801e196c8SJohn MarinoAC_SUBST(filemon_h)
419ca58f742SDaniel FojtAC_SUBST(_MAKE_VERSION)
420ca58f742SDaniel Fojtbm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh"
421ca58f742SDaniel Fojtif test $use_makefile = yes; then
422ca58f742SDaniel Fojt   bm_outfiles="makefile $bm_outfiles"
423ca58f742SDaniel Fojtfi
424ca58f742SDaniel FojtAC_OUTPUT($bm_outfiles)
42501e196c8SJohn Marinocat <<EOF
42601e196c8SJohn Marino
42701e196c8SJohn MarinoYou can now run
42801e196c8SJohn Marino
42901e196c8SJohn Marino	sh ./make-bootstrap.sh
43001e196c8SJohn Marino
43101e196c8SJohn Marinoto produce a fully functional bmake.
43201e196c8SJohn Marino
43301e196c8SJohn MarinoEOF
434