-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
468 lines (399 loc) · 15 KB
/
configure.ac
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([GNU APL], [1.5], [[email protected]])
AC_PREFIX_DEFAULT( /usr/local )
AC_CONFIG_AUX_DIR([.])
AC_USE_SYSTEM_EXTENSIONS
# always enable dependency tracking regardless of the user's choice.
# This avoids stale .o files after SVN updates. enable_dependency_tracking
# needs to be set early in order to be recognised!
#
# enable_dependency_tracking=no
AM_INIT_AUTOMAKE([subdir-objects])
AM_MAINTAINER_MODE([disable])
AC_CONFIG_SRCDIR([src])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
# use g++ for tests
#
AC_LANG(C++)
LT_INIT([dlopen])
# Checks for programs.
#
AC_PROG_CXX
AC_PROG_CC
AC_GNU_SOURCE
# check if the compiler knows -rdynamic
#
AC_MSG_CHECKING([whether $CXX accepts -rdynamic])
apl_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-rdynamic -Werror -Wall"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[CAN_rdynamic=yes], [CAN_rdynamic=no])
CXXFLAGS=$apl_save_CXXFLAGS
if test "x$CAN_rdynamic" = "xyes"; then
AC_SUBST([CXX_RDYNAMIC], ["-rdynamic"])
fi
AC_MSG_RESULT([$CAN_rdynamic])
##############################################################################
# Checks for header files.
#
# check for ncurses.h first and for curses.h if ncurses.h was not found
AC_CHECK_HEADER(
[ncurses.h],
[AC_DEFINE_UNQUOTED( [HAVE_NCURSES_H], [1],
[Define to 1 if <ncurses.h> is present])],
[AC_CHECK_HEADER(
[curses.h],
[AC_DEFINE_UNQUOTED( [HAVE_CURSES_H], [1],
[Define to 1 if <curses.h> is present])])
])
AC_CHECK_HEADER(
[term.h],
[AC_DEFINE_UNQUOTED( [HAVE_TERM_H], [1],
[Define to 1 if <term.h> is present])],
[],
[ [ # if HAVE_NCURSES_H ]
[ # include <ncurses.h> ]
[ # elif HAVE_CURSES_H ]
[ # include <curses.h> ]
[ # endif ]
])
AC_CHECK_HEADERS([ \
execinfo.h \
fcntl.h \
inttypes.h \
stdint.h \
stdlib.h \
string.h \
strings.h \
unistd.h \
sys/un.h \
ext/atomicity.h \
utmpx.h])
# Checks for typedefs, structures, and compiler characteristics.
#
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MMAP
AC_CHECK_FUNCS([floor memset munmap pow sqrt strchr strerror])
# Checks for libraries, less relevant first (to be last on linker command)
#
AC_CHECK_LIB([socket], [socket]) # for Solaris
AC_CHECK_LIB([nsl], [yp_all]) # for Solaris
# check for libncurses first and for libcurses if libncurses was not found
#
AC_CHECK_LIB(
[ncurses], [setupterm],
[ AC_DEFINE_UNQUOTED([HAVE_LIBCURSES], [1],
[Define to 1 if lib(n)curses is available])
LIBS="-lncurses $LIBS"],
[
AC_CHECK_LIB(
[curses], [setupterm],
[ AC_DEFINE_UNQUOTED([HAVE_LIBCURSES], [1],
[Define to 1 if lib(n)curses is available])
LIBS="-lcurses $LIBS"])
])
AC_CHECK_LIB([execinfo], [backtrace])
AC_CHECK_LIB([m], [acosh])
AC_CHECK_LIB([pthread], [sem_init])
AC_CHECK_LIB([dl], [dlopen])
# check if SQLite3 is installed
m4_include([m4/ax_lib_sqlite3.m4]) AX_LIB_SQLITE3([])
# check if PostgreSQL is installed
m4_include([m4/ax_lib_postgresql.m4]) AX_LIB_POSTGRESQL([])
# check if PostgreSQL is usable (if present)
if test "x$found_postgresql" = "xyes" ; then
AC_MSG_CHECKING([for PostgreSQL usability])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $POSTGRESQL_CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[@%:@include <libpq-fe.h>]],
[[PGconn *db = PQconnectdbParams( 0, 0, 1 );]])],
[USABLE_PostgreSQL=yes],
[USABLE_PostgreSQL=no])
CPPFLAGS="$saved_CPPFLAGS"
AC_MSG_RESULT(["$USABLE_PostgreSQL"])
if test "x$USABLE_PostgreSQL" = "xyes"; then
AC_DEFINE_UNQUOTED([USABLE_PostgreSQL], [1], [PostgreSQL code compiles])
fi
fi
# check if rdtsc (read CPU cycle counter is available.
# This is expected only on Intel CPUs
AC_MSG_CHECKING([whether CPU has rdtsc (read CPU cycle counter) opcode])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[unsigned int lo, hi;
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));]]
)], [HAVE_rdtsc=yes], [HAVE_rdtsc=no])
if test "x$HAVE_rdtsc" = "xyes"; then
AC_DEFINE_UNQUOTED([HAVE_RDTSC], [1], [CPU has rdtsc opcode])
fi
AM_CONDITIONAL(HAVE_RDTSC, test "x$HAVE_rdtsc" = xyes)
AC_MSG_RESULT([$HAVE_rdtsc])
# see if pthread_getaffinity_np() and pthread_setaffinity_np are available
#
AC_MSG_CHECKING([whether pthread_setaffinity_np is available])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([ [#include <pthread.h>]
[#include <ext/atomicity.h>]
],
[ [cpu_set_t cpuset;]
[pthread_setaffinity_np(0, sizeof(cpuset), &cpuset);]
[pthread_getaffinity_np(0, sizeof(cpuset), &cpuset);]
[_Atomic_word count = 0;]
[__gnu_cxx::__exchange_and_add_dispatch(&count, 1);]
[__gnu_cxx::__atomic_add_dispatch(&count, 1);]
])],
[HAVE_AFFINITY_NP=yes
AC_DEFINE_UNQUOTED([HAVE_AFFINITY_NP], [1],
[Define to 1 if pthread_setaffinity_np() is available])
],
[HAVE_AFFINITY_NP=no])
AM_CONDITIONAL(HAVE_AFFINITY_NP, test "x$HAVE_AFFINITY_NP" = xyes)
AC_MSG_RESULT([$HAVE_AFFINITY_NP])
# check for alternatives for ext/atomicity.h on OS/X
#
AC_MSG_CHECKING([whether OSAtomicAdd32Barrier() is available])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([ [#include <libkern/OSAtomic.h>] ],
[ [OSAtomicAdd32Barrier(0, 0);] ])],
[HAVE_OSX_ATOMIC=yes
AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMIC], [1],
[Define to 1 if OSAtomicAdd32Barrier() is available])
],
[HAVE_OSX_ATOMIC=no])
AC_MSG_RESULT([$HAVE_OSX_ATOMIC])
# check for alternatives for ext/atomicity.h on Solaris
#
AC_MSG_CHECKING([whether atomic_add_32_nv() is available])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([ [#include <atomic.h>] ],
[ [atomic_add_32_nv(0, 0);]
[atomic_add_32 (0, 0);]
])],
[HAVE_SOLARIS_ATOMIC=yes
AC_DEFINE_UNQUOTED([HAVE_SOLARIS_ATOMIC], [1],
[Define to 1 if atomic_add_32_nv() is available])
],
[HAVE_SOLARIS_ATOMIC=no])
AC_MSG_RESULT([$HAVE_SOLARIS_ATOMIC])
# check if the user compiles for ANDROID
#
AC_MSG_CHECKING([if we are compiling for Android])
user_wants_android=no
AC_ARG_WITH( [android],
[AS_HELP_STRING([--with-android],
[enable when compiling for Android])],
[user_wants_android=yes])
if test "x$user_wants_android" = xyes ; then
AC_DEFINE([WANT_ANDROID], [1], [Define if compiling for Android])
fi
AM_CONDITIONAL(WANT_ANDROID, test "x$user_wants_android" = xyes)
AC_MSG_RESULT([$user_wants_android])
# check if the user wants libapl.so
#
AC_MSG_CHECKING([if we want to build libapl.so])
user_wants_libapl=no
AC_ARG_WITH( [libapl],
[AS_HELP_STRING([--with-libapl],
[enable to build libapl.so])],
[user_wants_libapl=yes])
if test "x$user_wants_libapl" = xyes ; then
AC_DEFINE([WANT_LIBAPL], [1], [Define if building libapl.so])
fi
AM_CONDITIONAL(WANT_LIBAPL, test "x$user_wants_libapl" = xyes)
AC_MSG_RESULT([$user_wants_libapl])
AC_CONFIG_FILES([Makefile
debian/Makefile
debian/source/Makefile
doc/Makefile
gnu-apl.d/Makefile
rpm/Makefile
rpm/apl.spec
src/Makefile
src/APs/Makefile
src/emacs_mode/Makefile
src/native/Makefile
src/sql/Makefile
src/testcases/Makefile
src/workspaces/Makefile
support-files/Makefile
support-files/Dyalog-Keyboard/Makefile
support-files/old-Keyboard/Makefile
support-files/OS-X-Keyboard/Makefile
support-files/Unicomp-Keyboard/Makefile
support-files/WASD-Keyboard/Makefile
support-files/Dirk/Makefile
tools/Makefile
workspaces/Makefile
wslib3/Makefile
wslib4/Makefile
wslib5/Makefile
wslib5/APLComponentFiles/Makefile
wslib5/iso-apl-cf/Makefile
])
# APL: development configuration desired ? Set this before other xxx_WANTED
# options so that the implied xxx_WANTED options set here can be overridden
# further down
AC_ARG_VAR(DEVELOP_WANTED,
[ set development options (see README-2-configure) default: no])
if test "x$DEVELOP_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([DEVELOP_WANTED], [yes],
[define to set options typical for software development])
VALUE_CHECK_WANTED=yes
PERFORMANCE_COUNTERS_WANTED=yes
VALUE_HISTORY_WANTED=yes
DYNAMIC_LOG_WANTED=yes
ASSERT_LEVEL_WANTED=2
fi
# APL: max. rank ?
AC_ARG_VAR(MAX_RANK_WANTED,
[ the max. Rank of APL values (see README-2-configure) default: 8) ])
if test "x$MAX_RANK_WANTED" = "x"; then MAX_RANK_WANTED=8; fi
AC_DEFINE_UNQUOTED([MAX_RANK_WANTED], [$MAX_RANK_WANTED],
[max. rank of APL values ])
# APL: CHECK() macro desired ?
AC_ARG_VAR(VALUE_CHECK_WANTED,
[ enable CHECK() macro (see README-2-configure) default: no ])
if test "x$VALUE_CHECK_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([VALUE_CHECK_WANTED], [yes],
[ define to enable CHECK macro ])
fi
# APL: performance counters desired ?
AC_ARG_VAR(PERFORMANCE_COUNTERS_WANTED,
[ enable performance counters (see README-2-configure) default: no ])
if test "x$PERFORMANCE_COUNTERS_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([PERFORMANCE_COUNTERS_WANTED], [yes],
[ define to enable performance counters ])
fi
# APL: ADD_EVENT() macro and friends desired ?
AC_ARG_VAR(VALUE_HISTORY_WANTED,
[ enable CHECK() macro (see README-2-configure) default: no ])
if test "x$VALUE_HISTORY_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([VALUE_HISTORY_WANTED], [yes],
[ define to enable CHECK macro ])
fi
# APL: gprof profiling ?
AC_ARG_VAR(GPROF_WANTED,
[ enable gprof (-pg) (see README-2-configure) default: no ])
if test "x$GPROF_WANTED" = "xyes"; then
GPROF_WANTED=-pg
else
GPROF_WANTED=
fi
AC_DEFINE_UNQUOTED([GPROF_WANTED], [-pg],
[ define to enable gprof profiling ])
# APL: dynamic logging desired ?
AC_ARG_VAR(DYNAMIC_LOG_WANTED,
[ enable dynamic logging (see README-2-configure) default: no ])
if test "x$DYNAMIC_LOG_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([DYNAMIC_LOG_WANTED], [yes],
[ define to enable dynamic logging ])
fi
# APL: tracing of value flags (produces lots of messages) desired ?
AC_ARG_VAR(VF_TRACING_WANTED,
[ enable tracing of value flags (see README-2-configure) default: no ])
if test "x$VF_TRACING_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([VF_TRACING_WANTED], [yes],
[ define to enable tracing of value flags ])
fi
# APL: desired assert level ?
AC_ARG_VAR(ASSERT_LEVEL_WANTED,
[ Assert level (see README-2-configure) default: 1) ])
if test "x$ASSERT_LEVEL_WANTED" = "x"; then ASSERT_LEVEL_WANTED=1; fi
AC_DEFINE_UNQUOTED([ASSERT_LEVEL_WANTED], [$ASSERT_LEVEL_WANTED],
[assert level])
# APL: number of cores ?
AC_ARG_VAR(CORE_COUNT_WANTED,
[ Core count (see README-2-configure) default: 0) ])
if test "x$CORE_COUNT_WANTED" = "x"; then CORE_COUNT_WANTED=0; fi
if test "x$CORE_COUNT_WANTED" = "xall"; then CORE_COUNT_WANTED=-1; fi
if test "x$CORE_COUNT_WANTED" = "xALL"; then CORE_COUNT_WANTED=-1; fi
if test "x$CORE_COUNT_WANTED" = "xargv"; then CORE_COUNT_WANTED=-2; fi
if test "x$CORE_COUNT_WANTED" = "xARGV"; then CORE_COUNT_WANTED=-2; fi
if test "x$CORE_COUNT_WANTED" = "xsyl"; then CORE_COUNT_WANTED=-3; fi
if test "x$CORE_COUNT_WANTED" = "xSYL"; then CORE_COUNT_WANTED=-3; fi
AC_DEFINE_UNQUOTED([CORE_COUNT_WANTED], [$CORE_COUNT_WANTED],
[core count])
# APL: APserver transport ?
AC_ARG_VAR(APSERVER_TRANSPORT,
[ APserver transport (see README-2-configure) default: TCP) ])
if test "x$APSERVER_TRANSPORT" = "x"; then APSERVER_TRANSPORT=0; fi
if test "x$APSERVER_TRANSPORT" = "xTCP"; then APSERVER_TRANSPORT=0; fi
if test "x$APSERVER_TRANSPORT" = "xLINUX"; then APSERVER_TRANSPORT=1; fi
if test "x$APSERVER_TRANSPORT" = "xUNIX"; then APSERVER_TRANSPORT=2; fi
AC_DEFINE_UNQUOTED([APSERVER_TRANSPORT], [$APSERVER_TRANSPORT],
[APserver transport: TCP=0, LINUX=1, UNIX=2])
# APL: APserver TCP port ?
AC_ARG_VAR(APSERVER_PORT,
[ APserver transport (see README-2-configure) default: TCP) ])
if test "x$APSERVER_PORT" = "x"; then APSERVER_PORT=16366; fi
AC_DEFINE_UNQUOTED([APSERVER_PORT], [$APSERVER_PORT],
[APserver TCP listen port])
# APL: APserver port name ?
AC_ARG_VAR(APSERVER_PATH,
[ APserver transport (see README-2-configure) default: TCP) ])
if test "x$APSERVER_PATH" = "x"; then APSERVER_PATH="/tmp/GNU-APL/APserver"; fi
AC_DEFINE_UNQUOTED([APSERVER_PATH], ["$APSERVER_PATH"],
[APserver listen port name])
# APL: desired cellcount of short values ?
AC_ARG_VAR(SHORT_VALUE_LENGTH_WANTED,
[ Cellcount of short values (see README-2-configure) default: 12) ])
if test "x$SHORT_VALUE_LENGTH_WANTED" = "x"; then SHORT_VALUE_LENGTH_WANTED=12; fi
AC_DEFINE_UNQUOTED([SHORT_VALUE_LENGTH_WANTED], [$SHORT_VALUE_LENGTH_WANTED],
[short value cellcount])
# APL: visible markers (debug only option) ?
AC_ARG_VAR(VISIBLE_MARKERS_WANTED,
[ enable CHECK() macro (see README-2-configure) default: no ])
if test "x$VISIBLE_MARKERS_WANTED" = "xyes"; then
AC_DEFINE_UNQUOTED([VISIBLE_MARKERS_WANTED], [yes],
[ define to have visible markers (DONT!)])
fi
# check if we are on i686 (to fix a strange rpmbuild problem
AM_CONDITIONAL([ON_i686], [test `uname -m` = i686])
# check if we want development options
AM_CONDITIONAL([DEVELOP], [test x$DEVELOP_WANTED = xyes])
AM_CONDITIONAL([SQLITE3], [test x$found_sqlite = xyes])
AM_CONDITIONAL([POSTGRES], [test x$USABLE_PostgreSQL = xyes])
echo
AC_OUTPUT
echo
# create src/buildtag.hh
#
echo "configure: creating $srcdir/src//buildtag.hh"
rm -f $srcdir/src/buildtag.hh
cd $srcdir/src ; source ./buildtag ; cd ..
# create src/makefile.h
#
echo "configure: creating $srcdir/src/makefile.h"
rm -f $srcdir/src/makefile.h
make -C $srcdir/src makefile.h >/dev/null
# remember how ./configure was called
echo "configure: creating $srcdir/src/configure_args.cc"
echo "extern const char * configure_args;" > $srcdir/src/configure_args.cc
echo "const char * configure_args = \
\"$0 $ac_configure_args\";" >> $srcdir/src/configure_args.cc
# summary
echo " "
if test "x$USABLE_PostgreSQL" != "xyes"; then
echo "NOTE: the native function for accessing PostgreSQL will not be built because"
echo " your PostgreSQL installation is missing or incomplete (see details above)"
echo " "
fi
if test "x$found_sqlite" != "xyes"; then
echo "NOTE: the native function for accessing SQLite will not be built because"
echo " your SQLite installation is missing or incomplete (see details above)"
echo " "
fi