1 dnl Process this file with autoconf 2.0 or later to make a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(Include/object.h)
5 AC_CONFIG_HEADER(config.h)
7 # checks for alternative programs
8 AC_MSG_CHECKING(for --without-gcc)
9 AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
16 without_gcc=$withval;;
23 AC_MSG_RESULT($without_gcc)
25 # If the user switches compilers, we can't believe the cache
26 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
28 AC_ERROR(cached CC is different -- throw away $cache_file
29 (it is also a good idea to do 'make clean' before compiling))
35 AC_CHECK_PROGS(AR, ar aal, ar)
37 AC_SUBST(INSTALL_PROGRAM)
38 AC_SUBST(INSTALL_DATA)
39 # Install just never works :-(
46 INSTALL_PROGRAM="$INSTALL"
47 INSTALL_DATA="$INSTALL -m 644"
50 # Optimizer/debugger flags passed between Makefiles
55 # checks for UNIX variants that set C preprocessor variables
59 # checks for header files
61 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h sys/audioio.h sys/param.h sys/select.h sys/time.h sys/times.h sys/un.h sys/utsname.h sys/wait.h)
66 AC_MSG_CHECKING(for clock_t in time.h)
67 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
68 AC_MSG_RESULT($was_it_defined)
77 # Set name for machine-dependent library files
79 AC_MSG_CHECKING(MACHDEP)
82 ac_sys_system=`uname -s | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
83 ac_sys_release=`uname -r | tr -d '[/ ]' | sed 's/\..*//'`
84 ac_sys_cpu=`(uname -p 2>/dev/null || uname -m) |
85 tr '[[A-Z]]' '[[a-z]]'`
86 ## MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu"
87 MACHDEP="$ac_sys_system$ac_sys_release"
92 AC_MSG_RESULT($MACHDEP)
94 # Set info about shared libraries.
95 # XXX This should try things out instead of testing uname!
99 AC_SUBST(LINKFORSHARED)
100 ac_sys_system=`uname -s`
101 ac_sys_release=`uname -r`
102 # SO is the extension of shared libraries `(including the dot!)
103 # -- usually .so, .sl on HP-UX
107 case $ac_sys_system in
113 # LDSHARED is the ld *command* used to create shared library
114 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
115 AC_MSG_CHECKING(LDSHARED)
116 if test -z "$LDSHARED"
118 case $ac_sys_system/$ac_sys_release in
119 IRIX*) LDSHARED="ld -shared";;
120 SunOS/4*) LDSHARED="ld";;
121 SunOS/5*) LDSHARED="ld -G";;
122 hp*|HP*) LDSHARED="ld -b";;
123 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
124 DYNIX/ptx*) LDSHARED="ld -G";;
125 Linux*) LDSHARED="gcc-elf -shared";;
129 AC_MSG_RESULT($LDSHARED)
130 # CCSHARED are the C *flags* used to create objects to go into a shared
131 # library -- this is only needed for a few systems
132 AC_MSG_CHECKING(CCSHARED)
133 if test -z "$CCSHARED"
135 case $ac_sys_system in
136 hp*|HP*) if test "$GCC" = yes;
137 then CCSHARED="-fpic";
140 Linux*) CCSHARED="-fpic";;
143 AC_MSG_RESULT($CCSHARED)
144 # LINKFORSHARED are the flags passed to the $(CC) command that links
145 # the python executable -- this is only needed for a few systems
146 AC_MSG_CHECKING(LINKFORSHARED)
147 if test -z "$LINKFORSHARED"
149 case $ac_sys_system in
150 hp*|HP*) LINKFORSHARED="-Wl,-E";;
151 Linux*) LINKFORSHARED="-rdynamic";;
154 AC_MSG_RESULT($LINKFORSHARED)
156 # checks for libraries
157 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
158 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
159 AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
160 # The following three (nsl,inet,socket) are needed on Sequent;
161 # the order of checking must be this. Most SVR4 platforms will
162 # need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
163 # broken. I see no elegant solution (probably CHECK_LIB should be
164 # fixed to only add the library if the given entry point is not
165 # satisfied without it).
166 if test "`uname -s`" != IRIX
168 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
169 AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
170 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
173 AC_MSG_CHECKING(for --with-readline)
174 AC_ARG_WITH(readline, [--with-readline=DIRECTORY GNU readline], [
175 AC_MSG_RESULT($withval)
176 AC_DEFINE(WITH_READLINE)
177 if test ! -d "$withval"
178 then AC_ERROR(proper usage is --with-readline=DIRECTORY)
181 AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
182 AC_CHECK_LIB(termlib, tgetent, [termcap=termlib])])
183 if test ! -z "$termcap"
184 then LIBS="$LIBS $withval/libreadline.a"
185 # Avoid possible conflict between shared libraries termcap and gl
186 # on IRIX 5: both contain a routine called clear.
187 if test -f /usr/lib/lib$termcap.a
188 then LIBS="$LIBS /usr/lib/lib$termcap.a"
189 else LIBS="$LIBS -l$termcap"
191 else AC_ERROR(no working termcap/termlib, do not use --with-readline)
192 fi], AC_MSG_RESULT(no))
194 AC_MSG_CHECKING(for --with-thread)
195 AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
196 AC_MSG_RESULT($withval)
197 if test -d "$withval"
198 then LIBS="$LIBS -L$withval"
200 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
201 AC_DEFINE(_POSIX_THREADS)
202 LIBS="$LIBS -lpthreads"
203 LIBOBJS="$LIBOBJS thread.o"])
204 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
206 LIBOBJS="$LIBOBJS thread.o"])
207 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
208 LIBS="$LIBS -lthread"
209 LIBOBJS="$LIBOBJS thread.o"])
210 ], AC_MSG_RESULT(no))
212 # -I${DLINCLDIR} is added to the compile rule for import.o
216 AC_MSG_CHECKING(for --with-sgi-dl)
217 AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
218 AC_MSG_RESULT($withval)
219 AC_DEFINE(WITH_SGI_DL)
222 then LIBS="$LIBS -L$dldir"
223 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
226 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
228 AC_MSG_CHECKING(for --with-dl-dld)
229 AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
230 AC_MSG_RESULT($withval)
231 AC_DEFINE(WITH_DL_DLD)
232 dldir=`echo "$withval" | sed 's/,.*//'`
233 dlddir=`echo "$withval" | sed 's/.*,//'`
234 if test -d "$dldir" -a -d "$dlddir"
235 then LIBS="$LIBS -L$dldir -L$dlddir"
236 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
239 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
241 # checks for library functions
242 AC_CHECK_FUNCS(chown clock dlopen ftime ftruncate gethostname_r gettimeofday getpeername getpgrp getpid getwd link lstat nice readlink select setgid setuid setsid setpgid setpgrp setvbuf siginterrupt strftime symlink tcgetpgrp tcsetpgrp times truncate uname waitpid)
243 AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
244 AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
245 AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
246 AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
248 # checks for structures
253 AC_MSG_CHECKING(for time.h that defines altzone)
254 AC_CACHE_VAL(ac_cv_header_time_altzone,
255 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
256 ac_cv_header_time_altzone=yes,
257 ac_cv_header_time_altzone=no)])
258 AC_MSG_RESULT($ac_cv_header_time_altzone)
259 if test $ac_cv_header_time_altzone = yes; then
260 AC_DEFINE(HAVE_ALTZONE)
264 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
266 #include <sys/types.h>
267 #include <sys/select.h>
268 #include <sys/time.h>
269 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
270 AC_MSG_RESULT($was_it_defined)
272 # checks for compiler characteristics
279 AC_MSG_CHECKING(for working volatile)
280 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
281 AC_MSG_RESULT($works)
284 AC_MSG_CHECKING(for working signed char)
285 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
286 AC_MSG_RESULT($works)
289 AC_MSG_CHECKING(for prototypes)
290 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
291 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
292 AC_MSG_RESULT($have_prototypes)
295 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
298 int foo(int x, ...) { return 0; }
299 ], [return foo(10, 11, 12);],
300 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
301 AC_MSG_RESULT($works)
303 if test "$have_prototypes" = yes; then
305 AC_MSG_CHECKING(for bad exec* prototypes)
306 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
307 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
308 AC_MSG_RESULT($bad_prototypes)
312 AC_MSG_CHECKING(for bad static forward)
314 struct s { int a; int b; };
321 static struct s foo = { 1, 2 };
323 exit(!((int)&foo == foobar()));
325 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
326 AC_MSG_RESULT($bad_forward)
329 AC_MSG_CHECKING(whether va_list is an array)
331 #ifdef HAVE_STDARG_PROTOTYPES
336 ], [va_list list1, list2; list1 = list2;], ,
337 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
338 AC_MSG_RESULT($va_list_is_array)
340 # checks for system services
343 # Linux requires this for correct f.p. operations
344 AC_CHECK_LIB(ieee, __fpu_control)
346 # check for --with-libm=...
349 AC_ARG_WITH(libm, [--with-libm=STRING math library], [
350 if test "$withval" != yes
352 else AC_ERROR(proper usage is --with-libm=STRING)
355 # check for --with-libc=...
357 AC_ARG_WITH(libc, [--with-libc=STRING C library], [
358 if test "$withval" != yes
360 else AC_ERROR(proper usage is --with-libc=STRING)
363 # check for hypot() in math library
366 AC_CHECK_FUNCS(hypot)
370 AC_MSG_CHECKING(for genuine getopt)
371 AC_CACHE_VAL(ac_cv_func_getopt,
372 [AC_TRY_RUN([#include <stdio.h>
373 extern int optind, opterr, getopt();
376 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
378 if (getopt(3, av, "f:") == 'f') { exit(1); }
380 }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
381 AC_MSG_RESULT($ac_cv_func_getopt)
382 test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
385 # generate output files
386 AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)