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.5 2003-01-05 00:27:58 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.5 $) |
---|
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.16.1" |
---|
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=12 |
---|
34 | librevision=0 |
---|
35 | libage=3 |
---|
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}/${version}/lisp' |
---|
57 | repexecdir='${libexecdir}/rep/${version}/${host_type}' |
---|
58 | repcommonexecdir='${libexecdir}/rep/${host_type}' |
---|
59 | repdocfile='${repexecdir}/DOC' |
---|
60 | |
---|
61 | emacssitelispdir='${datadir}/emacs/site-lisp' |
---|
62 | |
---|
63 | EXTRA_LIBOBJS="" |
---|
64 | AC_SUBST(EXTRA_LIBOBJS) |
---|
65 | |
---|
66 | dnl Checks for programs. |
---|
67 | AC_PROG_CC |
---|
68 | AC_ISC_POSIX |
---|
69 | AC_PROG_CPP |
---|
70 | AC_PROG_INSTALL |
---|
71 | AC_PROG_LN_S |
---|
72 | AC_PROG_MAKE_SET |
---|
73 | AC_PROG_GCC_TRADITIONAL |
---|
74 | |
---|
75 | AC_DISABLE_STATIC |
---|
76 | AM_PROG_LIBTOOL |
---|
77 | |
---|
78 | dnl Abort if shared libraries aren't enabled |
---|
79 | if test "${enable_shared}" != "yes"; then |
---|
80 | AC_MSG_ERROR([Need shared libraries enabled]) |
---|
81 | fi |
---|
82 | |
---|
83 | dnl Checks for libraries. |
---|
84 | AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) |
---|
85 | AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) |
---|
86 | AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen)) |
---|
87 | |
---|
88 | dnl Checks for header files. |
---|
89 | AC_HEADER_DIRENT |
---|
90 | AC_HEADER_STDC |
---|
91 | AC_HEADER_SYS_WAIT |
---|
92 | AC_HEADER_TIME |
---|
93 | 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) |
---|
94 | |
---|
95 | dnl Check for GNU MP library and header files |
---|
96 | AC_ARG_WITH(gmp, |
---|
97 | [ --without-gmp Don't use GMP for bignum/rational numbers], |
---|
98 | [], [with_gmp=maybe]) |
---|
99 | |
---|
100 | GMP_LIBS="-lm" |
---|
101 | if test "$with_gmp" != "no"; then |
---|
102 | AC_ARG_WITH(gmp-prefix, [ --with-gmp-prefix=DIR path to GMP], |
---|
103 | [if test "$withval" != "no"; then |
---|
104 | CPPFLAGS="${CPPFLAGS} -I$withval/include" |
---|
105 | LDFLAGS="${LDFLAGS} -L$withval/lib" |
---|
106 | fi], |
---|
107 | dnl debian brain-damage |
---|
108 | [if test -d /usr/include/gmp2; then |
---|
109 | CPPFLAGS="${CPPFLAGS} -I/usr/include/gmp2" |
---|
110 | fi]) |
---|
111 | |
---|
112 | found_gmp=no |
---|
113 | AC_CHECK_HEADER(gmp.h, |
---|
114 | [AC_CHECK_LIB(gmp, mpz_init, |
---|
115 | [GMP_LIBS="-lgmp -lm"; found_gmp=yes], |
---|
116 | [AC_CHECK_LIB(gmp, __gmpz_init, |
---|
117 | [GMP_LIBS="-lgmp -lm"; found_gmp=yes])])]) |
---|
118 | |
---|
119 | if test "$found_gmp" = "yes"; then |
---|
120 | AC_DEFINE(HAVE_GMP) |
---|
121 | _libs="$LIBS" |
---|
122 | LIBS="$LIBS $GMP_LIBS" |
---|
123 | AC_CHECK_FUNC(__gmp_randinit, AC_DEFINE(HAVE_GMP_RANDINIT)) |
---|
124 | LIBS="$_libs" |
---|
125 | elif test "$with_gmp" != "no"; then |
---|
126 | AC_MSG_ERROR([Can't find GMP (--without-gmp for cut-down non-GMP build)]) |
---|
127 | fi |
---|
128 | fi |
---|
129 | AC_SUBST(GMP_LIBS) |
---|
130 | |
---|
131 | dnl Check for GNU DBM library and header files |
---|
132 | AC_ARG_WITH(gdbm-prefix, |
---|
133 | [ --with-gdbm-prefix=DIR path to GDBM],[ |
---|
134 | if test "$withval" != "no"; then |
---|
135 | CPPFLAGS="${CPPFLAGS} -I$withval/include" |
---|
136 | LDFLAGS="${LDFLAGS} -L$withval/lib" |
---|
137 | fi |
---|
138 | ]) |
---|
139 | AC_CHECK_HEADER(gdbm.h, |
---|
140 | AC_CHECK_LIB(gdbm, gdbm_open, GDBM_LIBS="-lgdbm", |
---|
141 | AC_MSG_ERROR(Cannot find GDBM library)), |
---|
142 | AC_MSG_ERROR(Cannot find GDBM header)) |
---|
143 | AC_SUBST(GDBM_LIBS) |
---|
144 | |
---|
145 | dnl Check for Doug Lea's malloc in libc |
---|
146 | doug_lea_malloc=yes |
---|
147 | AC_CHECK_FUNC(malloc_get_state, , doug_lea_malloc=no) |
---|
148 | AC_CHECK_FUNC(malloc_set_state, , doug_lea_malloc=no) |
---|
149 | if test "$doug_lea_malloc" = "no"; then |
---|
150 | dnl We used to compile our own version of dlmalloc on most |
---|
151 | dnl platforms that didn't have it in their libc. But the list |
---|
152 | dnl of exceptions was growing too long.. |
---|
153 | AC_DEFINE(LIBC_MALLOC) |
---|
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 | AC_CHECK_HEADER(sys/dl.h, [AC_DEFINE(HAVE_SYS_DL_H)]) |
---|
208 | dl_ok=no |
---|
209 | AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl], |
---|
210 | AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl])) |
---|
211 | AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD) dl_ok=shl], |
---|
212 | AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_DLOPEN) dl_ok=shl])) |
---|
213 | |
---|
214 | if test $dl_ok = dl; then |
---|
215 | AC_MSG_CHECKING([for preceding underscore in symbols]) |
---|
216 | dnl copied from glib configure.in |
---|
217 | AC_TRY_RUN([#ifdef HAVE_DLFCN_H |
---|
218 | # include <dlfcn.h> |
---|
219 | #endif |
---|
220 | int glib_underscore_test (void) { return 42; } |
---|
221 | int main() { |
---|
222 | void *f1 = (void*)0, *f2 = (void*)0, *handle; |
---|
223 | handle = dlopen ((void*)0, 0); |
---|
224 | if (handle) { |
---|
225 | f1 = dlsym (handle, "glib_underscore_test"); |
---|
226 | f2 = dlsym (handle, "_glib_underscore_test"); |
---|
227 | } return (!f2 || f1); |
---|
228 | }], |
---|
229 | [AC_DEFINE(DLSYM_NEED_USCORE) |
---|
230 | AC_MSG_RESULT(yes)], |
---|
231 | [AC_MSG_RESULT(no)]) |
---|
232 | |
---|
233 | dnl RTLD_GLOBAL is broken for Tru64 UNIX V5.0 and V5.0A, such that |
---|
234 | dnl xh = dlopen("libx.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */ |
---|
235 | dnl yh = dlopen("liby.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */ |
---|
236 | dnl yf = dlsym(yh, "func"); /* Error: returns func from libx.so */ |
---|
237 | dnl It's hard to test for this apart from the version string, so |
---|
238 | dnl that's what we use. |
---|
239 | case ${host} in |
---|
240 | *-dec-osf5*) |
---|
241 | AC_MSG_CHECKING([for broken RTLD_GLOBAL on Tru64]) |
---|
242 | if /usr/sbin/sizer -v | grep -E -q -e 'UNIX [[TVX]]5\.0A?(-[[[:digit:]]]+)? '; then |
---|
243 | AC_DEFINE(BROKEN_RTLD_GLOBAL) |
---|
244 | AC_MSG_RESULT(yes) |
---|
245 | else |
---|
246 | AC_MSG_RESULT(no) |
---|
247 | fi |
---|
248 | ;; |
---|
249 | esac |
---|
250 | fi |
---|
251 | |
---|
252 | if test $dl_ok != no; then |
---|
253 | AC_DEFINE(HAVE_DYNAMIC_LOADING) |
---|
254 | else |
---|
255 | AC_MSG_ERROR([can't figure out how to do dynamic loading]) |
---|
256 | fi |
---|
257 | |
---|
258 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
259 | AC_C_CONST |
---|
260 | AC_C_INLINE |
---|
261 | AC_TYPE_OFF_T |
---|
262 | AC_TYPE_PID_T |
---|
263 | AC_TYPE_SIZE_T |
---|
264 | AC_TYPE_SIGNAL |
---|
265 | |
---|
266 | dnl Checks for library functions. |
---|
267 | AC_FUNC_ALLOCA |
---|
268 | AC_FUNC_MMAP |
---|
269 | AC_FUNC_MEMCMP |
---|
270 | AC_FUNC_VPRINTF |
---|
271 | 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) |
---|
272 | AC_REPLACE_FUNCS(realpath) |
---|
273 | |
---|
274 | dnl check for crypt () function |
---|
275 | AC_CHECK_FUNC(crypt, [AC_DEFINE(HAVE_CRYPT)], |
---|
276 | AC_CHECK_LIB(crypt, crypt, [AC_DEFINE(HAVE_CRYPT) |
---|
277 | LIBS="$LIBS -lcrypt"])) |
---|
278 | |
---|
279 | dnl Custom tests |
---|
280 | |
---|
281 | dnl How do we get dependency lines in the Makefile? |
---|
282 | if test "x${GCC}" = "xyes"; then |
---|
283 | MAKEDEP='$(CC) -MM' |
---|
284 | else |
---|
285 | case ${host} in |
---|
286 | *-dec-osf*) |
---|
287 | dnl works on Tru64 |
---|
288 | MAKEDEP='$(CC) -M' |
---|
289 | ;; |
---|
290 | *-sun-solaris*) |
---|
291 | dnl works on Solaris |
---|
292 | MAKEDEP='/usr/ccs/lib/cpp -M' |
---|
293 | ;; |
---|
294 | *) |
---|
295 | dnl disable dependences? |
---|
296 | MAKEDEP='true' |
---|
297 | ;; |
---|
298 | esac |
---|
299 | fi |
---|
300 | AC_SUBST(MAKEDEP) |
---|
301 | |
---|
302 | dnl If using GCC and it doesn't look as though the cflags have been |
---|
303 | dnl set explicitly, add some warning options. |
---|
304 | if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then |
---|
305 | CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wmissing-prototypes" |
---|
306 | case ${host} in |
---|
307 | *-sun-solaris*) |
---|
308 | dnl Turn off implicit-int warnings since the X11 includes |
---|
309 | dnl on Solaris generate a lot of these |
---|
310 | CFLAGS="${CFLAGS} -Wno-implicit-int" |
---|
311 | ;; |
---|
312 | esac |
---|
313 | fi |
---|
314 | |
---|
315 | AC_ARG_WITH(extra-cflags, |
---|
316 | [ --with-extra-cflags=FLAGS Extra flags to pass to C compiler], |
---|
317 | CFLAGS="${CFLAGS} $with_extra_cflags") |
---|
318 | |
---|
319 | dnl Does <unistd.h> declare char **environ? |
---|
320 | AC_CACHE_CHECK([whether unistd.h declares environ], jade_cv_decl_environ, |
---|
321 | AC_TRY_COMPILE([#include <unistd.h>], [char **foo = environ;], |
---|
322 | [jade_cv_decl_environ=yes], |
---|
323 | [jade_cv_decl_environ=no])) |
---|
324 | if test ${jade_cv_decl_environ} = no; then |
---|
325 | AC_DEFINE(ENVIRON_UNDECLARED) |
---|
326 | fi |
---|
327 | |
---|
328 | dnl Are ptys available, and if so, how? |
---|
329 | AC_MSG_CHECKING([whether /dev/ptmx exists]) |
---|
330 | if test -r /dev/ptmx; then |
---|
331 | AC_MSG_RESULT([yes]) |
---|
332 | AC_DEFINE(HAVE_PTYS) |
---|
333 | AC_DEFINE(HAVE_DEV_PTMX) |
---|
334 | else |
---|
335 | AC_MSG_RESULT([no]) |
---|
336 | fi |
---|
337 | |
---|
338 | dnl Look for old-style /dev/ptyXN devices |
---|
339 | AC_CACHE_CHECK([whether /dev/ptyXN devices exist], jade_cv_sys_dev_pty, |
---|
340 | jade_cv_sys_dev_pty=no |
---|
341 | 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 |
---|
342 | if test -r "/dev/pty${c}0"; then |
---|
343 | jade_cv_sys_dev_pty=${c} |
---|
344 | break |
---|
345 | fi |
---|
346 | done) |
---|
347 | if test ${jade_cv_sys_dev_pty} != no; then |
---|
348 | AC_DEFINE(HAVE_PTYS) |
---|
349 | AC_DEFINE_UNQUOTED(FIRST_PTY_LETTER, '${jade_cv_sys_dev_pty}') |
---|
350 | fi |
---|
351 | |
---|
352 | dnl Try to find the aclocal directory for installation |
---|
353 | aclocaldir=none |
---|
354 | AC_ARG_WITH(aclocaldir, |
---|
355 | [ --with-aclocaldir=DIR Directory in which to install autoconf macros], |
---|
356 | aclocaldir=$withval) |
---|
357 | AC_MSG_CHECKING([for aclocal directory]) |
---|
358 | if test "$aclocaldir" = none; then |
---|
359 | aclocaldir="`aclocal --print-ac-dir 2>/dev/null`" |
---|
360 | if test "x${aclocaldir}" = "x"; then |
---|
361 | aclocaldir='${datadir}/aclocal' |
---|
362 | fi |
---|
363 | fi |
---|
364 | AC_MSG_RESULT([${aclocaldir}]) |
---|
365 | AC_SUBST(aclocaldir) |
---|
366 | |
---|
367 | AC_ARG_ENABLE(continuations, |
---|
368 | [ --disable-continuations Don't include support for continuations |
---|
369 | or multi-threading], |
---|
370 | [if test "$enableval" != "no"; then AC_DEFINE(WITH_CONTINUATIONS) fi], |
---|
371 | [AC_DEFINE(WITH_CONTINUATIONS)]) |
---|
372 | |
---|
373 | AC_ARG_ENABLE(dballoc, |
---|
374 | [ --enable-dballoc Trace all memory allocations], |
---|
375 | [if test "$enableval" != "no"; then AC_DEFINE(DEBUG_SYS_ALLOC) fi]) |
---|
376 | |
---|
377 | AC_ARG_ENABLE(dbsyms, |
---|
378 | [ --disable-dbsyms When writing debug output, don't translate |
---|
379 | addresses to symbol names], |
---|
380 | [if test "$enableval" != "no"; then AC_DEFINE(DB_RESOLVE_SYMBOLS) fi], |
---|
381 | [AC_DEFINE(DB_RESOLVE_SYMBOLS)]) |
---|
382 | |
---|
383 | AC_ARG_ENABLE(gprof, |
---|
384 | [ --enable-gprof Build for gprof (needs --enable-static)], |
---|
385 | [CFLAGS="${CFLAGS} -pg"; LDFLAGS="${LDFLAGS} -pg"]) |
---|
386 | |
---|
387 | AC_ARG_ENABLE(full-name-terminator, |
---|
388 | [ --enable-full-name-terminator=C Full name in gecos field of passwd |
---|
389 | file is terminated by first C character], |
---|
390 | [if test "$enableval" != "no"; then |
---|
391 | enableval="'$enableval'" |
---|
392 | AC_DEFINE_UNQUOTED(FULL_NAME_TERMINATOR, $enableval) |
---|
393 | fi]) |
---|
394 | |
---|
395 | dnl Assumption for now |
---|
396 | HAVE_UNIX=1 |
---|
397 | AC_DEFINE(rep_HAVE_UNIX, 1) |
---|
398 | |
---|
399 | dnl We need to find an integer type that's big enough to store any pointer |
---|
400 | AC_MSG_CHECKING([for data type to store Lisp values]) |
---|
401 | AC_ARG_WITH(value-type, |
---|
402 | [ --with-value-type=TYPE Implicitly signed integer type, at least as wide |
---|
403 | as a pointer. [TYPE=<probed>] (see README)], [], |
---|
404 | [with_value_type="undef"]) |
---|
405 | if test "${with_value_type}" = "undef"; then |
---|
406 | AC_TRY_RUN([main () { exit (!(sizeof (int) >= sizeof (void *)));}], |
---|
407 | [with_value_type=int]) |
---|
408 | fi |
---|
409 | if test "${with_value_type}" = "undef"; then |
---|
410 | AC_TRY_RUN([main () { exit (!(sizeof (long int) >= sizeof (void *)));}], |
---|
411 | [with_value_type="long int"]) |
---|
412 | fi |
---|
413 | if test "${with_value_type}" = "undef"; then |
---|
414 | AC_TRY_RUN([main () { exit (!(sizeof (long long int) >= sizeof (void *)));}], |
---|
415 | [with_value_type="long long int"]) |
---|
416 | fi |
---|
417 | if test "${with_value_type}" = "undef"; then |
---|
418 | AC_MSG_ERROR([can't find Lisp value type; set --with-value-type (see README)]) |
---|
419 | fi |
---|
420 | AC_MSG_RESULT([${with_value_type}]) |
---|
421 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT, ${with_value_type}) |
---|
422 | |
---|
423 | dnl Find the size (in bits) of the chosen value type |
---|
424 | AC_MSG_CHECKING([for size of Lisp value type]) |
---|
425 | AC_ARG_WITH(value-sizeof, |
---|
426 | [ --with-value-sizeof=N Size (in bytes) of value type. [N=<probed>]], [], |
---|
427 | [with_value_sizeof="undef"]) |
---|
428 | if test "${with_value_sizeof}" = "undef"; then |
---|
429 | dnl the following fragment is inspired by AC_CHECK_SIZEOF |
---|
430 | AC_TRY_RUN([#include <stdio.h> |
---|
431 | main () { |
---|
432 | FILE *f = fopen ("conftestval", "w"); |
---|
433 | if (!f) exit (1); |
---|
434 | fprintf (f, "%d\n", sizeof (${with_value_type})); |
---|
435 | exit (0); |
---|
436 | }], |
---|
437 | [ with_value_sizeof=`cat conftestval`; rm -f conftestval]) |
---|
438 | fi |
---|
439 | AC_MSG_RESULT([${with_value_sizeof} bytes]) |
---|
440 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_SIZEOF, ${with_value_sizeof}) |
---|
441 | |
---|
442 | dnl What's the suffix to get an integer constant of the above size? |
---|
443 | AC_MSG_CHECKING([for value type constant suffix]) |
---|
444 | case "${with_value_type}" in |
---|
445 | "long long int"|"long long") |
---|
446 | rep_value_suffix=LL |
---|
447 | ;; |
---|
448 | *) |
---|
449 | dnl We should be okay to default to longs.. |
---|
450 | rep_value_suffix=L |
---|
451 | ;; |
---|
452 | esac |
---|
453 | AC_MSG_RESULT([${rep_value_suffix}]) |
---|
454 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_SUFFIX, ${rep_value_suffix}) |
---|
455 | |
---|
456 | dnl What's the printf integer conversion for this type? |
---|
457 | AC_MSG_CHECKING([for value type printf conversion]) |
---|
458 | case "${with_value_type}" in |
---|
459 | "long long int"|"long long") |
---|
460 | dnl other options would be L or q!? |
---|
461 | rep_value_conv=ll |
---|
462 | ;; |
---|
463 | long|"long int") |
---|
464 | rep_value_conv=l |
---|
465 | ;; |
---|
466 | *) |
---|
467 | rep_value_conv= |
---|
468 | ;; |
---|
469 | esac |
---|
470 | AC_MSG_RESULT([${rep_value_conv}]) |
---|
471 | AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_CONV, "${rep_value_conv}") |
---|
472 | |
---|
473 | dnl Check for size of long |
---|
474 | AC_CHECK_SIZEOF(long) |
---|
475 | |
---|
476 | dnl Check if `long long int' is available, also check it's size, if not |
---|
477 | dnl available, then set it's size to the same as long |
---|
478 | AC_MSG_CHECKING([for long long int]) |
---|
479 | AC_TRY_COMPILE([],[long long int foo = 42;], |
---|
480 | [AC_MSG_RESULT(yes) |
---|
481 | AC_DEFINE(rep_HAVE_LONG_LONG,1) |
---|
482 | AC_CHECK_SIZEOF(long long)], |
---|
483 | [AC_MSG_RESULT(no) |
---|
484 | AC_DEFINE(SIZEOF_LONG_LONG,SIZEOF_LONG)]) |
---|
485 | |
---|
486 | |
---|
487 | dnl This is the malloc granularity. It's unlikely that anything has |
---|
488 | dnl less alignment than the default value of the number of bytes in |
---|
489 | dnl the value type |
---|
490 | AC_ARG_WITH(malloc-alignment, |
---|
491 | [ --with-malloc-alignment=BYTES Must be less than or equal to the alignment |
---|
492 | returned by the malloc function. [BYTES=N]], [], |
---|
493 | [with_malloc_alignment=${with_value_sizeof}]) |
---|
494 | AC_DEFINE_UNQUOTED(rep_MALLOC_ALIGNMENT, ${with_malloc_alignment}) |
---|
495 | |
---|
496 | dnl Check for gcc crashes on alpha (seems to be fixed in new snapshots, but |
---|
497 | dnl just to make it compile on all machines) |
---|
498 | if test "x${GCC}" = "xyes"; then |
---|
499 | AC_MSG_CHECKING([for broken alpha gcc]) |
---|
500 | AC_TRY_COMPILE([],[__builtin_return_address(1);], |
---|
501 | [AC_MSG_RESULT(no)], |
---|
502 | [AC_DEFINE(BROKEN_ALPHA_GCC,1) |
---|
503 | AC_MSG_RESULT(yes) |
---|
504 | AC_MSG_WARN([Backtrace support will not be compiled])]) |
---|
505 | fi |
---|
506 | |
---|
507 | AC_MSG_CHECKING([for stack growth direction]) |
---|
508 | AC_ARG_WITH(stack-direction, |
---|
509 | [ --with-stack-direction=DIR Stack growth direction. -1 for downwards, |
---|
510 | +1 for upwards.], |
---|
511 | [AC_MSG_RESULT(${with_stack_direction})], |
---|
512 | [with_stack_direction=unknown]) |
---|
513 | if test "${with_stack_direction}" = unknown; then |
---|
514 | case ${host_cpu} in |
---|
515 | sparc|i?86) |
---|
516 | AC_MSG_RESULT([assuming downwards]) |
---|
517 | with_stack_direction="-1" |
---|
518 | ;; |
---|
519 | dnl any other known stack directions..? |
---|
520 | esac |
---|
521 | fi |
---|
522 | if test "${with_stack_direction}" = unknown; then |
---|
523 | AC_TRY_RUN([ void inner (char *foo) { char bar; exit (!(foo >= &bar)); } |
---|
524 | void main () { char foo; inner (&foo); } ], |
---|
525 | [AC_MSG_RESULT([downwards]) |
---|
526 | with_stack_direction=-1], |
---|
527 | [AC_MSG_RESULT([upwards]) |
---|
528 | with_stack_direction=+1]) |
---|
529 | fi |
---|
530 | if test "${with_stack_direction}" != unknown; then |
---|
531 | AC_DEFINE_UNQUOTED(STACK_DIRECTION, ${with_stack_direction}) |
---|
532 | fi |
---|
533 | |
---|
534 | dnl Nonstandard exported symbols |
---|
535 | AC_SUBST(version) |
---|
536 | AC_SUBST(libversion) |
---|
537 | AC_SUBST(repdir) |
---|
538 | AC_SUBST(repexecdir) |
---|
539 | AC_SUBST(repcommonexecdir) |
---|
540 | AC_SUBST(replispdir) |
---|
541 | AC_SUBST(repdocfile) |
---|
542 | AC_SUBST(emacssitelispdir) |
---|
543 | AC_SUBST(HAVE_UNIX) |
---|
544 | AC_SUBST(HAVE_X11) |
---|
545 | |
---|
546 | AC_DEFINE_UNQUOTED(rep_VERSION, "${version}") |
---|
547 | AC_DEFINE_UNQUOTED(rep_INTERFACE, ${libcurrent}) |
---|
548 | |
---|
549 | dnl Hacks for libintl |
---|
550 | AM_LC_MESSAGES |
---|
551 | VERSION="$version" |
---|
552 | PACKAGE="librep" |
---|
553 | DATADIRNAME="share" |
---|
554 | MKINSTALLDIRS='${top_srcdir}/mkinstalldirs' |
---|
555 | INTLOBJS="\$(GETTOBJS)" |
---|
556 | GT_YES='#' |
---|
557 | GT_NO='' |
---|
558 | l=l |
---|
559 | AC_SUBST(VERSION) |
---|
560 | AC_SUBST(PACKAGE) |
---|
561 | AC_SUBST(DATADIRNAME) |
---|
562 | AC_SUBST(MKINSTALLDIRS) |
---|
563 | AC_SUBST(INTLOBJS) |
---|
564 | AC_SUBST(GT_YES) |
---|
565 | AC_SUBST(GT_NO) |
---|
566 | AC_SUBST(l) |
---|
567 | |
---|
568 | dnl If it looks like GNU gettext is in libc, don't compile a local copy |
---|
569 | USE_INCLUDED_LIBINTL=yes |
---|
570 | AC_SUBST(USE_INCLUDED_LIBINTL) |
---|
571 | AC_CHECK_FUNC(_nl_msg_cat_cntr, |
---|
572 | [AC_DEFINE(LIBC_GETTEXT) |
---|
573 | AC_CHECK_HEADERS(libintl.h) |
---|
574 | USE_INCLUDED_LIBINTL=no]) |
---|
575 | |
---|
576 | dnl Build all files. Makes sure rules.mk is rebuild each time |
---|
577 | AC_OUTPUT(${output_files}, [rm -f rules.mk]) |
---|
578 | |
---|
579 | dnl If it doesn't look like GNU Make is being used, give a friendly warning |
---|
580 | tem=`make --version -f /dev/null 2>&1 | grep GNU` |
---|
581 | if test "x$tem" = "x"; then |
---|
582 | AC_MSG_WARN([You need to use GNU Make when compiling]) |
---|
583 | fi |
---|
584 | |
---|
585 | dnl Local variables: |
---|
586 | dnl major-mode: sh-mode |
---|
587 | dnl End: |
---|