summaryrefslogtreecommitdiff
path: root/bootstrap/bmake/configure.in
blob: 28745d10c5e95940a703ed060a55c210e560ca68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
dnl
dnl RCSid:
dnl	$Id: configure.in,v 1.1.1.1 2004/03/11 13:04:07 grant Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_INIT(makefile.boot.in)
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
dnl Check for OS problems
AC_AIX
AC_MINIX
AC_ISC_POSIX
dnl Executable suffix - normally empty; .exe on os2.
AC_SUBST(ac_exe_suffix)dnl

dnl
dnl AC_C_CROSS
dnl

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_CHECK_HEADERS(ar.h ranlib.h fcntl.h paths.h sys/select.h sys/time.h unistd.h string.h utime.h poll.h sys/uio.h)

dnl Both *BSD and Linux have sys/cdefs.h, most do not.
dnl If it is missing, we add -I${srcdir}/missing to CFLAGS
dnl also if sys/cdefs.h does not have __RCSID we need to use ours
dnl but we need to include the host's one too *sigh*
AC_CHECK_HEADER(sys/cdefs.h,
echo $ac_n "checking whether sys/cdefs.h is compatible... $ac_c" 2>&6
AC_EGREP_CPP(yes,
[#include <sys/cdefs.h>
#ifdef __RCSID
yes
#endif
],
echo yes  2>&6,
echo no  2>&6; CPPFLAGS="${CPPFLAGS} -I\${srcdir}/missing -DNEED_HOST_CDEFS_H"),
CPPFLAGS="${CPPFLAGS} -I\${srcdir}/missing")

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C___ATTRIBUTE__
AC_C_BIGENDIAN
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_DECL_SYS_SIGLIST
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_FUNC_WAIT3
AC_CHECK_FUNCS(getcwd getwd getopt putenv select strdup strerror strtod strtol setenv getenv vsnprintf snprintf strftime sigaction sigvec waitpid wait4 wait3)
dnl AC_REPLACE_FUNCS(setenv getenv)
AC_REPLACE_FUNCS(getenv)
dnl
dnl Structures
dnl
AC_HEADER_STAT
AC_STRUCT_ST_RDEV
dnl
dnl
dnl
dnl Solaris's signal.h only privides sigset_t etc if one of
dnl _EXTENSIONS_ _POSIX_C_SOURCE or _XOPEN_SOURCE are defined.
dnl The later two seem to cause more problems than they solve so if we
dnl see _EXTENSIONS_ we use it.
dnl Note we _don't_ want AC_EGREP_HEADER as we don't want CPP involved.
dnl
AC_EGREP(__EXTENSIONS__, /usr/include/signal.h, 
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__",)
dnl
dnl AC_* don't quite cut it.
dnl 
echo $ac_n "Checking for MACHINE & MACHINE_ARCH... $ac_c" 2>&6
cat > conftest.$ac_ext <<EOF
#include "confdefs.h"
#include <sys/param.h>
#ifdef MACHINE
machine=MACHINE
#endif
#ifdef MACHINE_ARCH
machine_arch=MACHINE_ARCH
#endif
EOF

default_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | 
	egrep machine= | tr -d ' "'`
rm -rf conftest*
if test "$default_machine"; then
	eval "$default_machine"
fi
machine=${machine:-`$srcdir/machine.sh`}
machine_arch=${machine_arch:-`$srcdir/machine.sh arch`}
echo "defaults: MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
dnl
dnl now allow overrides
dnl
AC_ARG_WITH(machine,
[  --with-machine=MACHINE  explicitly set MACHINE],
[case "${withval}" in
yes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE) ;;
no)    ;;
generic) machine=`$srcdir/machine.sh`;;
*)     machine=$with_machine;;
esac])
force_machine=
AC_ARG_WITH(force_machine,
[  --with-force-machine=MACHINE  set FORCE_MACHINE],
[case "${withval}" in
yes)   force_machine=FORCE_;;
no)    ;;
*)     force_machine=FORCE_; machine=$with_force_machine;;
esac])
dnl
AC_ARG_WITH(machine_arch,
[  --with-machine_arch=MACHINE_ARCH  explicitly set MACHINE_ARCH],
[case "${withval}" in
yes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE_ARCH) ;;
no)    ;;
*)     machine_arch=$with_machine_arch;;
esac])
dnl
dnl Tell them what we ended up with
dnl
echo "Using: ${force_machine}MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
dnl
dnl Allow folk to control _PATH_DEFSYSPATH
dnl
AC_ARG_WITH(default-sys-path,
[  --with-default-sys-path=PATH:DIR:LIST  use an explicit _PATH_DEFSYSPATH],
[case "${withval}" in
yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_DEFSYSPATH) ;;
no)    ;;
*)     CPPFLAGS="$CPPFLAGS \"-D_PATH_DEFSYSPATH=\\\"$with_default_sys_path\\\"\"" ;;
esac])
dnl
dnl Or just to prefix it 
dnl
AC_ARG_WITH(prefix-sys-path,
[  --with-prefix-sys-path=PATH:DIR:LIST  prefix _PATH_PREFIX_SYSPATH],
[case "${withval}" in
yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_PREFIX_SYSPATH) ;;
no)    ;;
*)     CPPFLAGS="$CPPFLAGS \"-D_PATH_PREFIX_SYSPATH=\\\"$with_prefix_sys_path\\\"\"" ;;
esac])
dnl
dnl Some folk don't like this one
dnl
AC_ARG_WITH(path-objdirprefix,
[  --with-path-objdirprefix=PATH  override _PATH_OBJDIRPREFIX],
[case "${withval}" in
yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_OBJDIRPREFIX) ;;
no)    CPPFLAGS="$CPPFLAGS -DNO_PATH_OBJDIRPREFIX" ;;
*)     CPPFLAGS="$CPPFLAGS \"-D_PATH_OBJDIRPREFIX=\\\"$with_path-objdir\\\"\"" ;;
esac])
dnl
dnl And this can be handy to do with out.
dnl
AC_ARG_ENABLE(pwd-override,
[  --disable-pwd-override  disable \$PWD overriding getcwd()],
[case "${enableval}" in
yes)   ;;
no)    CPPFLAGS="$CPPFLAGS -DNO_PWD_OVERRIDE" ;;
*)     AC_MSG_ERROR(bad value ${enableval} given for pwd-override option) ;;
esac])
dnl
dnl Just for grins
dnl
AC_ARG_ENABLE(check-make-chdir,
[  --disable-check-make-chdir disable make trying to guess 
	when it should automatically cd \${.CURDIR}],
[case "${enableval}" in
yes)   ;;
no)    CPPFLAGS="$CPPFLAGS -DNO_CHECK_MAKE_CHDIR" ;;
*)     AC_MSG_ERROR(bad value ${enableval} given for check-make-chdir option) ;;
esac])
AC_SUBST(machine)
AC_SUBST(force_machine)
AC_SUBST(machine_arch)
AC_OUTPUT(Makefile makefile.boot lst.lib/makefile.boot)

cat <<EOF

You can now run

	make -f makefile.boot bootstrap

to produce a fully functional bmake.  You can then use

	make -f makefile.boot install

for an initial installation.  If you already have macros installed 
you can use:

	./bmake -f Makefile

to install etc.

EOF