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;;
17 esac], [without_gcc=no])
18 AC_MSG_RESULT($without_gcc)
20 # If the user switches compilers, we can't believe the cache
21 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
23 AC_ERROR(cached CC is different -- throw away $cache_file
24 (it is also a good idea to do 'make clean' before compiling))
30 AC_CHECK_PROGS(AR, ar aal, ar)
32 AC_SUBST(INSTALL_PROGRAM)
33 AC_SUBST(INSTALL_DATA)
34 # Install just never works :-(
41 INSTALL_PROGRAM="$INSTALL"
42 INSTALL_DATA="$INSTALL -m 644"
45 # Optimizer/debugger flags passed between Makefiles
50 # checks for UNIX variants that set C preprocessor variables
54 # checks for header files
56 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)
61 AC_MSG_CHECKING(for clock_t in time.h)
62 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
63 AC_MSG_RESULT($was_it_defined)
72 # Set name for machine-dependent library files
74 AC_MSG_CHECKING(MACHDEP)
77 ac_sys_system=`uname -s | tr -d ' ' | tr '[[A-Z]]' '[[a-z]]'`
78 ac_sys_release=`uname -r | tr -d ' ' | sed 's/\..*//'`
79 MACHDEP="$ac_sys_system$ac_sys_release"
84 AC_MSG_RESULT($MACHDEP)
86 # Set info about shared libraries.
87 # XXX This should try things out instead of testing uname!
91 AC_SUBST(LINKFORSHARED)
92 ac_sys_system=`uname -s`
93 ac_sys_release=`uname -r`
94 # SO is the extension of shared libraries `(including the dot!)
95 # -- usually .so, .sl on HP-UX
99 case $ac_sys_system in
105 # LDSHARED is the ld *command* used to create shared library
106 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
107 AC_MSG_CHECKING(LDSHARED)
108 if test -z "$LDSHARED"
110 case $ac_sys_system/$ac_sys_release in
111 IRIX*) LDSHARED="ld -shared";;
112 SunOS/4*) LDSHARED="ld";;
113 SunOS/5*) LDSHARED="ld -G";;
114 hp*|HP*) LDSHARED="ld -b";;
115 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
116 DYNIX/ptx*) LDSHARED="ld -G";;
117 Linux*) LDSHARED="gcc-elf -shared";;
121 AC_MSG_RESULT($LDSHARED)
122 # CCSHARED are the C *flags* used to create objects to go into a shared
123 # library -- this is only needed for a few systems
124 AC_MSG_CHECKING(CCSHARED)
125 if test -z "$CCSHARED"
127 case $ac_sys_system in
128 hp*|HP*) if test "$GCC" = yes;
129 then CCSHARED="-fpic";
132 Linux*) CCSHARED="-fpic";;
135 AC_MSG_RESULT($CCSHARED)
136 # LINKFORSHARED are the flags passed to the $(CC) command that links
137 # the python executable -- this is only needed for a few systems
138 AC_MSG_CHECKING(LINKFORSHARED)
139 if test -z "$LINKFORSHARED"
141 case $ac_sys_system in
142 hp*|HP*) LINKFORSHARED="-Wl,-E";;
143 Linux*) LINKFORSHARED="-rdynamic";;
146 AC_MSG_RESULT($LINKFORSHARED)
148 # checks for libraries
149 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
150 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
151 AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
152 # The following three (nsl,inet,socket) are needed on Sequent;
153 # the order of checking must be this. Most SVR4 platforms will
154 # need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
155 # broken. I see no elegant solution (probably CHECK_LIB should be
156 # fixed to only add the library if the given entry point is not
157 # satisfied without it).
158 if test "`uname -s`" != IRIX
160 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
161 AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
162 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
165 AC_MSG_CHECKING(for --with-readline)
166 AC_ARG_WITH(readline, [--with-readline=DIRECTORY GNU readline], [
167 AC_MSG_RESULT($withval)
168 AC_DEFINE(WITH_READLINE)
169 if test ! -d "$withval"
170 then AC_ERROR(proper usage is --with-readline=DIRECTORY)
173 AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
174 AC_CHECK_LIB(termlib, tgetent, [termcap=termlib])])
175 if test ! -z "$termcap"
176 then LIBS="$LIBS $withval/libreadline.a"
177 # Avoid possible conflict between shared libraries termcap and gl
178 # on IRIX 5: both contain a routine called clear.
179 if test -f /usr/lib/lib$termcap.a
180 then LIBS="$LIBS /usr/lib/lib$termcap.a"
181 else LIBS="$LIBS -l$termcap"
183 else AC_ERROR(no working termcap/termlib, do not use --with-readline)
184 fi], AC_MSG_RESULT(no))
186 AC_MSG_CHECKING(for --with-thread)
187 AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
188 AC_MSG_RESULT($withval)
189 if test -d "$withval"
190 then LIBS="$LIBS -L$withval"
192 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
193 AC_DEFINE(_POSIX_THREADS)
194 LIBS="$LIBS -lpthreads"
195 LIBOBJS="$LIBOBJS thread.o"])
196 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
198 LIBOBJS="$LIBOBJS thread.o"])
199 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
200 LIBS="$LIBS -lthread"
201 LIBOBJS="$LIBOBJS thread.o"])
202 ], AC_MSG_RESULT(no))
204 # -I${DLINCLDIR} is added to the compile rule for import.o
208 AC_MSG_CHECKING(for --with-sgi-dl)
209 AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
210 AC_MSG_RESULT($withval)
211 AC_DEFINE(WITH_SGI_DL)
214 then LIBS="$LIBS -L$dldir"
215 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
218 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
220 AC_MSG_CHECKING(for --with-dl-dld)
221 AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
222 AC_MSG_RESULT($withval)
223 AC_DEFINE(WITH_DL_DLD)
224 dldir=`echo "$withval" | sed 's/,.*//'`
225 dlddir=`echo "$withval" | sed 's/.*,//'`
226 if test -d "$dldir" -a -d "$dlddir"
227 then LIBS="$LIBS -L$dldir -L$dlddir"
228 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
231 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
233 # checks for library functions
234 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 symlink tcgetpgrp tcsetpgrp times truncate uname waitpid)
235 AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
236 AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
237 AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
238 AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
240 # checks for structures
245 AC_MSG_CHECKING(for time.h that defines altzone)
246 AC_CACHE_VAL(ac_cv_header_time_altzone,
247 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
248 ac_cv_header_time_altzone=yes,
249 ac_cv_header_time_altzone=no)])
250 AC_MSG_RESULT($ac_cv_header_time_altzone)
251 if test $ac_cv_header_time_altzone = yes; then
252 AC_DEFINE(HAVE_ALTZONE)
256 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
258 #include <sys/types.h>
259 #include <sys/select.h>
260 #include <sys/time.h>
261 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
262 AC_MSG_RESULT($was_it_defined)
264 # checks for compiler characteristics
271 AC_MSG_CHECKING(for working volatile)
272 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
273 AC_MSG_RESULT($works)
276 AC_MSG_CHECKING(for working signed char)
277 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
278 AC_MSG_RESULT($works)
281 AC_MSG_CHECKING(for prototypes)
282 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
283 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
284 AC_MSG_RESULT($have_prototypes)
287 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
290 int foo(int x, ...) { return 0; }
291 ], [return foo(10, 11, 12);],
292 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
293 AC_MSG_RESULT($works)
295 if test "$have_prototypes" = yes; then
297 AC_MSG_CHECKING(for bad exec* prototypes)
298 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
299 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
300 AC_MSG_RESULT($bad_prototypes)
304 AC_MSG_CHECKING(for bad static forward)
306 struct s { int a; int b; };
313 static struct s foo = { 1, 2 };
315 exit(!((int)&foo == foobar()));
317 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
318 AC_MSG_RESULT($bad_forward)
321 AC_MSG_CHECKING(whether va_list is an array)
323 #ifdef HAVE_STDARG_PROTOTYPES
328 ], [va_list list1, list2; list1 = list2;], ,
329 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
330 AC_MSG_RESULT($va_list_is_array)
332 # checks for system services
335 # Linux requires this for correct f.p. operations
336 AC_CHECK_LIB(ieee, __fpu_control)
338 # check for --with-libm=...
341 AC_ARG_WITH(libm, [--with-libm=STRING math library], [
342 if test "$withval" != yes
344 else AC_ERROR(proper usage is --with-libm=STRING)
347 # check for --with-libc=...
349 AC_ARG_WITH(libc, [--with-libc=STRING C library], [
350 if test "$withval" != yes
352 else AC_ERROR(proper usage is --with-libc=STRING)
355 # check for hypot() in math library
358 AC_CHECK_FUNCS(hypot)
362 AC_MSG_CHECKING(for genuine getopt)
363 AC_CACHE_VAL(ac_cv_func_getopt,
364 [AC_TRY_RUN([#include <stdio.h>
365 extern int optind, opterr, getopt();
368 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
370 if (getopt(3, av, "f:") == 'f') { exit(1); }
372 }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
373 AC_MSG_RESULT($ac_cv_func_getopt)
374 test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
377 # generate output files
378 AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)