Import KDE4.3.1 from wip
[pkgsrc.git] / bootstrap / bmake / configure.in
1 dnl
2 dnl RCSid:
3 dnl     $Id: configure.in,v 1.1.1.1 2004/03/11 13:04:07 grant Exp $
4 dnl
5 dnl Process this file with autoconf to produce a configure script
6 dnl
7 AC_INIT(makefile.boot.in)
8 AC_CONFIG_HEADER(config.h)
9
10 dnl Checks for programs.
11 AC_PROG_CC
12 AC_PROG_GCC_TRADITIONAL
13 AC_PROG_INSTALL
14 dnl Check for OS problems
15 AC_AIX
16 AC_MINIX
17 AC_ISC_POSIX
18 dnl Executable suffix - normally empty; .exe on os2.
19 AC_SUBST(ac_exe_suffix)dnl
20
21 dnl
22 dnl AC_C_CROSS
23 dnl
24
25 dnl Checks for header files.
26 AC_HEADER_STDC
27 AC_HEADER_SYS_WAIT
28 AC_HEADER_DIRENT
29 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)
30
31 dnl Both *BSD and Linux have sys/cdefs.h, most do not.
32 dnl If it is missing, we add -I${srcdir}/missing to CFLAGS
33 dnl also if sys/cdefs.h does not have __RCSID we need to use ours
34 dnl but we need to include the host's one too *sigh*
35 AC_CHECK_HEADER(sys/cdefs.h,
36 echo $ac_n "checking whether sys/cdefs.h is compatible... $ac_c" 2>&6
37 AC_EGREP_CPP(yes,
38 [#include <sys/cdefs.h>
39 #ifdef __RCSID
40 yes
41 #endif
42 ],
43 echo yes  2>&6,
44 echo no  2>&6; CPPFLAGS="${CPPFLAGS} -I\${srcdir}/missing -DNEED_HOST_CDEFS_H"),
45 CPPFLAGS="${CPPFLAGS} -I\${srcdir}/missing")
46
47 dnl Checks for typedefs, structures, and compiler characteristics.
48 AC_C___ATTRIBUTE__
49 AC_C_BIGENDIAN
50 AC_C_CONST
51 AC_TYPE_OFF_T
52 AC_TYPE_PID_T
53 AC_TYPE_SIZE_T
54 AC_DECL_SYS_SIGLIST
55 AC_HEADER_TIME
56 AC_STRUCT_TM
57
58 dnl Checks for library functions.
59 AC_TYPE_SIGNAL
60 AC_FUNC_VFORK
61 AC_FUNC_VPRINTF
62 AC_FUNC_WAIT3
63 AC_CHECK_FUNCS(getcwd getwd getopt putenv select strdup strerror strtod strtol setenv getenv vsnprintf snprintf strftime sigaction sigvec waitpid wait4 wait3)
64 dnl AC_REPLACE_FUNCS(setenv getenv)
65 AC_REPLACE_FUNCS(getenv)
66 dnl
67 dnl Structures
68 dnl
69 AC_HEADER_STAT
70 AC_STRUCT_ST_RDEV
71 dnl
72 dnl
73 dnl
74 dnl Solaris's signal.h only privides sigset_t etc if one of
75 dnl _EXTENSIONS_ _POSIX_C_SOURCE or _XOPEN_SOURCE are defined.
76 dnl The later two seem to cause more problems than they solve so if we
77 dnl see _EXTENSIONS_ we use it.
78 dnl Note we _don't_ want AC_EGREP_HEADER as we don't want CPP involved.
79 dnl
80 AC_EGREP(__EXTENSIONS__, /usr/include/signal.h, 
81 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__",)
82 dnl
83 dnl AC_* don't quite cut it.
84 dnl 
85 echo $ac_n "Checking for MACHINE & MACHINE_ARCH... $ac_c" 2>&6
86 cat > conftest.$ac_ext <<EOF
87 #include "confdefs.h"
88 #include <sys/param.h>
89 #ifdef MACHINE
90 machine=MACHINE
91 #endif
92 #ifdef MACHINE_ARCH
93 machine_arch=MACHINE_ARCH
94 #endif
95 EOF
96
97 default_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | 
98         egrep machine= | tr -d ' "'`
99 rm -rf conftest*
100 if test "$default_machine"; then
101         eval "$default_machine"
102 fi
103 machine=${machine:-`$srcdir/machine.sh`}
104 machine_arch=${machine_arch:-`$srcdir/machine.sh arch`}
105 echo "defaults: MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
106 dnl
107 dnl now allow overrides
108 dnl
109 AC_ARG_WITH(machine,
110 [  --with-machine=MACHINE  explicitly set MACHINE],
111 [case "${withval}" in
112 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE) ;;
113 no)    ;;
114 generic) machine=`$srcdir/machine.sh`;;
115 *)     machine=$with_machine;;
116 esac])
117 force_machine=
118 AC_ARG_WITH(force_machine,
119 [  --with-force-machine=MACHINE  set FORCE_MACHINE],
120 [case "${withval}" in
121 yes)   force_machine=FORCE_;;
122 no)    ;;
123 *)     force_machine=FORCE_; machine=$with_force_machine;;
124 esac])
125 dnl
126 AC_ARG_WITH(machine_arch,
127 [  --with-machine_arch=MACHINE_ARCH  explicitly set MACHINE_ARCH],
128 [case "${withval}" in
129 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake MACHINE_ARCH) ;;
130 no)    ;;
131 *)     machine_arch=$with_machine_arch;;
132 esac])
133 dnl
134 dnl Tell them what we ended up with
135 dnl
136 echo "Using: ${force_machine}MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6
137 dnl
138 dnl Allow folk to control _PATH_DEFSYSPATH
139 dnl
140 AC_ARG_WITH(default-sys-path,
141 [  --with-default-sys-path=PATH:DIR:LIST  use an explicit _PATH_DEFSYSPATH],
142 [case "${withval}" in
143 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_DEFSYSPATH) ;;
144 no)    ;;
145 *)     CPPFLAGS="$CPPFLAGS \"-D_PATH_DEFSYSPATH=\\\"$with_default_sys_path\\\"\"" ;;
146 esac])
147 dnl
148 dnl Or just to prefix it 
149 dnl
150 AC_ARG_WITH(prefix-sys-path,
151 [  --with-prefix-sys-path=PATH:DIR:LIST  prefix _PATH_PREFIX_SYSPATH],
152 [case "${withval}" in
153 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_PREFIX_SYSPATH) ;;
154 no)    ;;
155 *)     CPPFLAGS="$CPPFLAGS \"-D_PATH_PREFIX_SYSPATH=\\\"$with_prefix_sys_path\\\"\"" ;;
156 esac])
157 dnl
158 dnl Some folk don't like this one
159 dnl
160 AC_ARG_WITH(path-objdirprefix,
161 [  --with-path-objdirprefix=PATH  override _PATH_OBJDIRPREFIX],
162 [case "${withval}" in
163 yes)   AC_MSG_ERROR(bad value ${withval} given for bmake _PATH_OBJDIRPREFIX) ;;
164 no)    CPPFLAGS="$CPPFLAGS -DNO_PATH_OBJDIRPREFIX" ;;
165 *)     CPPFLAGS="$CPPFLAGS \"-D_PATH_OBJDIRPREFIX=\\\"$with_path-objdir\\\"\"" ;;
166 esac])
167 dnl
168 dnl And this can be handy to do with out.
169 dnl
170 AC_ARG_ENABLE(pwd-override,
171 [  --disable-pwd-override  disable \$PWD overriding getcwd()],
172 [case "${enableval}" in
173 yes)   ;;
174 no)    CPPFLAGS="$CPPFLAGS -DNO_PWD_OVERRIDE" ;;
175 *)     AC_MSG_ERROR(bad value ${enableval} given for pwd-override option) ;;
176 esac])
177 dnl
178 dnl Just for grins
179 dnl
180 AC_ARG_ENABLE(check-make-chdir,
181 [  --disable-check-make-chdir disable make trying to guess 
182         when it should automatically cd \${.CURDIR}],
183 [case "${enableval}" in
184 yes)   ;;
185 no)    CPPFLAGS="$CPPFLAGS -DNO_CHECK_MAKE_CHDIR" ;;
186 *)     AC_MSG_ERROR(bad value ${enableval} given for check-make-chdir option) ;;
187 esac])
188 AC_SUBST(machine)
189 AC_SUBST(force_machine)
190 AC_SUBST(machine_arch)
191 AC_OUTPUT(Makefile makefile.boot lst.lib/makefile.boot)
192
193 cat <<EOF
194
195 You can now run
196
197         make -f makefile.boot bootstrap
198
199 to produce a fully functional bmake.  You can then use
200
201         make -f makefile.boot install
202
203 for an initial installation.  If you already have macros installed 
204 you can use:
205
206         ./bmake -f Makefile
207
208 to install etc.
209
210 EOF