forked from SawfishWM/librep
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure.in
More file actions
524 lines (462 loc) · 15.2 KB
/
configure.in
File metadata and controls
524 lines (462 loc) · 15.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
dnl $Id$
dnl
dnl This file is part of librep.
dnl
dnl librep is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl librep is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with librep; see the file COPYING. If not, write to
dnl the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
AC_REVISION($Revision$)
AC_INIT(src/rep_subrs.h)
AC_CONFIG_HEADER(config.h src/rep_config.h)
dnl Release versioning info
version="0.100"
dnl libtool versioning info: `CURRENT:REVISION:AGE'. CURRENT is the
dnl current interface id, REVISION is the version number of this
dnl implementation, AGE defines the first interface id also supported
dnl (i.e. all interfaces between CURRENT-AGE and CURRENT are supported)
libcurrent=100
librevision=0
libage=0
libversion="$libcurrent:$librevision:$libage"
makefile_template="Makefile.in:Makedefs.in"
output_files="src/Makefile:Makedefs.in:src/Makefile.in\
lisp/Makefile:Makedefs.in:lisp/Makefile.in\
Makefile:Makedefs.in:Makefile.in\
man/Makefile:Makedefs.in:man/Makefile.in\
librep.spec"
dnl Find the system type
AC_CANONICAL_HOST
dnl Remove trailing slash in $prefix if necessary
case "${prefix}" in
*/)
prefix=`echo ${prefix} | sed -e 's/^\(.*\)\/$/\1/'`
;;
esac
repdir='${datadir}/rep'
replispdir='${repdir}/${version}/lisp'
repexecdir='${libexecdir}/rep/${version}/${host_type}'
repcommonexecdir='${libexecdir}/rep/${host_type}'
repdocfile='${repexecdir}/doc-strings'
emacssitelispdir='${datadir}/emacs/site-lisp'
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
dnl make sure we can find libraries and headers under $prefix
case "$prefix" in
/|/usr|/usr/local|NONE)
;;
*)
LDFLAGS="${LDFLAGS} -L$prefix/lib"
CPPFLAGS="${CPPFLAGS} -I$prefix/include"
;;
esac
EXTRA_LIBOBJS=""
AC_SUBST(EXTRA_LIBOBJS)
AC_SUBST(LDFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CFLAGS)
dnl Allow an extra include/library directory to be added
AC_ARG_WITH(extra-prefix, [ --with-extra-prefix=DIR path to libraries],
[if test "$withval" != "no"; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi], [])
dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_GCC_TRADITIONAL
AC_DISABLE_STATIC
AM_PROG_LIBTOOL
dnl Abort if shared libraries aren't enabled
if test "${enable_shared}" != "yes"; then
AC_MSG_ERROR([Need shared libraries enabled])
fi
dnl Checks for libraries.
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
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 xlocale.h)
AC_LC_MESSAGES
dnl Check for GNU MP library and header files
AC_ARG_WITH(gmp,
[ --without-gmp Don't use GMP for bignum/rational numbers],
[], [with_gmp=maybe])
GMP_LIBS="-lm"
if test "$with_gmp" != "no"; then
AC_ARG_WITH(gmp-prefix, [ --with-gmp-prefix=DIR path to GMP],
[if test "$withval" != "no"; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi],
dnl debian brain-damage
[if test -d /usr/include/gmp2; then
CPPFLAGS="${CPPFLAGS} -I/usr/include/gmp2"
fi])
found_gmp=no
AC_CHECK_HEADER(gmp.h,
[AC_CHECK_LIB(gmp, mpz_init,
[GMP_LIBS="-lgmp -lm"; found_gmp=yes],
[AC_CHECK_LIB(gmp, __gmpz_init,
[GMP_LIBS="-lgmp -lm"; found_gmp=yes])])])
if test "$found_gmp" = "yes"; then
AC_DEFINE(HAVE_GMP)
_libs="$LIBS"
LIBS="$LIBS $GMP_LIBS"
AC_CHECK_FUNC(__gmp_randinit, AC_DEFINE(HAVE_GMP_RANDINIT))
LIBS="$_libs"
elif test "$with_gmp" != "no"; then
AC_MSG_ERROR([Can't find GMP (--without-gmp for cut-down non-GMP build)])
fi
fi
AC_SUBST(GMP_LIBS)
dnl Check for GNU DBM library and header files
AC_ARG_WITH(gdbm-prefix,
[ --with-gdbm-prefix=DIR path to GDBM],[
if test "$withval" != "no"; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
])
AC_CHECK_HEADER(gdbm.h,
AC_CHECK_LIB(gdbm, gdbm_open, GDBM_LIBS="-lgdbm",
AC_MSG_ERROR(Cannot find GDBM library)),
AC_MSG_ERROR(Cannot find GDBM header))
AC_SUBST(GDBM_LIBS)
dnl Check for readline
AC_ARG_WITH(readline,
[ --with-readline support fancy command input editing
--without-readline Don't use readline], [], [with_readline=maybe])
if test "$with_readline" != "no"; then
dnl Save in case test with directory specified fails
_cppflags=${CPPFLAGS}
_ldflags=${LDFLAGS}
AC_ARG_WITH(readline-prefix,
[ --with-readline-prefix=DIR path to readline],
[ if test "$withval" != "no" -a "$withval" != "yes"; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi ])
dnl check for terminal library
dnl this is a very cool solution from octave's configure.in
unset tcap
for termlib in ncurses curses termcap terminfo termlib; do
AC_CHECK_LIB(${termlib}, tputs, [tcap="$tcap -l$termlib"])
case "$tcap" in
*-l${termlib}*)
break
;;
esac
done
AC_CHECK_HEADER(readline/readline.h,
AC_CHECK_LIB(readline, readline,[
READLINE_LIBS="-lreadline $tcap"
AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
if test -z "$READLINE_LIBS"; then
if test "$with_readline_prefix" = "yes"; then
AC_MSG_ERROR([Can't find readline libraries])
else
CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}
fi
fi
fi
AC_SUBST(READLINE_LIBS)
dnl Check for ffi
AC_ARG_WITH(ffi,
[ --with-ffi Support for ffi
--without-ffi Don't use ffi], [], [with_ffi=maybe])
if test "$with_ffi" != "no"; then
dnl Save in case test with directory specified fails
_cppflags=${CPPFLAGS}
_ldflags=${LDFLAGS}
AC_ARG_WITH(ffi-prefix,
[ --with-ffi-prefix=DIR path to ffi],
[ if test "$withval" != "no" -a "$withval" != "yes"; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi ])
AC_CHECK_HEADER(ffi.h,
AC_DEFINE(HAVE_FFI_H)
AC_CHECK_LIB(ffi, ffi_call,[
FFI_LIBS="-lffi"
AC_DEFINE(HAVE_LIBFFI)]))
AC_CHECK_HEADER(ffi/ffi.h,
AC_DEFINE(HAVE_FFI_FFI_H)
AC_CHECK_LIB(ffi, ffi_call,[
FFI_LIBS="-lffi"
AC_DEFINE(HAVE_LIBFFI)]))
if test -z "$FFI_LIBS"; then
if test "$with_ffi_prefix" = "yes"; then
AC_MSG_ERROR([Can't find libffi])
else
CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}
fi
fi
fi
FFI_OBJS=ffi.lo
AC_SUBST(FFI_LIBS)
AC_SUBST(FFI_OBJS)
dnl Check for dynamic loading
AC_CHECK_HEADER(dlfcn.h, [AC_DEFINE(HAVE_DLFCN_H)])
AC_CHECK_HEADER(dl.h, [AC_DEFINE(HAVE_DL_H)])
AC_CHECK_HEADER(sys/dl.h, [AC_DEFINE(HAVE_SYS_DL_H)])
dl_ok=no
AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl],
AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_DLOPEN) dl_ok=dl]))
AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD) dl_ok=shl],
AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_DLOPEN) dl_ok=shl]))
if test $dl_ok = dl; then
AC_MSG_CHECKING([for preceding underscore in symbols])
dnl copied from glib configure.in
AC_TRY_RUN([#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
int glib_underscore_test (void) { return 42; }
int main() {
void *f1 = (void*)0, *f2 = (void*)0, *handle;
handle = dlopen ((void*)0, 0);
if (handle) {
f1 = dlsym (handle, "glib_underscore_test");
f2 = dlsym (handle, "_glib_underscore_test");
} return (!f2 || f1);
}],
[AC_DEFINE(DLSYM_NEED_USCORE)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl RTLD_GLOBAL is broken for Tru64 UNIX V5.0 and V5.0A, such that
dnl xh = dlopen("libx.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */
dnl yh = dlopen("liby.so", RTLD_GLOBAL|RTLD_LAZY); /* provides func */
dnl yf = dlsym(yh, "func"); /* Error: returns func from libx.so */
dnl It's hard to test for this apart from the version string, so
dnl that's what we use.
case ${host} in
*-dec-osf5*)
AC_MSG_CHECKING([for broken RTLD_GLOBAL on Tru64])
if /usr/sbin/sizer -v | grep -E -q -e 'UNIX [[TVX]]5\.0A?(-[[[:digit:]]]+)? '; then
AC_DEFINE(BROKEN_RTLD_GLOBAL)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
;;
esac
fi
if test $dl_ok != no; then
AC_DEFINE(HAVE_DYNAMIC_LOADING)
else
AC_MSG_ERROR([can't figure out how to do dynamic loading])
fi
ENABLE_MAC=NO
AC_SUBST(ENABLE_MAC)
dnl Use Mac OS X code?
use_mac=maybe
AC_ARG_ENABLE(mac,
[ --enable-mac Enable Mac OS X support
--disable-mac Disable Mac OS X support],
[use_mac="$enableval"])
if test "$use_mac" = "maybe"; then
case ${host} in
*-apple-darwin*)
use_mac=yes
;;
esac
fi
if test "$use_mac" = "yes"; then
ENABLE_MAC=MAC
MFLAGS=
MAC_LIBS="-framework AppKit -framework Foundation -framework CoreFoundation"
CPPFLAGS="${CPPFLAGS} -DHAVE_FFI_OBJECTS=1"
FFI_OBJS="${FFI_OBJS} ffi-objc.lo"
FFI_LIBS="${FFI_LIBS} -framework Foundation -framework CoreFoundation"
AC_SUBST(MFLAGS)
AC_SUBST(MAC_LIBS)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_FUNC_VPRINTF
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 strtod_l snprintf_l)
AC_REPLACE_FUNCS(realpath)
dnl check for crypt () function
AC_CHECK_FUNC(crypt, [AC_DEFINE(HAVE_CRYPT)],
AC_CHECK_LIB(crypt, crypt, [AC_DEFINE(HAVE_CRYPT)
LIBS="$LIBS -lcrypt"]))
dnl Custom tests
dnl How do we get dependency lines in the Makefile?
if test "x${GCC}" = "xyes"; then
MAKEDEP='$(CC) -MM'
else
case ${host} in
*-dec-osf*)
dnl works on Tru64
MAKEDEP='$(CC) -M'
;;
*-sun-solaris*)
dnl works on Solaris
MAKEDEP='/usr/ccs/lib/cpp -M'
;;
*)
dnl disable dependences?
MAKEDEP='true'
;;
esac
fi
AC_SUBST(MAKEDEP)
dnl If using GCC and it doesn't look as though the cflags have been
dnl set explicitly, add some warning options.
if test "x${GCC}" = "xyes" -a "x$CFLAGS" = "x-g -O2"; then
CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wmissing-prototypes"
case ${host} in
*-sun-solaris*)
dnl Turn off implicit-int warnings since the X11 includes
dnl on Solaris generate a lot of these
CFLAGS="${CFLAGS} -Wno-implicit-int"
;;
*-apple-darwin)
dnl use -no-cpp-precomp with apple cc
CFLAGS="${CFLAGS} -no-cpp-precomp"
;;
esac
fi
AC_ARG_WITH(extra-cflags,
[ --with-extra-cflags=FLAGS Extra flags to pass to C compiler],
CFLAGS="${CFLAGS} $with_extra_cflags")
dnl Does <unistd.h> declare char **environ?
AC_CACHE_CHECK([whether unistd.h declares environ], jade_cv_decl_environ,
AC_TRY_COMPILE([#include <unistd.h>], [char **foo = environ;],
[jade_cv_decl_environ=yes],
[jade_cv_decl_environ=no]))
if test ${jade_cv_decl_environ} = no; then
AC_DEFINE(ENVIRON_UNDECLARED)
fi
dnl Are ptys available, and if so, how?
AC_MSG_CHECKING([whether /dev/ptmx exists])
if test -r /dev/ptmx; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_PTYS)
AC_DEFINE(HAVE_DEV_PTMX)
else
AC_MSG_RESULT([no])
fi
dnl Look for old-style /dev/ptyXN devices
AC_CACHE_CHECK([whether /dev/ptyXN devices exist], jade_cv_sys_dev_pty,
jade_cv_sys_dev_pty=no
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
if test -r "/dev/pty${c}0"; then
jade_cv_sys_dev_pty=${c}
break
fi
done)
if test ${jade_cv_sys_dev_pty} != no; then
AC_DEFINE(HAVE_PTYS)
AC_DEFINE_UNQUOTED(FIRST_PTY_LETTER, '${jade_cv_sys_dev_pty}')
fi
dnl Try to find the aclocal directory for installation
aclocaldir=none
AC_ARG_WITH(aclocaldir,
[ --with-aclocaldir=DIR Directory in which to install autoconf macros],
aclocaldir=$withval)
AC_MSG_CHECKING([for aclocal directory])
if test "$aclocaldir" = none; then
aclocaldir="`aclocal --print-ac-dir 2>/dev/null`"
if test "x${aclocaldir}" = "x"; then
aclocaldir='${datadir}/aclocal'
fi
fi
AC_MSG_RESULT([${aclocaldir}])
AC_SUBST(aclocaldir)
AC_ARG_ENABLE(dballoc,
[ --enable-dballoc Trace all memory allocations],
[if test "$enableval" != "no"; then AC_DEFINE(DEBUG_SYS_ALLOC) fi])
AC_ARG_ENABLE(dbsyms,
[ --disable-dbsyms When writing debug output, don't translate
addresses to symbol names],
[if test "$enableval" != "no"; then AC_DEFINE(DB_RESOLVE_SYMBOLS) fi],
[AC_DEFINE(DB_RESOLVE_SYMBOLS)])
AC_ARG_ENABLE(gprof,
[ --enable-gprof Build for gprof (needs --enable-static)],
[CFLAGS="${CFLAGS} -pg"; LDFLAGS="${LDFLAGS} -pg"])
AC_MSG_CHECKING([for stack growth direction])
AC_ARG_WITH(stack-direction,
[ --with-stack-direction=DIR Stack growth direction. -1 for downwards,
+1 for upwards.],
[AC_MSG_RESULT(${with_stack_direction})],
[with_stack_direction=unknown])
if test "${with_stack_direction}" = unknown; then
case ${host_cpu} in
sparc|i?86|x86_64|powerpc)
AC_MSG_RESULT([assuming downwards])
with_stack_direction="-1"
;;
dnl any other known stack directions..?
esac
fi
if test "${with_stack_direction}" = unknown; then
AC_TRY_RUN([ void inner (char *foo) { char bar; exit (!(foo >= &bar)); }
void main () { char foo; inner (&foo); } ],
[AC_MSG_RESULT([downwards])
with_stack_direction=-1],
[AC_MSG_RESULT([upwards])
with_stack_direction=+1])
fi
if test "${with_stack_direction}" != unknown; then
AC_DEFINE_UNQUOTED(STACK_DIRECTION, ${with_stack_direction})
fi
dnl Nonstandard exported symbols
AC_SUBST(version)
AC_SUBST(libversion)
AC_SUBST(repdir)
AC_SUBST(repexecdir)
AC_SUBST(repcommonexecdir)
AC_SUBST(replispdir)
AC_SUBST(repdocfile)
AC_SUBST(emacssitelispdir)
HAVE_UNIX=1
AC_SUBST(HAVE_UNIX)
AC_SUBST(HAVE_X11)
AC_DEFINE_UNQUOTED(rep_VERSION, "${version}")
AC_DEFINE_UNQUOTED(rep_INTERFACE, ${libcurrent})
INTL_LIBS=
AC_CHECK_FUNC(_nl_msg_cat_cntr, [],
[AC_CHECK_LIB(intl, _nl_msg_cat_cntr,
[INTL_LIBS="-lintl"])])
AC_CHECK_HEADERS(libintl.h)
AC_SUBST(INTL_LIBS)
dnl Build all files. Makes sure rules.mk is rebuild each time
AC_OUTPUT(${output_files}, [rm -f rules.mk])
dnl If it doesn't look like GNU Make is being used, give a friendly warning
tem=`make --version -f /dev/null 2>&1 | grep GNU`
if test "x$tem" = "x"; then
AC_MSG_WARN([You need to use GNU Make when compiling])
fi
dnl Local variables:
dnl major-mode: sh-mode
dnl End: