13955d011SMarcel Moolenaardnl 23955d011SMarcel Moolenaardnl RCSid: 3*22619282SSimon J. Gerratydnl $Id: configure.in,v 1.108 2024/07/13 15:27:00 sjg Exp $ 43955d011SMarcel Moolenaardnl 53955d011SMarcel Moolenaardnl Process this file with autoconf to produce a configure script 63955d011SMarcel Moolenaardnl 74fde40d9SSimon J. GerratyAC_PREREQ([2.71]) 8*22619282SSimon J. GerratyAC_INIT([bmake],[20240711],[sjg@NetBSD.org]) 95bcb7424SSimon J. GerratyAC_CONFIG_HEADERS(config.h) 103955d011SMarcel Moolenaar 113cbdda60SSimon J. Gerratydnl make srcdir absolute 123cbdda60SSimon J. Gerratycase "$srcdir" in 133cbdda60SSimon J. Gerraty/*) ;; 1412904384SSimon J. Gerraty*) srcdir=`cd $srcdir && 'pwd'`;; 153cbdda60SSimon J. Gerratyesac 163cbdda60SSimon J. Gerraty 17e22fef7dSSimon J. Gerratydnl get _MAKE_VERSION 18e22fef7dSSimon J. Gerraty. $srcdir/VERSION 1949caa483SSimon J. GerratyOS=`uname -s` 20e22fef7dSSimon J. Gerraty 2112904384SSimon J. Gerratydnl function to set DEFSHELL_INDEX 2212904384SSimon J. Gerratyuse_defshell() { 2312904384SSimon J. Gerraty case "$defshell_path$DEFSHELL_INDEX" in 2412904384SSimon J. Gerraty "") ;; 2512904384SSimon J. Gerraty *) return 0;; 2612904384SSimon J. Gerraty esac 2712904384SSimon J. Gerraty case "$1" in 2812904384SSimon J. Gerraty *csh) # we must be desperate 2912904384SSimon J. Gerraty DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; 30*22619282SSimon J. Gerraty *ksh*) 3112904384SSimon J. Gerraty DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;; 3298875883SSimon J. Gerraty sh|/bin/sh|*/bsh) 3312904384SSimon J. Gerraty DEFSHELL_INDEX=DEFSHELL_INDEX_SH;; 3498875883SSimon J. Gerraty *=*) # eg. sh=/bin/bsh 3598875883SSimon J. Gerraty eval `IFS="="; set -- $1; echo name=$1 defshell_path=$2` 3698875883SSimon J. Gerraty case "$name" in 3798875883SSimon J. Gerraty csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; 3898875883SSimon J. Gerraty ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;; 3998875883SSimon J. Gerraty sh) DEFSHELL_INDEX=DEFSHELL_INDEX_SH;; 4098875883SSimon J. Gerraty *) DEFSHELL_INDEX=DEFSHELL_INDEX_CUSTOM;; 4198875883SSimon J. Gerraty esac 4298875883SSimon J. Gerraty ;; 4312904384SSimon J. Gerraty *) DEFSHELL_INDEX=DEFSHELL_INDEX_CUSTOM 4412904384SSimon J. Gerraty defshell_path=$1 4512904384SSimon J. Gerraty ;; 4612904384SSimon J. Gerraty esac 4798875883SSimon J. Gerraty case "$defshell_path,$1" in 4898875883SSimon J. Gerraty ,/bin/*) ;; 4998875883SSimon J. Gerraty ,*/*) defshell_path=$1;; 5012904384SSimon J. Gerraty esac 5112904384SSimon J. Gerraty} 523955d011SMarcel Moolenaardnl 533955d011SMarcel MoolenaarAC_ARG_WITH(defshell, 5498875883SSimon J. Gerraty[ --with-defshell=[[name=]]SHELL use SHELL by default 5598875883SSimon J. Gerraty optional 'name' can be 'sh' to indicate SHELL is sh compatible 5698875883SSimon J. Gerraty eg. --with-defshell=sh=/bin/bsh 5798875883SSimon J. Gerraty use just 'sh' or 'ksh' to pick the internal definitions], 583955d011SMarcel Moolenaar[case "${withval}" in 593955d011SMarcel Moolenaaryes) AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;; 603955d011SMarcel Moolenaarno) ;; 6112904384SSimon J. Gerraty*) use_defshell $with_defshell;; 623955d011SMarcel Moolenaaresac]) 633955d011SMarcel Moolenaardnl 64548bfc56SSimon J. Gerratydnl sometimes uname -s output is not useful 65548bfc56SSimon J. GerratyFORCE_MAKE_OS= 66548bfc56SSimon J. Gerratymake_os= 6749caa483SSimon J. Gerratycase "$OS" in 68548bfc56SSimon J. GerratyCYGWIN*) 69548bfc56SSimon J. Gerraty use_makefile=no 70548bfc56SSimon J. Gerraty OS=Cygwin 71548bfc56SSimon J. Gerraty FORCE_MAKE_OS=$OS 72548bfc56SSimon J. Gerraty ;; 73548bfc56SSimon J. GerratyDarwin|MINGW*) use_makefile=no;; 7449caa483SSimon J. Gerraty*) use_makefile=yes;; 7549caa483SSimon J. Gerratyesac 76548bfc56SSimon J. Gerratyif test "x$FORCE_MAKE_OS" != x; then 77548bfc56SSimon J. Gerraty force_make_os=FORCE_ 78548bfc56SSimon J. Gerraty make_os=${FORCE_MAKE_OS} 79548bfc56SSimon J. Gerratyfi 8049caa483SSimon J. GerratyAC_ARG_WITH(makefile, 81956e45f6SSimon J. Gerraty[ --without-makefile disable use of generated makefile], 8249caa483SSimon J. Gerraty[case "${withval}" in 8349caa483SSimon J. Gerratyyes|no) use_makefile=${withval};; 8449caa483SSimon J. Gerraty*) AC_MSG_ERROR(bad value ${withval} given for makefile) ;; 8549caa483SSimon J. Gerratyesac]) 8649caa483SSimon J. Gerratydnl 873955d011SMarcel Moolenaaruse_meta=yes 883955d011SMarcel MoolenaarAC_ARG_WITH(meta, 89956e45f6SSimon J. Gerraty[ --without-meta disable use of meta-mode], 903955d011SMarcel Moolenaar[case "${withval}" in 913955d011SMarcel Moolenaaryes|no) use_meta=${withval};; 923955d011SMarcel Moolenaar*) AC_MSG_ERROR(bad value ${withval} given for meta) ;; 933955d011SMarcel Moolenaaresac]) 943955d011SMarcel Moolenaardnl 953955d011SMarcel MoolenaarAC_ARG_WITH(filemon, 9649caa483SSimon J. Gerraty[ --with-filemon={no,dev,ktrace,path/filemon.h} indicate filemon method for meta-mode. Path to filemon.h implies dev], 973955d011SMarcel Moolenaar[ case "/${withval}" in 9849caa483SSimon J. Gerraty/no) use_filemon=no;; 9949caa483SSimon J. Gerraty/*trace) filemon_h=no use_filemon="${withval}";; 10049caa483SSimon J. Gerraty*/filemon.h) filemon_h="${withval}";; 1013955d011SMarcel Moolenaar*/filemon*) filemon_h="${withval}/filemon.h";; 1023955d011SMarcel Moolenaar*) AC_MSG_ERROR(bad value ${withval} given for filemon) ;; 103ef0b2538SSimon J. Gerratyesac 104ef0b2538SSimon J. Gerratycase "$use_filemon,$filemon_h" in 105ef0b2538SSimon J. Gerraty,*.h) use_filemon=dev;; 106ef0b2538SSimon J. Gerratyesac 107ef0b2538SSimon J. Gerraty], 1083955d011SMarcel Moolenaar[ 10949caa483SSimon J. Gerratycase "$OS" in 11049caa483SSimon J. GerratyNetBSD) filemon_h=no use_filemon=ktrace;; 11149caa483SSimon J. Gerraty*) 11249caa483SSimon J. Gerraty for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/../../sys/dev/filemon" 1133955d011SMarcel Moolenaar do 1143955d011SMarcel Moolenaar for x in "/$OS" "" 1153955d011SMarcel Moolenaar do 1163955d011SMarcel Moolenaar filemon_h="$d$x/filemon.h" 1173955d011SMarcel Moolenaar test -s "$filemon_h" && break 1183955d011SMarcel Moolenaar done 11949caa483SSimon J. Gerraty test -s "$filemon_h" && { use_filemon=dev; break; } 1203955d011SMarcel Moolenaar done 12149caa483SSimon J. Gerraty ;; 12249caa483SSimon J. Gerratyesac 12349caa483SSimon J. Gerratyuse_filemon=${use_filemon:-no} 12449caa483SSimon J. Gerratycase "$use_filemon" in 12549caa483SSimon J. Gerratydev) ;; 12649caa483SSimon J. Gerraty*) filemon_h=no;; 12749caa483SSimon J. Gerratyesac 1283955d011SMarcel Moolenaar]) 129d5e0a182SSimon J. Gerratydnl some systems have broken/incomplete strftime 130d5e0a182SSimon J. GerratyAC_ARG_WITH(bmake_strftime, 131d5e0a182SSimon J. Gerraty[ --with-bmake-strftime force use of bmake strftime], 132d5e0a182SSimon J. Gerraty[case "${withval}" in 133d5e0a182SSimon J. Gerratyyes|no) bmake_strftime=$withval;; 134d5e0a182SSimon J. Gerratyesac]) 135d5e0a182SSimon J. Gerratydnl 13649caa483SSimon J. Gerratydnl echo "Note: use_meta=$use_meta use_filemon=$use_filemon filemon_h=$filemon_h" >&6 1373955d011SMarcel Moolenaarcase "$use_meta" in 1383955d011SMarcel Moolenaaryes) 13949caa483SSimon J. Gerraty case "$use_filemon" in 14049caa483SSimon J. Gerraty no) ;; 14149caa483SSimon J. Gerraty *) echo "Using: filemon_${use_filemon}.c" >&6;; 1423955d011SMarcel Moolenaar esac 1433955d011SMarcel Moolenaar ;; 1443955d011SMarcel Moolenaaresac 1453955d011SMarcel Moolenaardnl 1463955d011SMarcel Moolenaardnl Check for OS problems 14712904384SSimon J. Gerratydnl 14812904384SSimon J. Gerratydnl Minix 3 at least has bugs in headers where _NETBSD_SOURCE 14912904384SSimon J. Gerratydnl is needed for compilation 15012904384SSimon J. Gerratycase "$OS" in 15112904384SSimon J. GerratyMinix) CPPFLAGS="${CPPFLAGS} -D_NETBSD_SOURCE" 15212904384SSimon J. Gerraty test -x /usr/pkg/bin/clang && CC=${CC:-clang} 15312904384SSimon J. Gerraty ;; 15412904384SSimon J. GerratySCO_SV) # /bin/sh is not usable 15512904384SSimon J. Gerraty ALT_DEF_SHELLS="/bin/lsh /usr/bin/bash /bin/ksh" 156548bfc56SSimon J. Gerraty FORCE_USE_SHELL=1 15712904384SSimon J. Gerraty ;; 15812904384SSimon J. Gerratyesac 159548bfc56SSimon J. Gerratyif test "x$FORCE_USE_SHELL" != x; then 160548bfc56SSimon J. Gerraty CPPFLAGS="${CPPFLAGS} -DFORCE_USE_SHELL" 161548bfc56SSimon J. Gerratyfi 16212904384SSimon J. Gerratydnl 16398875883SSimon J. Gerraty# Not everyone groks TZ=Europe/Berlin 16498875883SSimon J. Gerraty# which is used by the localtime tests 16512904384SSimon J. Gerratyecho $ECHO_N "checking whether system has timezone Europe/Berlin... $ECHO_C" >&6 16698875883SSimon J. Gerratyeval `TZ=UTC date '+utc_H=%H utc_d=%d' 2> /dev/null` 16798875883SSimon J. Gerratyeval `TZ=Europe/Berlin date '+utc1_H=%H utc1_d=%d' 2> /dev/null` 168*22619282SSimon J. Gerratyif test ${utc1_d-0} = 01 -a ${utc_d-0} -gt ${utc1_d-0} || 169*22619282SSimon J. Gerraty test ${utc_d-0} -lt ${utc1_d-0} -o ${utc_H-0} -lt ${utc1_H-0}; then 17012904384SSimon J. Gerraty echo yes >&6 17112904384SSimon J. Gerraty UTC_1=Europe/Berlin 17212904384SSimon J. Gerratyelse 17398875883SSimon J. Gerraty eval `TZ=UTC-1 date '+utc1_H=%H utc1_d=%d' 2> /dev/null` 174*22619282SSimon J. Gerraty if test ${utc1_d-0} = 01 -a ${utc_d-0} -gt ${utc1_d-0} || 175*22619282SSimon J. Gerraty test ${utc_d-0} -lt ${utc1_d-0} -o ${utc_H-0} -lt ${utc1_H-0}; then 17612904384SSimon J. Gerraty UTC_1=UTC-1 17712904384SSimon J. Gerraty echo no, using UTC-1 >&6 17812904384SSimon J. Gerraty fi 17912904384SSimon J. Gerratyfi 18098875883SSimon J. Gerratytest "x$UTC_1" = x && echo no >&6 18112904384SSimon J. Gerratydnl 18212904384SSimon J. Gerratydnl Add some places to look for compilers 18312904384SSimon J. GerratyoldPATH=$PATH 18412904384SSimon J. Gerratyfor d in /usr/gnu/bin 18512904384SSimon J. Gerratydo 18612904384SSimon J. Gerraty test -d $d || continue 18712904384SSimon J. Gerraty PATH=$PATH:$d 18812904384SSimon J. Gerratydone 18912904384SSimon J. Gerratyexport PATH 1903955d011SMarcel Moolenaardnl Solaris's signal.h only privides sigset_t etc if one of 1913955d011SMarcel Moolenaardnl _EXTENSIONS_ _POSIX_C_SOURCE or _XOPEN_SOURCE are defined. 1923955d011SMarcel Moolenaardnl The later two seem to cause more problems than they solve so if we 1933955d011SMarcel Moolenaardnl see _EXTENSIONS_ we use it. 1943955d011SMarcel MoolenaarAC_USE_SYSTEM_EXTENSIONS 1953955d011SMarcel Moolenaardnl Checks for programs. 1963955d011SMarcel MoolenaarAC_PROG_CC 1973955d011SMarcel MoolenaarAC_PROG_INSTALL 19898875883SSimon J. Gerraty# We have to override that on some systems 19998875883SSimon J. Gerratycase "$OS" in 20098875883SSimon J. GerratyIRIX*) ac_INSTALL=$srcdir/install-sh;; 20198875883SSimon J. Gerratyesac 2023955d011SMarcel Moolenaardnl Executable suffix - normally empty; .exe on os2. 2033955d011SMarcel MoolenaarAC_SUBST(ac_exe_suffix)dnl 2040dede8b0SSimon J. Gerratydnl 2050dede8b0SSimon J. Gerratydnl Hurd refuses to define PATH_MAX or MAXPATHLEN 2060dede8b0SSimon J. Gerratyif test -x /usr/bin/getconf; then 2070dede8b0SSimon J. Gerraty bmake_path_max=`getconf PATH_MAX / 2> /dev/null` 208db29cad8SSimon J. Gerraty # only a numeric response is useful 209db29cad8SSimon J. Gerraty test ${bmake_path_max:-0} -gt 0 2> /dev/null || bmake_path_max= 2100dede8b0SSimon J. Gerratyfi 2110dede8b0SSimon J. Gerratybmake_path_max=${bmake_path_max:-1024} 2120dede8b0SSimon J. Gerratyif test $bmake_path_max -gt 1024; then 2130dede8b0SSimon J. Gerraty # this is all we expect 2140dede8b0SSimon J. Gerraty bmake_path_max=1024 2150dede8b0SSimon J. Gerratyfi 216d5e0a182SSimon J. Gerratyif test ${bmake_strftime:-no} = yes; then 217d5e0a182SSimon J. Gerraty CPPFLAGS="${CPPFLAGS} -DFORCE_BMAKE_STRFTIME" 218d5e0a182SSimon J. Gerratyfi 2190dede8b0SSimon J. Gerratyecho "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6 2200dede8b0SSimon J. GerratyAC_SUBST(bmake_path_max)dnl 2213955d011SMarcel Moolenaardnl 22298875883SSimon J. Gerraty# if type does not work which(1) had better! 22398875883SSimon J. Gerraty# note we cannot rely on type returning non-zero on failure 22412904384SSimon J. Gerratyif (type cat) > /dev/null 2>&1; then 22512904384SSimon J. Gerraty: which 22612904384SSimon J. Gerratywhich() { 22712904384SSimon J. Gerraty type "$@" | sed 's,[[()]],,g;s,^[[^/]][[^/]]*,,;q' 22812904384SSimon J. Gerraty} 22912904384SSimon J. Gerratyfi 23012904384SSimon J. Gerratydnl if CC is somewhere that was not in PATH we need its full path 23112904384SSimon J. Gerratydnl watch out for included flags! 23212904384SSimon J. Gerratycase "$CC" in 23312904384SSimon J. Gerraty/*) ;; 23412904384SSimon J. Gerraty*) 23512904384SSimon J. Gerraty for x in $CC 23612904384SSimon J. Gerraty do 23712904384SSimon J. Gerraty _cc=`which $x` 23812904384SSimon J. Gerraty break 23912904384SSimon J. Gerraty done 24012904384SSimon J. Gerraty if test -x ${_cc:-/dev/null}; then 24112904384SSimon J. Gerraty _cc_dir=`dirname $_cc` 24212904384SSimon J. Gerraty case ":$oldPATH:" in 24312904384SSimon J. Gerraty *:$_cc_dir:*) ;; 24412904384SSimon J. Gerraty *) CC=$_cc_dir/$CC;; 24512904384SSimon J. Gerraty esac 24612904384SSimon J. Gerraty fi 24712904384SSimon J. Gerraty ;; 24812904384SSimon J. Gerratyesac 2493955d011SMarcel Moolenaardnl Checks for header files. 2503955d011SMarcel MoolenaarAC_HEADER_SYS_WAIT 2513955d011SMarcel MoolenaarAC_HEADER_DIRENT 2523955d011SMarcel Moolenaardnl Keep this list sorted 253ac3446e9SSimon J. GerratyAC_CHECK_HEADERS(sys/param.h) 254ac3446e9SSimon J. Gerratydnl On BSDi at least we really need sys/param.h for sys/sysctl.h 255ac3446e9SSimon J. GerratyAC_CHECK_HEADERS([sys/sysctl.h], [], [], 256ac3446e9SSimon J. Gerraty[#ifdef HAVE_SYS_PARAM_H 257ac3446e9SSimon J. Gerraty# include <sys/param.h> 258ac3446e9SSimon J. Gerraty# endif 259ac3446e9SSimon J. Gerraty]) 260ac3446e9SSimon J. Gerraty 2613955d011SMarcel MoolenaarAC_CHECK_HEADERS( \ 2623955d011SMarcel Moolenaar ar.h \ 2633955d011SMarcel Moolenaar err.h \ 2643955d011SMarcel Moolenaar fcntl.h \ 265ac3446e9SSimon J. Gerraty libgen.h \ 2664c620fe5SSimon J. Gerraty limits.h \ 2673955d011SMarcel Moolenaar paths.h \ 2683955d011SMarcel Moolenaar poll.h \ 2693955d011SMarcel Moolenaar ranlib.h \ 270c59c3bf3SSimon J. Gerraty regex.h \ 2713955d011SMarcel Moolenaar sys/mman.h \ 2723955d011SMarcel Moolenaar sys/select.h \ 2733955d011SMarcel Moolenaar sys/socket.h \ 2743955d011SMarcel Moolenaar sys/time.h \ 2753955d011SMarcel Moolenaar sys/uio.h \ 2763955d011SMarcel Moolenaar utime.h \ 2773955d011SMarcel Moolenaar ) 2783955d011SMarcel Moolenaar 2793955d011SMarcel Moolenaardnl Both *BSD and Linux have sys/cdefs.h, most do not. 2803955d011SMarcel Moolenaardnl If it is missing, we add -I${srcdir}/missing to CFLAGS 28112904384SSimon J. GerratyAC_CHECK_HEADER(sys/cdefs.h,, 2823955d011SMarcel MoolenaarCPPFLAGS="${CPPFLAGS} -I`cd ${srcdir}/missing && pwd`") 2833955d011SMarcel Moolenaar 2843955d011SMarcel Moolenaardnl Checks for typedefs, structures, and compiler characteristics. 2853955d011SMarcel MoolenaarAC_C___ATTRIBUTE__ 2863955d011SMarcel MoolenaarAC_C_BIGENDIAN 2873955d011SMarcel MoolenaarAC_C_CONST 28812904384SSimon J. GerratyAC_C_INLINE 28912904384SSimon J. GerratyAC_TYPE_INT64_T 29012904384SSimon J. GerratyAC_TYPE_LONG_LONG_INT 29139ac7ef4SSimon J. GerratyAC_TYPE_MODE_T 2923955d011SMarcel MoolenaarAC_TYPE_OFF_T 2933955d011SMarcel MoolenaarAC_TYPE_PID_T 2943955d011SMarcel MoolenaarAC_TYPE_SIZE_T 295ac3446e9SSimon J. GerratyAC_TYPE_UINT32_T 2964fde40d9SSimon J. GerratyAC_CHECK_DECLS([sys_siglist],[],[],[#include <signal.h> 2974fde40d9SSimon J. Gerraty/* NetBSD declares sys_siglist in unistd.h. */ 2984fde40d9SSimon J. Gerraty#ifdef HAVE_UNISTD_H 2994fde40d9SSimon J. Gerraty# include <unistd.h> 3004fde40d9SSimon J. Gerraty#endif 3014fde40d9SSimon J. Gerraty]) 3024fde40d9SSimon J. Gerraty 3034fde40d9SSimon J. GerratyAC_CHECK_HEADERS_ONCE([sys/time.h]) 3044fde40d9SSimon J. Gerraty 3053955d011SMarcel MoolenaarAC_STRUCT_TM 3063955d011SMarcel Moolenaar 307dba7b0efSSimon J. Gerratydnl we need sig_atomic_t 308dba7b0efSSimon J. GerratyAH_TEMPLATE([sig_atomic_t],[type that signal handlers can safely frob]) 30912904384SSimon J. GerratyAC_CHECK_TYPES([sig_atomic_t],[],[], 31012904384SSimon J. Gerraty[ 311dba7b0efSSimon J. Gerraty#ifdef HAVE_SYS_TYPES_H 312dba7b0efSSimon J. Gerraty#include <sys/types.h> 313dba7b0efSSimon J. Gerraty#endif 314dba7b0efSSimon J. Gerraty#include <signal.h> 315dba7b0efSSimon J. Gerraty]) 316dba7b0efSSimon J. Gerraty 3173955d011SMarcel Moolenaardnl Checks for library functions. 3184fde40d9SSimon J. GerratyAC_FUNC_FORK 3193955d011SMarcel MoolenaarAC_FUNC_VPRINTF 3203955d011SMarcel MoolenaarAC_FUNC_WAIT3 3213955d011SMarcel Moolenaardnl Keep this list sorted 3223955d011SMarcel MoolenaarAC_CHECK_FUNCS( \ 3233955d011SMarcel Moolenaar err \ 3243955d011SMarcel Moolenaar errx \ 3253955d011SMarcel Moolenaar getcwd \ 3263955d011SMarcel Moolenaar getenv \ 3273955d011SMarcel Moolenaar getwd \ 3283955d011SMarcel Moolenaar killpg \ 3293955d011SMarcel Moolenaar putenv \ 3303955d011SMarcel Moolenaar select \ 3313955d011SMarcel Moolenaar setenv \ 3323955d011SMarcel Moolenaar setpgid \ 33312904384SSimon J. Gerraty setrlimit \ 3343955d011SMarcel Moolenaar setsid \ 33512904384SSimon J. Gerraty sigaddset \ 33612904384SSimon J. Gerraty sigpending \ 33712904384SSimon J. Gerraty sigprocmask \ 33812904384SSimon J. Gerraty sigsetmask \ 33912904384SSimon J. Gerraty sigsuspend \ 3403955d011SMarcel Moolenaar sigvec \ 3413955d011SMarcel Moolenaar snprintf \ 3423955d011SMarcel Moolenaar strerror \ 34312904384SSimon J. Gerraty stresep \ 3443955d011SMarcel Moolenaar strftime \ 3453955d011SMarcel Moolenaar strsep \ 3463955d011SMarcel Moolenaar strtod \ 3473955d011SMarcel Moolenaar strtol \ 34812904384SSimon J. Gerraty strtoll \ 34912904384SSimon J. Gerraty strtoul \ 3500dede8b0SSimon J. Gerraty sysctl \ 3513955d011SMarcel Moolenaar unsetenv \ 3523955d011SMarcel Moolenaar vsnprintf \ 3533955d011SMarcel Moolenaar wait3 \ 3543955d011SMarcel Moolenaar wait4 \ 3553955d011SMarcel Moolenaar waitpid \ 3563955d011SMarcel Moolenaar warn \ 3573955d011SMarcel Moolenaar warnx \ 3583955d011SMarcel Moolenaar ) 3593955d011SMarcel Moolenaar 3603955d011SMarcel Moolenaardnl functions which we may need to provide 3613955d011SMarcel MoolenaarAC_REPLACE_FUNCS( \ 36212904384SSimon J. Gerraty getopt \ 3633955d011SMarcel Moolenaar realpath \ 3643955d011SMarcel Moolenaar dirname \ 36512904384SSimon J. Gerraty sigaction \ 3663955d011SMarcel Moolenaar stresep \ 3673955d011SMarcel Moolenaar strlcpy \ 3683955d011SMarcel Moolenaar ) 3693955d011SMarcel Moolenaar 3703955d011SMarcel MoolenaarAC_CHECK_LIB([util], [emalloc], 3713955d011SMarcel Moolenaar [ AC_CHECK_LIB([util], [erealloc], 3723955d011SMarcel Moolenaar [ AC_CHECK_LIB([util], [estrdup], 3733955d011SMarcel Moolenaar [ AC_CHECK_LIB([util], [estrndup], 3743955d011SMarcel Moolenaar [ LIBS="$LIBS -lutil" 3753955d011SMarcel Moolenaar CPPFLAGS="$CPPFLAGS -DUSE_EMALLOC" ])])])]) 3763955d011SMarcel Moolenaar 3773955d011SMarcel Moolenaardnl 3783955d011SMarcel Moolenaardnl Structures 3793955d011SMarcel Moolenaardnl 3803955d011SMarcel MoolenaarAC_HEADER_STAT 3813955d011SMarcel Moolenaardnl 3825bcb7424SSimon J. Gerratyecho "checking if compiler supports __func__" >&6 3835bcb7424SSimon J. GerratyAC_LANG(C) 3845bcb7424SSimon J. GerratyAC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *func = __func__;]])],, 3855bcb7424SSimon J. Gerraty AC_DEFINE(__func__, __FUNCTION__, C99 function name)) 3865bcb7424SSimon J. Gerratydnl 3873955d011SMarcel Moolenaardnl we want this for unit-tests/Makefile 38812904384SSimon J. Gerratydnl GNU diff is known to support -u 38912904384SSimon J. Gerratyif test -x /usr/gnu/bin/diff; then 39012904384SSimon J. Gerraty diff=/usr/gnu/bin/diff 39112904384SSimon J. Gerraty diff_u=-u 39212904384SSimon J. Gerratyelse 39312904384SSimon J. Gerraty diff=${diff:-diff} 39412904384SSimon J. Gerraty echo $ECHO_N "checking if $diff -u works... $ECHO_C" >&6 39512904384SSimon J. Gerraty if $diff -u /dev/null /dev/null > /dev/null 2>&1; then 3963955d011SMarcel Moolenaar diff_u=-u 3973955d011SMarcel Moolenaar echo yes >&6 3983955d011SMarcel Moolenaar else 3993955d011SMarcel Moolenaar diff_u= 4003955d011SMarcel Moolenaar echo no >&6 4013955d011SMarcel Moolenaar fi 40212904384SSimon J. Gerratyfi 4033955d011SMarcel Moolenaardnl 4043955d011SMarcel Moolenaardnl AC_* don't quite cut it. 4053955d011SMarcel Moolenaardnl 4063955d011SMarcel Moolenaarecho "checking for MACHINE & MACHINE_ARCH..." >&6 4073955d011SMarcel Moolenaarcat > conftest.$ac_ext <<EOF 4083955d011SMarcel Moolenaar#include "confdefs.h" 4093955d011SMarcel Moolenaar#include <sys/param.h> 4103955d011SMarcel Moolenaar#ifdef MACHINE 4113955d011SMarcel Moolenaarmachine=MACHINE 4123955d011SMarcel Moolenaar#endif 4133955d011SMarcel Moolenaar#ifdef MACHINE_ARCH 4143955d011SMarcel Moolenaarmachine_arch=MACHINE_ARCH 4153955d011SMarcel Moolenaar#endif 4163955d011SMarcel MoolenaarEOF 4173955d011SMarcel Moolenaar 4183955d011SMarcel Moolenaardefault_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | 4194fde40d9SSimon J. Gerraty grep machine= | tr -d ' "'` 4203955d011SMarcel Moolenaarrm -rf conftest* 4213955d011SMarcel Moolenaarif test "$default_machine"; then 4223955d011SMarcel Moolenaar eval "$default_machine" 4233955d011SMarcel Moolenaarfi 4243955d011SMarcel Moolenaarmachine=${machine:-`$srcdir/machine.sh`} 4253955d011SMarcel Moolenaarmachine_arch=${machine_arch:-`$srcdir/machine.sh arch`} 4263955d011SMarcel Moolenaarecho "defaults: MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6 4273955d011SMarcel Moolenaardnl 4283955d011SMarcel Moolenaardnl now allow overrides 4293955d011SMarcel Moolenaardnl 4303955d011SMarcel MoolenaarAC_ARG_WITH(machine, 4313955d011SMarcel Moolenaar[ --with-machine=MACHINE explicitly set MACHINE], 4323955d011SMarcel Moolenaar[case "${withval}" in 4333955d011SMarcel Moolenaaryes) AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE) ;; 4343955d011SMarcel Moolenaarno) ;; 4353955d011SMarcel Moolenaargeneric) machine=`$srcdir/machine.sh`;; 4363955d011SMarcel Moolenaar*) machine=$with_machine;; 4373955d011SMarcel Moolenaaresac]) 4383955d011SMarcel Moolenaarforce_machine= 4393955d011SMarcel MoolenaarAC_ARG_WITH(force_machine, 4403955d011SMarcel Moolenaar[ --with-force-machine=MACHINE set FORCE_MACHINE], 4413955d011SMarcel Moolenaar[case "${withval}" in 4423955d011SMarcel Moolenaaryes) force_machine=FORCE_;; 4433955d011SMarcel Moolenaarno) ;; 4443955d011SMarcel Moolenaar*) force_machine=FORCE_; machine=$with_force_machine;; 4453955d011SMarcel Moolenaaresac]) 4463955d011SMarcel Moolenaardnl 4473955d011SMarcel Moolenaarforce_machine_arch= 4483955d011SMarcel MoolenaarAC_ARG_WITH(force_machine_arch, 4493955d011SMarcel Moolenaar[ --with-force-machine-arch=MACHINE set FORCE_MACHINE_ARCH], 4503955d011SMarcel Moolenaar[case "${withval}" in 4513955d011SMarcel Moolenaaryes) force_machine_arch=FORCE_;; 4523955d011SMarcel Moolenaarno) ;; 453e2eeea75SSimon J. Gerraty*) force_machine_arch=FORCE_; machine_arch=$with_force_machine_arch;; 4543955d011SMarcel Moolenaaresac]) 4553955d011SMarcel Moolenaardnl 4563955d011SMarcel MoolenaarAC_ARG_WITH(machine_arch, 4573955d011SMarcel Moolenaar[ --with-machine_arch=MACHINE_ARCH explicitly set MACHINE_ARCH], 4583955d011SMarcel Moolenaar[case "${withval}" in 4593955d011SMarcel Moolenaaryes) AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE_ARCH) ;; 4603955d011SMarcel Moolenaarno) ;; 4613955d011SMarcel Moolenaar*) machine_arch=$with_machine_arch;; 4623955d011SMarcel Moolenaaresac]) 4633955d011SMarcel Moolenaardnl 4643955d011SMarcel Moolenaardnl Tell them what we ended up with 4653955d011SMarcel Moolenaardnl 466e2eeea75SSimon J. Gerratyecho "Using: ${force_machine}MACHINE=$machine, ${force_machine_arch}MACHINE_ARCH=$machine_arch" 1>&6 4673955d011SMarcel Moolenaardnl 4683955d011SMarcel Moolenaardnl Allow folk to control _PATH_DEFSYSPATH 4693955d011SMarcel Moolenaardnl 4703955d011SMarcel Moolenaardefault_sys_path=\${prefix}/share/mk 4713955d011SMarcel MoolenaarAC_ARG_WITH(default-sys-path, 4723955d011SMarcel Moolenaar[ --with-default-sys-path=PATH:DIR:LIST use an explicit _PATH_DEFSYSPATH 4733955d011SMarcel Moolenaar MAKESYSPATH is a ':' separated list of directories 4743955d011SMarcel Moolenaar that bmake will search for system .mk files. 4753955d011SMarcel Moolenaar _PATH_DEFSYSPATH is its default value.], 4763955d011SMarcel Moolenaar[case "${withval}" in 4773955d011SMarcel Moolenaaryes) AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_DEFSYSPATH) ;; 4783955d011SMarcel Moolenaarno) ;; 4793955d011SMarcel Moolenaar*) default_sys_path="$with_default_sys_path" 4803955d011SMarcel Moolenaar ;; 4813955d011SMarcel Moolenaaresac]) 4823955d011SMarcel Moolenaardnl 4833955d011SMarcel Moolenaardnl Some folk don't like this one 4843955d011SMarcel Moolenaardnl 4853955d011SMarcel MoolenaarAC_ARG_WITH(path-objdirprefix, 4863955d011SMarcel Moolenaar[ --with-path-objdirprefix=PATH override _PATH_OBJDIRPREFIX], 4873955d011SMarcel Moolenaar[case "${withval}" in 4883955d011SMarcel Moolenaaryes) AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_OBJDIRPREFIX) ;; 4893955d011SMarcel Moolenaarno) CPPFLAGS="$CPPFLAGS -DNO_PATH_OBJDIRPREFIX" ;; 4903955d011SMarcel Moolenaar*) CPPFLAGS="$CPPFLAGS \"-D_PATH_OBJDIRPREFIX=\\\"$with_path-objdir\\\"\"" ;; 4913955d011SMarcel Moolenaaresac]) 4923955d011SMarcel Moolenaardnl 4933955d011SMarcel Moolenaardnl And this can be handy to do with out. 4943955d011SMarcel Moolenaardnl 4953955d011SMarcel MoolenaarAC_ARG_ENABLE(pwd-override, 496956e45f6SSimon J. Gerraty[ --disable-pwd-override disable $PWD overriding getcwd()], 4973955d011SMarcel Moolenaar[case "${enableval}" in 4983955d011SMarcel Moolenaaryes) ;; 4993955d011SMarcel Moolenaarno) CPPFLAGS="$CPPFLAGS -DNO_PWD_OVERRIDE" ;; 5003955d011SMarcel Moolenaar*) AC_MSG_ERROR(bad value ${enableval} given for pwd-override option) ;; 5013955d011SMarcel Moolenaaresac]) 5023955d011SMarcel Moolenaardnl 5033955d011SMarcel Moolenaardnl Just for grins 5043955d011SMarcel Moolenaardnl 5053955d011SMarcel MoolenaarAC_ARG_ENABLE(check-make-chdir, 5063955d011SMarcel Moolenaar[ --disable-check-make-chdir disable make trying to guess 507956e45f6SSimon J. Gerraty when it should automatically cd ${.CURDIR}], 5083955d011SMarcel Moolenaar[case "${enableval}" in 5093955d011SMarcel Moolenaaryes) ;; 5103955d011SMarcel Moolenaarno) CPPFLAGS="$CPPFLAGS -DNO_CHECK_MAKE_CHDIR" ;; 5113955d011SMarcel Moolenaar*) AC_MSG_ERROR(bad value ${enableval} given for check-make-chdir option) ;; 5123955d011SMarcel Moolenaaresac]) 5133955d011SMarcel Moolenaardnl 5143955d011SMarcel Moolenaardnl On non-BSD systems, bootstrap won't work without mk 5153955d011SMarcel Moolenaardnl 5163955d011SMarcel MoolenaarAC_ARG_WITH(mksrc, 5173955d011SMarcel Moolenaar[ --with-mksrc=PATH tell makefile.boot where to find mk src], 5183955d011SMarcel Moolenaar[case "${withval}" in 5193955d011SMarcel Moolenaar""|yes|no) ;; 5203955d011SMarcel Moolenaar*) test -s $withval/install-mk && mksrc=$withval || 5213955d011SMarcel MoolenaarAC_MSG_ERROR(bad value ${withval} given for mksrc cannot find install-mk) 5223955d011SMarcel Moolenaar;; 5233955d011SMarcel Moolenaaresac 5243955d011SMarcel Moolenaar]) 5253955d011SMarcel Moolenaardnl 5263955d011SMarcel Moolenaardnl Now make sure we have a value 5273955d011SMarcel Moolenaardnl 5283955d011SMarcel Moolenaarsrcdir=`cd $srcdir && pwd` 5293955d011SMarcel Moolenaarfor mksrc in $mksrc $srcdir/mk $srcdir/../mk mk 5303955d011SMarcel Moolenaardo 5313955d011SMarcel Moolenaar test -s $mksrc/install-mk || continue 5323955d011SMarcel Moolenaar mksrc=`cd $mksrc && pwd` 5333955d011SMarcel Moolenaar break 5343955d011SMarcel Moolenaardone 5353955d011SMarcel Moolenaarmksrc=`echo $mksrc | sed "s,$srcdir,\\\${srcdir},"` 5363955d011SMarcel Moolenaarecho "Using: MKSRC=$mksrc" 1>&6 5373955d011SMarcel Moolenaardnl On some systems we want a different default shell by default 53812904384SSimon J. Gerratyfor sh in /usr/xpg4/bin/sh $ALT_DEF_SHELLS 53912904384SSimon J. Gerratydo 54012904384SSimon J. Gerraty test -x $sh || continue 54112904384SSimon J. Gerraty use_defshell $sh 54212904384SSimon J. Gerraty break 54312904384SSimon J. Gerratydone 54412904384SSimon J. Gerratycase "$defshell_path$DEFSHELL_INDEX" in 54512904384SSimon J. Gerraty"") ;; 54612904384SSimon J. Gerraty*DEFSHELL_INDEX_CUSTOM) 5473955d011SMarcel Moolenaar echo "Using: SHELL=$defshell_path" >&6 5483955d011SMarcel Moolenaar AC_DEFINE_UNQUOTED(DEFSHELL_CUSTOM, "$defshell_path", Path of default shell) 54912904384SSimon J. Gerraty ;; 55012904384SSimon J. Gerraty/*INDEX*) 55112904384SSimon J. Gerraty echo "Using: SHELL=$DEFSHELL_INDEX ($defshell_path)" | sed 's,DEFSHELL_INDEX_,,' >&6 5523955d011SMarcel Moolenaar AC_DEFINE_UNQUOTED(DEFSHELL_INDEX, $DEFSHELL_INDEX, Shell spec to use by default) 55312904384SSimon J. GerratyAC_DEFINE_UNQUOTED(DEFSHELL_PATH, "$defshell_path", Path of default shell) 55412904384SSimon J. Gerraty ;; 55512904384SSimon J. Gerraty*) 55612904384SSimon J. Gerraty echo "Using: SHELL=$DEFSHELL_INDEX" | sed 's,DEFSHELL_INDEX_,,' >&6 55712904384SSimon J. Gerraty AC_DEFINE_UNQUOTED(DEFSHELL_INDEX, $DEFSHELL_INDEX, Shell spec to use by default) 55812904384SSimon J. Gerraty ;; 55912904384SSimon J. Gerratyesac 5603955d011SMarcel Moolenaardnl 5614fde40d9SSimon J. Gerratydnl Some systems have deprecated egrep in favor of grep -E 5624fde40d9SSimon J. Gerratycase "`echo bmake | egrep 'a|b' 2>&1`" in 5634fde40d9SSimon J. Gerratybmake) egrep=egrep;; 5644fde40d9SSimon J. Gerraty*) egrep='grep -E';; 5654fde40d9SSimon J. Gerratyesac 5664fde40d9SSimon J. Gerratydnl 5674fde40d9SSimon J. GerratyAC_SUBST(egrep) 568548bfc56SSimon J. GerratyAC_SUBST(make_os) 569548bfc56SSimon J. GerratyAC_SUBST(force_make_os) 5703955d011SMarcel MoolenaarAC_SUBST(machine) 5713955d011SMarcel MoolenaarAC_SUBST(force_machine) 5723955d011SMarcel MoolenaarAC_SUBST(machine_arch) 573e2eeea75SSimon J. GerratyAC_SUBST(force_machine_arch) 5743955d011SMarcel MoolenaarAC_SUBST(mksrc) 5753955d011SMarcel MoolenaarAC_SUBST(default_sys_path) 5763955d011SMarcel MoolenaarAC_SUBST(INSTALL) 5773955d011SMarcel MoolenaarAC_SUBST(GCC) 57812904384SSimon J. GerratyAC_SUBST(diff) 5793955d011SMarcel MoolenaarAC_SUBST(diff_u) 5803955d011SMarcel MoolenaarAC_SUBST(use_meta) 58149caa483SSimon J. GerratyAC_SUBST(use_filemon) 5823955d011SMarcel MoolenaarAC_SUBST(filemon_h) 583e22fef7dSSimon J. GerratyAC_SUBST(_MAKE_VERSION) 58412904384SSimon J. GerratyAC_SUBST(UTC_1) 58549caa483SSimon J. Gerratybm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh" 58649caa483SSimon J. Gerratyif test $use_makefile = yes; then 58749caa483SSimon J. Gerraty bm_outfiles="makefile $bm_outfiles" 58849caa483SSimon J. Gerratyfi 58912904384SSimon J. Gerraty 59012904384SSimon J. Gerratyhere=`'pwd'` 59112904384SSimon J. Gerraty: srcdir=$srcdir 59212904384SSimon J. Gerraty: here= $here 59312904384SSimon J. Gerratycase "$here" in 59412904384SSimon J. Gerraty$srcdir/obj*) # make sure we put unit-tests/Makefile.config in the right place 59512904384SSimon J. Gerraty obj=`basename $here` 59612904384SSimon J. Gerraty mkdir -p $srcdir/unit-tests/$obj 59712904384SSimon J. Gerraty test -d unit-tests || ln -s ../unit-tests/$obj unit-tests 59812904384SSimon J. Gerraty ;; 59912904384SSimon J. Gerratyesac 60012904384SSimon J. Gerraty 6014fde40d9SSimon J. GerratyAC_CONFIG_FILES([$bm_outfiles]) 6024fde40d9SSimon J. GerratyAC_OUTPUT 6033955d011SMarcel Moolenaarcat <<EOF 6043955d011SMarcel Moolenaar 6053955d011SMarcel MoolenaarYou can now run 6063955d011SMarcel Moolenaar 6073955d011SMarcel Moolenaar sh ./make-bootstrap.sh 6083955d011SMarcel Moolenaar 6093955d011SMarcel Moolenaarto produce a fully functional bmake. 6103955d011SMarcel Moolenaar 6113955d011SMarcel MoolenaarEOF 612