1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | dnl Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk> |
---|
3 | dnl $Id: configure.in,v 1.3 2001-03-13 17:05:56 ghudson Exp $ |
---|
4 | dnl |
---|
5 | dnl This file is part of librep. |
---|
6 | dnl |
---|
7 | dnl librep is free software; you can redistribute it and/or modify it |
---|
8 | dnl under the terms of the GNU General Public License as published by |
---|
9 | dnl the Free Software Foundation; either version 2, or (at your option) |
---|
10 | dnl any later version. |
---|
11 | dnl |
---|
12 | dnl librep is distributed in the hope that it will be useful, but |
---|
13 | dnl WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | dnl GNU General Public License for more details. |
---|
16 | dnl |
---|
17 | dnl You should have received a copy of the GNU General Public License |
---|
18 | dnl along with librep; see the file COPYING. If not, write to |
---|
19 | dnl the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
20 | |
---|
21 | AC_REVISION($Revision: 1.3 $) |
---|
22 | |
---|
23 | AC_INIT(src/rep_subrs.h) |
---|
24 | AC_CONFIG_HEADER(config.h src/rep_config.h) |
---|
25 | |
---|
26 | dnl Release versioning info |
---|
27 | version="0.13.4" |
---|
28 | |
---|
29 | dnl libtool versioning info: `CURRENT:REVISION:AGE'. CURRENT is the |
---|
30 | dnl current interface id, REVISION is the version number of this |
---|
31 | dnl implementation, AGE defines the first interface id also supported |
---|
32 | dnl (i.e. all interfaces between CURRENT-AGE and CURRENT are supported) |
---|
33 | libcurrent=10 |
---|
34 | librevision=3 |
---|
35 | libage=1 |
---|
36 | libversion="$libcurrent:$librevision:$libage" |
---|
37 | |
---|
38 | makefile_template="Makefile.in:Makedefs.in" |
---|
39 | output_files="src/Makefile:Makedefs.in:src/Makefile.in\ |
---|
40 | lisp/Makefile:Makedefs.in:lisp/Makefile.in\ |
---|
41 | Makefile:Makedefs.in:Makefile.in\ |
---|
42 | man/Makefile:Makedefs.in:man/Makefile.in\ |
---|
43 | intl/Makefile librep.spec" |
---|
44 | |
---|
45 | dnl Find the system type |
---|
46 | AC_CANONICAL_HOST |
---|
47 | |
---|
48 | dnl Remove trailing slash in $prefix if necessary |
---|
49 | case "${prefix}" in |
---|
50 | */) |
---|
51 | prefix=`echo ${prefix} | sed -e 's/^\(.*\)\/$/\1/'` |
---|
52 | ;; |
---|
53 | esac |
---|
54 | |
---|
55 | repdir='${datadir}/rep' |
---|
56 | replispdir='${repdir}/lisp' |
---|
57 | repexecdir='${libexecdir}/rep' |
---|
58 | repcommonexecdir='${libexecdir}/rep' |
---|
59 | repdocfile='${repexecdir}/DOC' |
---|
60 | |
---|
61 | EXTRA_LIBOBJS="" |
---|
62 | AC_SUBST(EXTRA_LIBOBJS) |
---|
63 | |
---|
64 | dnl Checks for programs. |
---|
65 | AC_PROG_CC |
---|
66 | AC_ISC_POSIX |
---|
67 | AC_PROG_CPP |
---|
68 | AC_PROG_INSTALL |
---|
69 | AC_PROG_LN_S |
---|
70 | AC_PROG_MAKE_SET |
---|
71 | AC_PROG_GCC_TRADITIONAL |
---|
72 | |
---|
73 | AC_DISABLE_STATIC |
---|
74 | AM_PROG_LIBTOOL |
---|
75 | |
---|
76 | dnl Abort if shared libraries aren't enabled |
---|
77 | if test "${enable_shared}" != "yes"; then |
---|
78 | AC_MSG_ERROR([Need shared libraries enabled]) |
---|
79 | fi |
---|
80 | |
---|
81 | dnl Checks for libraries. |
---|
82 | AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) |
---|
83 | AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) |
---|
84 | AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen)) |
---|
85 | |
---|
86 | dnl Checks for header files. |
---|
87 | AC_HEADER_DIRENT |
---|
88 | AC_HEADER_STDC |
---|
89 | AC_HEADER_SYS_WAIT |
---|
90 | AC_HEADER_TIME |
---|
91 | AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h sys/utsname.h unistd.h siginfo.h memory.h stropts.h termios.h string.h limits.h argz.h locale.h nl_types.h malloc.h sys/param.h) |
---|
92 | |
---|
93 | dnl Check for GNU MP library and header files |
---|
94 | AC_ARG_WITH(gmp, |
---|
95 | [ --without-gmp Don't use GMP for bignum/rational numbers], |
---|
96 | [], [with_gmp=maybe]) |
---|
97 | |
---|
98 | GMP_LIBS="-lm" |
---|
99 | if test "$with_gmp" != "no"; then |
---|
100 | AC_ARG_WITH(gmp-prefix, [ --with-gmp-prefix=DIR path to GMP], |
---|
101 | [if test "$withval" != "no"; then |
---|
102 | CPPFLAGS="${CPPFLAGS} -I$withval/include" |
---|
103 | LDFLAGS="${LDFLAGS} -L$withval/lib" |
---|
104 | fi], |
---|
105 | dnl debian brain-damage |
---|
106 | [if test -d /usr/include/gmp2; then |
---|
107 | CPPFLAGS="${CPPFLAGS} -I/usr/include/gmp2" |
---|
108 | fi]) |
---|
109 | |
---|
110 | found_gmp=no |
---|
111 | AC_CHECK_HEADER(gmp.h, |
---|
112 | [AC_CHECK_LIB(gmp, mpz_init, |
---|
113 | [GMP_LIBS="-lgmp -lm"; found_gmp=yes], |
---|
114 | [AC_CHECK_LIB(gmp, __gmpz_init, |
---|
115 | [GMP_LIBS="-lgmp -lm"; found_gmp=yes])])]) |
---|
116 | |
---|
117 | if test "$found_gmp" = "yes"; then |
---|
118 | AC_DEFINE(HAVE_GMP) |
---|
119 | elif test "$with_gmp" != "no"; then |
---|
120 | AC_MSG_ERROR([Can't find GMP (--without-gmp for cut-down non-GMP build)]) |
---|
121 | fi |
---|
122 | fi |
---|
123 | AC_SUBST(GMP_LIBS) |
---|
124 | |
---|
125 | dnl Check for GNU DBM library and header files |
---|
126 | AC_ARG_WITH(gdbm-prefix, |
---|
127 | [ --with-gdbm-prefix=DIR path to GDBM],[ |
---|
128 | if test "$withval" != "no"; then |
---|
129 | CPPFLAGS="${CPPFLAGS} -I$withval/include" |
---|
130 | LDFLAGS="${LDFLAGS} -L$withval/lib" |
---|
131 | fi |
---|
132 | ]) |
---|
133 | AC_CHECK_HEADER(gdbm.h, |
---|
134 | AC_CHECK_LIB(gdbm, gdbm_open, GDBM_LIBS="-lgdbm", |
---|
135 | AC_MSG_ERROR(Cannot find GDBM library)), |
---|
136 | AC_MSG_ERROR(Cannot find GDBM header)) |
---|
137 | AC_SUBST(GDBM_LIBS) |
---|
138 | |
---|
139 | dnl Check for Doug Lea's malloc in libc, otherwise compile dlmalloc.c |
---|
140 | doug_lea_malloc=yes |
---|
141 | AC_CHECK_FUNC(malloc_get_state, , doug_lea_malloc=no) |
---|
142 | AC_CHECK_FUNC(malloc_set_state, , doug_lea_malloc=no) |
---|
143 | if test "$doug_lea_malloc" = "no"; then |
---|
144 | case ${host} in |
---|
145 | *-dec-osf*) |
---|
146 | dnl dlmalloc is broken on Tru64 |
---|
147 | AC_DEFINE(LIBC_MALLOC) |
---|
148 | ;; |
---|
149 | *) |
---|
150 | EXTRA_LIBOBJS="${EXTRA_LIBOBJS} dlmalloc.o" |
---|
151 | AC_DEFINE(DOUG_LEA_MALLOC) |
---|
152 | ;; |
---|
153 | esac |
---|
154 | else |
---|
155 | AC_DEFINE(DOUG_LEA_MALLOC) |
---|
156 | AC_DEFINE(LIBC_MALLOC) |
---|
157 | fi |
---|
158 | |
---|
159 | dnl Check for readline |
---|
160 | AC_ARG_WITH(readline, |
---|
161 | [ --with-readline support fancy command input editing |
---|
162 | --without-readline Don't use readline], [], [with_readline=maybe]) |
---|
163 | |
---|
164 | if test "$with_readline" != "no"; then |
---|
165 | AC_ARG_WITH(readline-prefix, |
---|
166 | [ --with-readline-prefix=DIR path to readline], |
---|
167 | [ if test "$withval" != "no" -a "$withval" != "yes"; then |
---|
168 | # Save in case test with directory specified fails |
---|
169 | _cppflags=${CPPFLAGS} |
---|
170 | _ldflags=${LDFLAGS} |
---|
171 | |
---|
172 | CPPFLAGS="${CPPFLAGS} -I$withval/include" |
---|
173 | LDFLAGS="${LDFLAGS} -L$withval/lib" |
---|
174 | fi ]) |
---|
175 | |
---|
176 | dnl check for terminal library |
---|
177 | dnl this is a very cool solution from octave's configure.in |
---|
178 | unset tcap |
---|
179 | for termlib in ncurses curses termcap terminfo termlib; do |
---|
180 | AC_CHECK_LIB(${termlib}, tputs, [tcap="$tcap -l$termlib"]) |
---|
181 | case "$tcap" in |
---|
182 | *-l${termlib}*) |
---|
183 | break |
---|
184 | ;; |
---|
185 | esac |
---|
186 | done |
---|
187 | |
---|
188 | AC_CHECK_HEADER(readline/readline.h, |
---|
189 | AC_CHECK_LIB(readline, readline,[ |
---|
190 | READLINE_LIBS="-lreadline $tcap" |
---|
191 | AC_DEFINE(HAVE_LIBREADLINE)], , $tcap)) |
---|
192 | |
---|
193 | if test -z "$READLINE_LIBS"; then |
---|
194 | if test "$with_readline_prefix" = "yes"; then |
---|
195 | AC_MSG_ERROR([Can't find readline libraries]) |
---|
196 | else |
---|
197 | CPPFLAGS=${_cppflags} |
---|
198 | LDFLAGS=${_ldflags} |
---|
199 | fi |
---|
200 | fi |
---|
201 | fi |
---|
202 | AC_SUBST(READLINE_LIBS) |
---|
203 | |
---|
204 | dnl Check for dynamic loading |
---|
205 | AC_CHECK_HEADER(dlfcn.h, [AC_DEFINE(HAVE_DLFCN_H)]) |
---|
206 | AC_CHECK_HEADER(dl.h, [AC_DEFINE(HAVE_DL_H)]) |
---|
207 | dl_ok=no |
---|
208 | AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl], |
---|
209 | AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl])) |
---|
210 | AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD) dl_ok=shl], |
---|
211 | AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_DLOPEN) dl_ok=shl])) |
---|
212 | |
---|
213 | if test $dl_ok = dl; then |
---|
214 | AC_MSG_CHECKING([for preceding underscore in symbols]) |
---|
215 | dnl copied from glib configure.in |
---|
216 | AC_TRY_RUN([#ifdef HAVE_DLFCN_H |
---|
217 | # include <dlfcn.h> |
---|
218 | #endif |
---|
219 | int glib_underscore_test (void) { return 42; } |
---|
220 | int main() { |
---|
221 | void *f1 = (void*)0, *f2 = (void*)0, *handle; |
---|
222 | handle = dlopen ((void*)0, 0); |
---|
223 | if (handle) { |
---|
224 | f1 = dlsym (handle, "glib_underscore_test"); |
---|
225 | f2 = dlsym (handle, "_glib_underscore_test"); |
---|
226 | } return (!f2 || f1); |
---|
227 | }], |
---|
228 | [AC_DEFINE(DLSYM_NEED_USCORE) |
---|
229 | AC_MSG_RESULT(yes)], |
---|
230 | [AC_MSG_RESULT(no)]) |
---|
231 | |
---|
232 | dnl RTLD_GLOBAL is broken for Tru64 UNIX V5.0 and V5.0A, such that |
---|
233 | dnl xh = dlopen("libx.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */ |
---|
234 | dnl yh = dlopen("liby.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */ |
---|
235 | dnl yf = dlsym(yh, "func"); /* Error: returns func from libx.so */ |
---|
236 | dnl It's hard to test for this apart from the version string, so |
---|
237 | dnl that's what we use. |
---|
238 | case ${host} in |
---|
239 | *-dec-osf5*) |
---|
240 | AC_MSG_CHECKING([for broken RTLD_GLOBAL on Tru64]) |
---|
241 | if /usr/sbin/sizer -v | grep -E -q -e 'UNIX [[TVX]]5\.0A?(-[[[:digit:]]]+)? '; then |
---|
242 | AC_DEFINE(BROKEN_RTLD_GLOBAL) |
---|
243 | AC_MSG_RESULT(yes) |
---|
244 | else |
---|
245 | AC_MSG_RESULT(no) |
---|
246 | fi |
---|
247 | ;; |
---|
248 | esac |
---|
249 | fi |
---|
250 | |
---|
251 | if test $dl_ok != no; then |
---|
252 | AC_DEFINE(HAVE_DYNAMIC_LOADING) |
---|
253 | else |
---|
254 | AC_MSG_ERROR([can't figure out how to do dynamic loading]) |
---|
255 | fi |
---|
256 | |
---|
257 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
258 | AC_C_CONST |
---|
259 | AC_C_INLINE |
---|
260 | AC_TYPE_OFF_T |
---|
261 | AC_TYPE_PID_T |
---|
262 | AC_TYPE_SIZE_T |
---|
263 | AC_TYPE_SIGNAL |
---|
264 | |
---|
265 | dnl Checks for library functions. |
---|
266 | AC_FUNC_ALLOCA |
---|
267 | AC_FUNC_MMAP |
---|
268 | AC_FUNC_MEMCMP |
---|
269 | AC_FUNC_VPRINTF |
---|
270 | AC_CHECK_FUNCS(getcwd gethostname select socket strcspn strerror strstr stpcpy strtol psignal strsignal snprintf grantpt lrand48 getpagesize setitimer dladdr dlerror munmap putenv setenv setlocale strchr strcasecmp strncasecmp strdup __argz_count __argz_stringify __argz_next siginterrupt gettimeofday strtoll strtoq) |
---|
271 | AC_REPLACE_FUNCS(realpath) |
---|
272 | |
---|
273 | dnl Custom tests |
---|
274 | |
---|
275 | dnl How do we get dependency lines in the Makefile? |
---|
276 | if test "x${GCC}" = "xyes"; then |
---|
277 | MAKEDEP='$(CC) -MM' |
---|
278 | else |
---|
279 | case ${host} in |
---|
280 | *-dec-osf*) |
---|
281 | dnl works on Tru64 |
---|
282 | MAKEDEP='$(CC) -M' |
---|
283 | ;; |
---|
284 | *-sun-solaris*) |
---|
285 | dnl works on Solaris |
---|
286 | MAKEDEP='/usr/lib/cpp -M' |
---|
287 | ;; |
---|
288 | *) |
---|
289 | dnl disable dependences? |
---|
290 | MAKEDEP='true' |
---|
291 | ;; |
---|
292 | esac |
---|
293 | fi |
---|
294 | AC_SUBST(MAKEDEP) |
---|
295 | |
---|
296 | dnl If using GCC and it doesn't look as though the cflags have been |
---|
297 | dnl set explicitly, add some warning options. |
---|
298 | if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then |
---|
299 | CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wmissing-prototypes" |
---|
300 | case ${host} in |
---|
301 | *-sun-solaris*) |
---|
302 | dnl Turn off implicit-int warnings since the X11 includes |
---|
303 | dnl on Solaris generate a lot of these |
---|
304 | CFLAGS="${CFLAGS} -Wno-implicit-int" |
---|
305 | ;; |
---|
306 | esac |
---|
307 | fi |
---|
308 | |
---|
309 | AC_ARG_WITH(extra-cflags, |
---|
310 | [ --with-extra-cflags=FLAGS Extra flags to pass to C compiler], |
---|
311 | CFLAGS="${CFLAGS} $with_extra_cflags") |
---|
312 | |
---|
313 | dnl Does <unistd.h> declare char **environ? |
---|
314 | AC_CACHE_CHECK([whether unistd.h declares environ], jade_cv_decl_environ, |
---|
315 | AC_TRY_COMPILE([#include <unistd.h>], [char **foo = environ;], |
---|
316 | [jade_cv_decl_environ=yes], |
---|
317 | [jade_cv_decl_environ=no])) |
---|
318 | if test ${jade_cv_decl_environ} = no; then |
---|
319 | AC_DEFINE(ENVIRON_UNDECLARED) |
---|
320 | fi |
---|
321 | |
---|
322 | dnl Are ptys available, and if so, how? |
---|
323 | AC_MSG_CHECKING([whether /dev/ptmx exists]) |
---|
324 | if test -r /dev/ptmx; then |
---|
325 | AC_MSG_RESULT([yes]) |
---|
326 | AC_DEFINE(HAVE_PTYS) |
---|
327 | AC_DEFINE(HAVE_DEV_PTMX) |
---|
328 | else |
---|
329 | AC_MSG_RESULT([no]) |
---|
330 | fi |
---|
331 | |
---|
332 | dnl Look for old-style /dev/ptyXN devices |
---|
333 | AC_CACHE_CHECK([whether /dev/ptyXN devices exist], jade_cv_sys_dev_pty, |
---|
334 | jade_cv_sys_dev_pty=no |
---|
335 | for c in p q r s t u v w x y z a b c d e f g h i j k l m n o; do |
---|
336 | if test -r "/dev/pty${c}0"; then |
---|
337 | jade_cv_sys_dev_pty=${c} |
---|
338 | break |
---|
339 | fi |
---|
340 | done) |
---|
341 | if test ${jade_cv_sys_dev_pty} != no; then |
---|
342 | AC_DEFINE(HAVE_PTYS) |
---|
343 | AC_DEFINE_UNQUOTED(FIRST_PTY_LETTER, '${jade_cv_sys_dev_pty}') |
---|
344 | fi |
---|
345 | |
---|
346 | dnl Try to find the aclocal directory for installation |
---|
347 | aclocaldir=none |
---|
348 | AC_ARG_WITH(aclocaldir, |
---|
349 | [ --with-aclocaldir=DIR Directory in which to install autoconf macros], |
---|
350 | aclocaldir=$withval) |
---|
351 | AC_MSG_CHECKING([for aclocal directory]) |
---|
352 | if test "$aclocaldir" = none; then |
---|
353 | aclocaldir="`aclocal --print-ac-dir 2>/dev/null`" |
---|
354 | if test "x${aclocaldir}" = "x"; then |
---|
355 | aclocaldir='${datadir}/aclocal' |
---|
356 | fi |
---|
357 | fi |
---|
358 | AC_MSG_RESULT([${aclocaldir}]) |
---|
359 | AC_SUBST(aclocaldir) |
---|
360 | |
---|
361 | AC_ARG_ENABLE(continuations, |
---|
362 | [ --disable-continuations Don't include support for continuations |
---|
363 | or multi-threading], |
---|
364 | [if test "$enableval" != "no"; then AC_DEFINE(WITH_CONTINUATIONS) fi], |
---|
365 | [AC_DEFINE(WITH_CONTINUATIONS)]) |
---|
366 | |
---|
367 | AC_ARG_ENABLE(dballoc, |
---|
368 | [ --enable-dballoc Trace all memory allocations], |
---|
369 | [if test "$enableval" != "no"; then AC_DEFINE(DEBUG_SYS_ALLOC) fi]) |
---|
370 | |
---|
371 | AC_ARG_ENABLE(dbsyms, |
---|
372 | [ --disable-dbsyms When writing debug output, don't translate |
---|
373 | addresses to symbol names], |
---|
374 | [if test "$enableval" != "no"; then AC_DEFINE(DB_RESOLVE_SYMBOLS) fi], |
---|
375 | [AC_DEFINE(DB_RESOLVE_SYMBOLS)]) |
---|
376 | |
---|
377 | AC_ARG_ENABLE(gprof, |
---|
378 | [ --enable-gprof Build for gprof (needs --enable-static)], |
---|
379 | [CFLAGS="${CFLAGS} -pg"; LDFLAGS="${LDFLAGS} -pg"]) |
---|
380 | |
---|
381 | AC_ARG_ENABLE(full-name-terminator, |
---|
382 | [ --enable-full-name-terminator=C Full name in gecos field of passwd |
---|
383 | file is terminated by first C character], |
---|
384 | [if test "$enableval" != "no"; then |
---|
385 | enableval="'$enableval'" |
---|
386 | AC_DEFINE_UNQUOTED(FULL_NAME_TERMINATOR, $enableval) |
---|
387 | fi]) |
---|
388 | |
---|
389 | dnl Assumption for now |
---|
390 | HAVE_UNIX=1 |
---|
391 | AC_DEFINE(rep_HAVE_UNIX, 1) |
---|
392 | |
---|
393 | dnl We need to find an integer type that's big enough to store any pointer |
---|
394 | AC_MSG_CHECKING([for data type to store Lisp values]) |
---|
395 | AC_ARG_WITH(value-type, |
---|
396 | [ --with-value-type=TYPE Implicitly signed integer type, at least as wide |
---|
397 | as a pointer. [TYPE=<probed>] (see README)], [], |
---|
398 | [with_value_type="undef"]) |
---|
399 | if test "${with_value_type}" = "undef"; then |
---|
400 | AC_TRY_RUN([main () { exit (!(sizeof (int) >= sizeof (void *)));}], |
---|
401 | [with_value_type=int]) |
---|
402 | fi |
---|
403 | if test "${with_value_type}" = "undef"; then |
---|
404 | AC_TRY_RUN([main () { exit (!(sizeof (long int) >= sizeof (void *)));}], |
---|
405 | [with_value_type="long int"]) |
---|
406 | fi |
---|
407 | if test "${with_value_type}" = "undef"; then |
---|
408 | AC_TRY_RUN([main () { exit (!(sizeof (long long int) >= sizeof (void *)));}], |
---|
409 | [with_value_type="long long int"]) |
---|
410 | fi |
---|
411 | if test "${with_value_type}" = "undef"; then |
---|
412 | AC_MSG_ERROR([can't find Lisp value type; set --with-value-type (see README)]) |
---|
413 | fi |
---|
414 | AC_MSG_RESULT([${with_value_type}]) |
---|
415 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT, ${with_value_type}) |
---|
416 | |
---|
417 | dnl Find the size (in bits) of the chosen value type |
---|
418 | AC_MSG_CHECKING([for size of Lisp value type]) |
---|
419 | AC_ARG_WITH(value-sizeof, |
---|
420 | [ --with-value-sizeof=N Size (in bytes) of value type. [N=<probed>]], [], |
---|
421 | [with_value_sizeof="undef"]) |
---|
422 | if test "${with_value_sizeof}" = "undef"; then |
---|
423 | dnl the following fragment is inspired by AC_CHECK_SIZEOF |
---|
424 | AC_TRY_RUN([#include <stdio.h> |
---|
425 | main () { |
---|
426 | FILE *f = fopen ("conftestval", "w"); |
---|
427 | if (!f) exit (1); |
---|
428 | fprintf (f, "%d\n", sizeof (${with_value_type})); |
---|
429 | exit (0); |
---|
430 | }], |
---|
431 | [ with_value_sizeof=`cat conftestval`; rm -f conftestval]) |
---|
432 | fi |
---|
433 | AC_MSG_RESULT([${with_value_sizeof} bytes]) |
---|
434 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_SIZEOF, ${with_value_sizeof}) |
---|
435 | |
---|
436 | dnl What's the suffix to get an integer constant of the above size? |
---|
437 | AC_MSG_CHECKING([for value type constant suffix]) |
---|
438 | case "${with_value_type}" in |
---|
439 | "long long int"|"long long") |
---|
440 | rep_value_suffix=LL |
---|
441 | ;; |
---|
442 | *) |
---|
443 | dnl We should be okay to default to longs.. |
---|
444 | rep_value_suffix=L |
---|
445 | ;; |
---|
446 | esac |
---|
447 | AC_MSG_RESULT([${rep_value_suffix}]) |
---|
448 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_SUFFIX, ${rep_value_suffix}) |
---|
449 | |
---|
450 | dnl What's the printf integer conversion for this type? |
---|
451 | AC_MSG_CHECKING([for value type printf conversion]) |
---|
452 | case "${with_value_type}" in |
---|
453 | "long long int"|"long long") |
---|
454 | dnl other options would be L or q!? |
---|
455 | rep_value_conv=ll |
---|
456 | ;; |
---|
457 | long|"long int") |
---|
458 | rep_value_conv=l |
---|
459 | ;; |
---|
460 | *) |
---|
461 | rep_value_conv= |
---|
462 | ;; |
---|
463 | esac |
---|
464 | AC_MSG_RESULT([${rep_value_conv}]) |
---|
465 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_CONV, "${rep_value_conv}") |
---|
466 | |
---|
467 | dnl Check for size of long |
---|
468 | AC_CHECK_SIZEOF(long) |
---|
469 | |
---|
470 | dnl Check if `long long int' is available, also check it's size, if not |
---|
471 | dnl available, then set it's size to the same as long |
---|
472 | AC_MSG_CHECKING([for long long int]) |
---|
473 | AC_TRY_COMPILE([],[long long int foo = 42;], |
---|
474 | [AC_MSG_RESULT(yes) |
---|
475 | AC_DEFINE(rep_HAVE_LONG_LONG,1) |
---|
476 | AC_CHECK_SIZEOF(long long)], |
---|
477 | [AC_MSG_RESULT(no) |
---|
478 | AC_DEFINE(SIZEOF_LONG_LONG,SIZEOF_LONG)]) |
---|
479 | |
---|
480 | |
---|
481 | dnl This is the malloc granularity. It's unlikely that anything has |
---|
482 | dnl less alignment than the default value of the number of bytes in |
---|
483 | dnl the value type |
---|
484 | AC_ARG_WITH(malloc-alignment, |
---|
485 | [ --with-malloc-alignment=BYTES Must be less than or equal to the alignment |
---|
486 | returned by the malloc function. [BYTES=N]], [], |
---|
487 | [with_malloc_alignment=${with_value_sizeof}]) |
---|
488 | AC_DEFINE_UNQUOTED(rep_MALLOC_ALIGNMENT, ${with_malloc_alignment}) |
---|
489 | |
---|
490 | dnl Check for gcc crashes on alpha (seems to be fixed in new snapshots, but |
---|
491 | dnl just to make it compile on all machines) |
---|
492 | if test "x${GCC}" = "xyes"; then |
---|
493 | AC_MSG_CHECKING([for broken alpha gcc]) |
---|
494 | AC_TRY_COMPILE([],[__builtin_return_address(1);], |
---|
495 | [AC_MSG_RESULT(no)], |
---|
496 | [AC_DEFINE(BROKEN_ALPHA_GCC,1) |
---|
497 | AC_MSG_RESULT(yes) |
---|
498 | AC_MSG_WARN([Backtrace support will not be compiled])]) |
---|
499 | fi |
---|
500 | |
---|
501 | AC_MSG_CHECKING([for stack growth direction]) |
---|
502 | AC_ARG_WITH(stack-direction, |
---|
503 | [ --with-stack-direction=DIR Stack growth direction. -1 for downwards, |
---|
504 | +1 for upwards.], |
---|
505 | [AC_MSG_RESULT(${with_stack_direction})], |
---|
506 | [with_stack_direction=unknown]) |
---|
507 | if test "${with_stack_direction}" = unknown; then |
---|
508 | case ${host_cpu} in |
---|
509 | sparc|i?86) |
---|
510 | AC_MSG_RESULT([assuming downwards]) |
---|
511 | with_stack_direction="-1" |
---|
512 | ;; |
---|
513 | dnl any other known stack directions..? |
---|
514 | esac |
---|
515 | fi |
---|
516 | if test "${with_stack_direction}" = unknown; then |
---|
517 | AC_TRY_RUN([ void inner (char *foo) { char bar; exit (!(foo >= &bar)); } |
---|
518 | void main () { char foo; inner (&foo); } ], |
---|
519 | [AC_MSG_RESULT([downwards]) |
---|
520 | with_stack_direction=-1], |
---|
521 | [AC_MSG_RESULT([upwards]) |
---|
522 | with_stack_direction=+1]) |
---|
523 | fi |
---|
524 | if test "${with_stack_direction}" != unknown; then |
---|
525 | AC_DEFINE_UNQUOTED(STACK_DIRECTION, ${with_stack_direction}) |
---|
526 | fi |
---|
527 | |
---|
528 | dnl Nonstandard exported symbols |
---|
529 | AC_SUBST(version) |
---|
530 | AC_SUBST(libversion) |
---|
531 | AC_SUBST(repdir) |
---|
532 | AC_SUBST(repexecdir) |
---|
533 | AC_SUBST(repcommonexecdir) |
---|
534 | AC_SUBST(replispdir) |
---|
535 | AC_SUBST(repdocfile) |
---|
536 | AC_SUBST(HAVE_UNIX) |
---|
537 | AC_SUBST(HAVE_X11) |
---|
538 | AC_SUBST(LIBOBJS) |
---|
539 | |
---|
540 | AC_DEFINE_UNQUOTED(rep_VERSION, "${version}") |
---|
541 | AC_DEFINE_UNQUOTED(rep_INTERFACE, ${libcurrent}) |
---|
542 | |
---|
543 | dnl Hacks for libintl |
---|
544 | AM_LC_MESSAGES |
---|
545 | VERSION="$version" |
---|
546 | PACKAGE="librep" |
---|
547 | DATADIRNAME="share" |
---|
548 | MKINSTALLDIRS='${top_srcdir}/mkinstalldirs' |
---|
549 | INTLOBJS="\$(GETTOBJS)" |
---|
550 | GT_YES='#' |
---|
551 | GT_NO='' |
---|
552 | l=l |
---|
553 | AC_SUBST(VERSION) |
---|
554 | AC_SUBST(PACKAGE) |
---|
555 | AC_SUBST(DATADIRNAME) |
---|
556 | AC_SUBST(MKINSTALLDIRS) |
---|
557 | AC_SUBST(INTLOBJS) |
---|
558 | AC_SUBST(GT_YES) |
---|
559 | AC_SUBST(GT_NO) |
---|
560 | AC_SUBST(l) |
---|
561 | |
---|
562 | dnl If it looks like GNU gettext is in libc, don't compile a local copy |
---|
563 | USE_INCLUDED_LIBINTL=yes |
---|
564 | AC_SUBST(USE_INCLUDED_LIBINTL) |
---|
565 | AC_CHECK_FUNC(_nl_msg_cat_cntr, |
---|
566 | [AC_DEFINE(LIBC_GETTEXT) |
---|
567 | AC_CHECK_HEADERS(libintl.h) |
---|
568 | USE_INCLUDED_LIBINTL=no]) |
---|
569 | |
---|
570 | dnl Build all files |
---|
571 | AC_OUTPUT(${output_files}) |
---|
572 | |
---|
573 | dnl If it doesn't look like GNU Make is being used, give a friendly warning |
---|
574 | tem=`make --version -f /dev/null 2>&1 | grep GNU` |
---|
575 | if test "x$tem" = "x"; then |
---|
576 | AC_MSG_WARN([You need to use GNU Make when compiling]) |
---|
577 | fi |
---|
578 | |
---|
579 | dnl Local variables: |
---|
580 | dnl major-mode: sh-mode |
---|
581 | dnl End: |
---|