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.135 2001/10/29 06:18:43 jsh Exp $
5
dnl This file is part of librep.
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.
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.
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.
21
AC_REVISION($Revision: 1.135 $)
23
AC_INIT(src/rep_subrs.h)
24
AC_CONFIG_HEADER(config.h src/rep_config.h)
26
dnl Release versioning info
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)
36
libversion="$libcurrent:$librevision:$libage"
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"
45
dnl Find the system type
48
dnl Remove trailing slash in $prefix if necessary
51
prefix=`echo ${prefix} | sed -e 's/^\(.*\)\/$/\1/'`
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'
61
emacssitelispdir='${datadir}/emacs/site-lisp'
64
AC_SUBST(EXTRA_LIBOBJS)
66
dnl Checks for programs.
73
AC_PROG_GCC_TRADITIONAL
78
dnl Abort if shared libraries aren't enabled
79
if test "${enable_shared}" != "yes"; then
80
AC_MSG_ERROR([Need shared libraries enabled])
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))
88
dnl Checks for header files.
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)
95
dnl Check for GNU MP library and header files
97
[ --without-gmp Don't use GMP for bignum/rational numbers],
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"
107
dnl debian brain-damage
108
[if test -d /usr/include/gmp2; then
109
CPPFLAGS="${CPPFLAGS} -I/usr/include/gmp2"
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])])])
119
if test "$found_gmp" = "yes"; then
122
LIBS="$LIBS $GMP_LIBS"
123
AC_CHECK_FUNC(__gmp_randinit, AC_DEFINE(HAVE_GMP_RANDINIT))
125
elif test "$with_gmp" != "no"; then
126
AC_MSG_ERROR([Can't find GMP (--without-gmp for cut-down non-GMP build)])
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"
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))
145
dnl Check for Doug Lea's malloc in libc, otherwise compile dlmalloc.c
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
152
dnl dlmalloc is broken on Tru64
153
AC_DEFINE(LIBC_MALLOC)
156
EXTRA_LIBOBJS="${EXTRA_LIBOBJS} dlmalloc.o"
157
AC_DEFINE(DOUG_LEA_MALLOC)
161
AC_DEFINE(DOUG_LEA_MALLOC)
162
AC_DEFINE(LIBC_MALLOC)
165
dnl Check for readline
166
AC_ARG_WITH(readline,
167
[ --with-readline support fancy command input editing
168
--without-readline Don't use readline], [], [with_readline=maybe])
170
if test "$with_readline" != "no"; then
171
AC_ARG_WITH(readline-prefix,
172
[ --with-readline-prefix=DIR path to readline],
173
[ if test "$withval" != "no" -a "$withval" != "yes"; then
174
# Save in case test with directory specified fails
175
_cppflags=${CPPFLAGS}
178
CPPFLAGS="${CPPFLAGS} -I$withval/include"
179
LDFLAGS="${LDFLAGS} -L$withval/lib"
182
dnl check for terminal library
183
dnl this is a very cool solution from octave's configure.in
185
for termlib in ncurses curses termcap terminfo termlib; do
186
AC_CHECK_LIB(${termlib}, tputs, [tcap="$tcap -l$termlib"])
194
AC_CHECK_HEADER(readline/readline.h,
195
AC_CHECK_LIB(readline, readline,[
196
READLINE_LIBS="-lreadline $tcap"
197
AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
199
if test -z "$READLINE_LIBS"; then
200
if test "$with_readline_prefix" = "yes"; then
201
AC_MSG_ERROR([Can't find readline libraries])
203
CPPFLAGS=${_cppflags}
208
AC_SUBST(READLINE_LIBS)
210
dnl Check for dynamic loading
211
AC_CHECK_HEADER(dlfcn.h, [AC_DEFINE(HAVE_DLFCN_H)])
212
AC_CHECK_HEADER(dl.h, [AC_DEFINE(HAVE_DL_H)])
213
AC_CHECK_HEADER(sys/dl.h, [AC_DEFINE(HAVE_SYS_DL_H)])
215
AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl],
216
AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl]))
217
AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD) dl_ok=shl],
218
AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_DLOPEN) dl_ok=shl]))
220
if test $dl_ok = dl; then
221
AC_MSG_CHECKING([for preceding underscore in symbols])
222
dnl copied from glib configure.in
223
AC_TRY_RUN([#ifdef HAVE_DLFCN_H
226
int glib_underscore_test (void) { return 42; }
228
void *f1 = (void*)0, *f2 = (void*)0, *handle;
229
handle = dlopen ((void*)0, 0);
231
f1 = dlsym (handle, "glib_underscore_test");
232
f2 = dlsym (handle, "_glib_underscore_test");
233
} return (!f2 || f1);
235
[AC_DEFINE(DLSYM_NEED_USCORE)
239
dnl RTLD_GLOBAL is broken for Tru64 UNIX V5.0 and V5.0A, such that
240
dnl xh = dlopen("libx.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */
241
dnl yh = dlopen("liby.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */
242
dnl yf = dlsym(yh, "func"); /* Error: returns func from libx.so */
243
dnl It's hard to test for this apart from the version string, so
244
dnl that's what we use.
247
AC_MSG_CHECKING([for broken RTLD_GLOBAL on Tru64])
248
if /usr/sbin/sizer -v | grep -E -q -e 'UNIX [[TVX]]5\.0A?(-[[[:digit:]]]+)? '; then
249
AC_DEFINE(BROKEN_RTLD_GLOBAL)
258
if test $dl_ok != no; then
259
AC_DEFINE(HAVE_DYNAMIC_LOADING)
261
AC_MSG_ERROR([can't figure out how to do dynamic loading])
264
dnl Checks for typedefs, structures, and compiler characteristics.
272
dnl Checks for library functions.
277
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)
278
AC_REPLACE_FUNCS(realpath)
280
dnl check for crypt () function
281
AC_CHECK_FUNC(crypt, [AC_DEFINE(HAVE_CRYPT)],
282
AC_CHECK_LIB(crypt, crypt, [AC_DEFINE(HAVE_CRYPT)
283
LIBS="$LIBS -lcrypt"]))
287
dnl How do we get dependency lines in the Makefile?
288
if test "x${GCC}" = "xyes"; then
298
MAKEDEP='/usr/ccs/lib/cpp -M'
301
dnl disable dependences?
308
dnl If using GCC and it doesn't look as though the cflags have been
309
dnl set explicitly, add some warning options.
310
if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then
311
CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wmissing-prototypes"
314
dnl Turn off implicit-int warnings since the X11 includes
315
dnl on Solaris generate a lot of these
316
CFLAGS="${CFLAGS} -Wno-implicit-int"
321
AC_ARG_WITH(extra-cflags,
322
[ --with-extra-cflags=FLAGS Extra flags to pass to C compiler],
323
CFLAGS="${CFLAGS} $with_extra_cflags")
325
dnl Does <unistd.h> declare char **environ?
326
AC_CACHE_CHECK([whether unistd.h declares environ], jade_cv_decl_environ,
327
AC_TRY_COMPILE([#include <unistd.h>], [char **foo = environ;],
328
[jade_cv_decl_environ=yes],
329
[jade_cv_decl_environ=no]))
330
if test ${jade_cv_decl_environ} = no; then
331
AC_DEFINE(ENVIRON_UNDECLARED)
334
dnl Are ptys available, and if so, how?
335
AC_MSG_CHECKING([whether /dev/ptmx exists])
336
if test -r /dev/ptmx; then
339
AC_DEFINE(HAVE_DEV_PTMX)
344
dnl Look for old-style /dev/ptyXN devices
345
AC_CACHE_CHECK([whether /dev/ptyXN devices exist], jade_cv_sys_dev_pty,
346
jade_cv_sys_dev_pty=no
347
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
348
if test -r "/dev/pty${c}0"; then
349
jade_cv_sys_dev_pty=${c}
353
if test ${jade_cv_sys_dev_pty} != no; then
355
AC_DEFINE_UNQUOTED(FIRST_PTY_LETTER, '${jade_cv_sys_dev_pty}')
358
dnl Try to find the aclocal directory for installation
360
AC_ARG_WITH(aclocaldir,
361
[ --with-aclocaldir=DIR Directory in which to install autoconf macros],
363
AC_MSG_CHECKING([for aclocal directory])
364
if test "$aclocaldir" = none; then
365
aclocaldir="`aclocal --print-ac-dir 2>/dev/null`"
366
if test "x${aclocaldir}" = "x"; then
367
aclocaldir='${datadir}/aclocal'
370
AC_MSG_RESULT([${aclocaldir}])
373
AC_ARG_ENABLE(continuations,
374
[ --disable-continuations Don't include support for continuations
376
[if test "$enableval" != "no"; then AC_DEFINE(WITH_CONTINUATIONS) fi],
377
[AC_DEFINE(WITH_CONTINUATIONS)])
379
AC_ARG_ENABLE(dballoc,
380
[ --enable-dballoc Trace all memory allocations],
381
[if test "$enableval" != "no"; then AC_DEFINE(DEBUG_SYS_ALLOC) fi])
383
AC_ARG_ENABLE(dbsyms,
384
[ --disable-dbsyms When writing debug output, don't translate
385
addresses to symbol names],
386
[if test "$enableval" != "no"; then AC_DEFINE(DB_RESOLVE_SYMBOLS) fi],
387
[AC_DEFINE(DB_RESOLVE_SYMBOLS)])
390
[ --enable-gprof Build for gprof (needs --enable-static)],
391
[CFLAGS="${CFLAGS} -pg"; LDFLAGS="${LDFLAGS} -pg"])
393
AC_ARG_ENABLE(full-name-terminator,
394
[ --enable-full-name-terminator=C Full name in gecos field of passwd
395
file is terminated by first C character],
396
[if test "$enableval" != "no"; then
397
enableval="'$enableval'"
398
AC_DEFINE_UNQUOTED(FULL_NAME_TERMINATOR, $enableval)
401
dnl Assumption for now
403
AC_DEFINE(rep_HAVE_UNIX, 1)
405
dnl We need to find an integer type that's big enough to store any pointer
406
AC_MSG_CHECKING([for data type to store Lisp values])
407
AC_ARG_WITH(value-type,
408
[ --with-value-type=TYPE Implicitly signed integer type, at least as wide
409
as a pointer. [TYPE=<probed>] (see README)], [],
410
[with_value_type="undef"])
411
if test "${with_value_type}" = "undef"; then
412
AC_TRY_RUN([main () { exit (!(sizeof (int) >= sizeof (void *)));}],
413
[with_value_type=int])
415
if test "${with_value_type}" = "undef"; then
416
AC_TRY_RUN([main () { exit (!(sizeof (long int) >= sizeof (void *)));}],
417
[with_value_type="long int"])
419
if test "${with_value_type}" = "undef"; then
420
AC_TRY_RUN([main () { exit (!(sizeof (long long int) >= sizeof (void *)));}],
421
[with_value_type="long long int"])
423
if test "${with_value_type}" = "undef"; then
424
AC_MSG_ERROR([can't find Lisp value type; set --with-value-type (see README)])
426
AC_MSG_RESULT([${with_value_type}])
427
AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT, ${with_value_type})
429
dnl Find the size (in bits) of the chosen value type
430
AC_MSG_CHECKING([for size of Lisp value type])
431
AC_ARG_WITH(value-sizeof,
432
[ --with-value-sizeof=N Size (in bytes) of value type. [N=<probed>]], [],
433
[with_value_sizeof="undef"])
434
if test "${with_value_sizeof}" = "undef"; then
435
dnl the following fragment is inspired by AC_CHECK_SIZEOF
436
AC_TRY_RUN([#include <stdio.h>
438
FILE *f = fopen ("conftestval", "w");
440
fprintf (f, "%d\n", sizeof (${with_value_type}));
443
[ with_value_sizeof=`cat conftestval`; rm -f conftestval])
445
AC_MSG_RESULT([${with_value_sizeof} bytes])
446
AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_SIZEOF, ${with_value_sizeof})
448
dnl What's the suffix to get an integer constant of the above size?
449
AC_MSG_CHECKING([for value type constant suffix])
450
case "${with_value_type}" in
451
"long long int"|"long long")
455
dnl We should be okay to default to longs..
459
AC_MSG_RESULT([${rep_value_suffix}])
460
AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_SUFFIX, ${rep_value_suffix})
462
dnl What's the printf integer conversion for this type?
463
AC_MSG_CHECKING([for value type printf conversion])
464
case "${with_value_type}" in
465
"long long int"|"long long")
466
dnl other options would be L or q!?
476
AC_MSG_RESULT([${rep_value_conv}])
477
AC_DEFINE_UNQUOTED(rep_PTR_SIZED_INT_CONV, "${rep_value_conv}")
479
dnl Check for size of long
480
AC_CHECK_SIZEOF(long)
482
dnl Check if `long long int' is available, also check it's size, if not
483
dnl available, then set it's size to the same as long
484
AC_MSG_CHECKING([for long long int])
485
AC_TRY_COMPILE([],[long long int foo = 42;],
487
AC_DEFINE(rep_HAVE_LONG_LONG,1)
488
AC_CHECK_SIZEOF(long long)],
490
AC_DEFINE(SIZEOF_LONG_LONG,SIZEOF_LONG)])
493
dnl This is the malloc granularity. It's unlikely that anything has
494
dnl less alignment than the default value of the number of bytes in
496
AC_ARG_WITH(malloc-alignment,
497
[ --with-malloc-alignment=BYTES Must be less than or equal to the alignment
498
returned by the malloc function. [BYTES=N]], [],
499
[with_malloc_alignment=${with_value_sizeof}])
500
AC_DEFINE_UNQUOTED(rep_MALLOC_ALIGNMENT, ${with_malloc_alignment})
502
dnl Check for gcc crashes on alpha (seems to be fixed in new snapshots, but
503
dnl just to make it compile on all machines)
504
if test "x${GCC}" = "xyes"; then
505
AC_MSG_CHECKING([for broken alpha gcc])
506
AC_TRY_COMPILE([],[__builtin_return_address(1);],
508
[AC_DEFINE(BROKEN_ALPHA_GCC,1)
510
AC_MSG_WARN([Backtrace support will not be compiled])])
513
AC_MSG_CHECKING([for stack growth direction])
514
AC_ARG_WITH(stack-direction,
515
[ --with-stack-direction=DIR Stack growth direction. -1 for downwards,
517
[AC_MSG_RESULT(${with_stack_direction})],
518
[with_stack_direction=unknown])
519
if test "${with_stack_direction}" = unknown; then
522
AC_MSG_RESULT([assuming downwards])
523
with_stack_direction="-1"
525
dnl any other known stack directions..?
528
if test "${with_stack_direction}" = unknown; then
529
AC_TRY_RUN([ void inner (char *foo) { char bar; exit (!(foo >= &bar)); }
530
void main () { char foo; inner (&foo); } ],
531
[AC_MSG_RESULT([downwards])
532
with_stack_direction=-1],
533
[AC_MSG_RESULT([upwards])
534
with_stack_direction=+1])
536
if test "${with_stack_direction}" != unknown; then
537
AC_DEFINE_UNQUOTED(STACK_DIRECTION, ${with_stack_direction})
540
dnl Nonstandard exported symbols
545
AC_SUBST(repcommonexecdir)
548
AC_SUBST(emacssitelispdir)
553
AC_DEFINE_UNQUOTED(rep_VERSION, "${version}")
554
AC_DEFINE_UNQUOTED(rep_INTERFACE, ${libcurrent})
556
dnl Hacks for libintl
561
MKINSTALLDIRS='${top_srcdir}/mkinstalldirs'
562
INTLOBJS="\$(GETTOBJS)"
568
AC_SUBST(DATADIRNAME)
569
AC_SUBST(MKINSTALLDIRS)
575
dnl If it looks like GNU gettext is in libc, don't compile a local copy
576
USE_INCLUDED_LIBINTL=yes
577
AC_SUBST(USE_INCLUDED_LIBINTL)
578
AC_CHECK_FUNC(_nl_msg_cat_cntr,
579
[AC_DEFINE(LIBC_GETTEXT)
580
AC_CHECK_HEADERS(libintl.h)
581
USE_INCLUDED_LIBINTL=no])
583
dnl Build all files. Makes sure rules.mk is rebuild each time
584
AC_OUTPUT(${output_files}, [rm -f rules.mk])
586
dnl If it doesn't look like GNU Make is being used, give a friendly warning
587
tem=`make --version -f /dev/null 2>&1 | grep GNU`
588
if test "x$tem" = "x"; then
589
AC_MSG_WARN([You need to use GNU Make when compiling])
593
dnl major-mode: sh-mode