1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.65])
5AC_INIT([GNU APL], [1.8], [bug-apl@gnu.org])
6configure_options="$0 $*"
7AC_PREFIX_DEFAULT( /usr/local )
8AC_CONFIG_AUX_DIR([.])
9AC_USE_SYSTEM_EXTENSIONS
10
11# always enable dependency tracking regardless of the user's choice.
12# This avoids stale .o files after SVN updates. enable_dependency_tracking
13# needs to be set early in order to be recognised!
14#
15# enable_dependency_tracking=no
16
17AM_INIT_AUTOMAKE([subdir-objects])
18AM_MAINTAINER_MODE([disable])
19AC_CONFIG_SRCDIR([src])
20AC_CONFIG_MACRO_DIR([m4])
21AC_CONFIG_HEADERS([config.h])
22
23# use g++ for tests
24#
25AC_LANG(C++)
26
27LT_INIT([dlopen])
28
29# Checks for programs.
30#
31AC_PROG_CXX
32AC_PROG_CC
33
34AC_GNU_SOURCE
35
36# check if the compiler knows -rdynamic
37#
38AC_MSG_CHECKING([whether $CXX accepts -rdynamic])
39apl_save_CXXFLAGS=$CXXFLAGS
40CXXFLAGS="-rdynamic -Werror -Wall"
41AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
42 [CAN_rdynamic=yes], [CAN_rdynamic=no])
43CXXFLAGS=$apl_save_CXXFLAGS
44if test "x$CAN_rdynamic" = "xyes"; then
45   AC_SUBST([CXX_RDYNAMIC], ["-rdynamic"])
46fi
47AC_MSG_RESULT([$CAN_rdynamic])
48
49
50##############################################################################
51# Checks for header files.
52#
53
54# check for ncurses.h first and for curses.h if ncurses.h was not found
55
56AC_CHECK_HEADER(
57	[ncurses.h],
58	[AC_DEFINE_UNQUOTED(	[HAVE_NCURSES_H], [1],
59				[Define to 1 iff <ncurses.h> is present])],
60	[AC_CHECK_HEADER(
61	[curses.h],
62	[AC_DEFINE_UNQUOTED(	[HAVE_CURSES_H], [1],
63				[Define to 1 iff <curses.h> is present])])
64	])
65
66AC_CHECK_HEADER(
67	[term.h],
68	[AC_DEFINE_UNQUOTED(	[HAVE_TERM_H], [1],
69				[Define to 1 iff <term.h> is present])],
70	[],
71	[	[ # if HAVE_NCURSES_H   ]
72		[ # include <ncurses.h> ]
73		[ # elif HAVE_CURSES_H  ]
74		[ # include <curses.h>  ]
75		[ # endif ]
76	])
77
78AC_CHECK_HEADERS([	\
79	execinfo.h	\
80	fcntl.h		\
81	fftw3.h		\
82	inttypes.h	\
83	stdint.h	\
84	stdlib.h	\
85	string.h	\
86	strings.h	\
87	unistd.h	\
88	sys/un.h	\
89	ext/atomicity.h	\
90	xcb/xcb.h	\
91	utmpx.h])
92
93# xcb/xproto.h needs xcb/xcb.h
94AC_CHECK_HEADER(xcb/xproto.h, [], [], [#include <xcb/xcb.h>])
95
96# Checks for typedefs, structures, and compiler characteristics.
97#
98AC_HEADER_STDBOOL
99AC_C_INLINE
100AC_TYPE_INT32_T
101AC_TYPE_INT64_T
102AC_TYPE_OFF_T
103AC_TYPE_SIZE_T
104AC_TYPE_UINT32_T
105AC_TYPE_UINT64_T
106AC_TYPE_UINT8_T
107
108# Checks for library functions.
109AC_FUNC_ERROR_AT_LINE
110AC_FUNC_MMAP
111AC_CHECK_FUNCS([floor memset munmap pow sqrt strchr strerror])
112
113# Checks for libraries, less relevant first (to be last on linker command)
114#
115AC_CHECK_LIB([socket],    [socket])   # for Solaris
116AC_CHECK_LIB([nsl],       [yp_all])   # for Solaris
117
118# check for libncurses first and for libcurses if libncurses was not found
119#
120AC_CHECK_LIB(
121	[ncurses], [setupterm],
122	[	AC_DEFINE_UNQUOTED([HAVE_LIBCURSES], [1],
123				   [Define to 1 iff lib(n)curses is available])
124	 	LIBS="-lncurses $LIBS"],
125	[
126    AC_CHECK_LIB(
127	[curses], [setupterm],
128	[	AC_DEFINE_UNQUOTED([HAVE_LIBCURSES], [1],
129				   [Define to 1 iff lib(n)curses is available])
130		LIBS="-lcurses $LIBS"])
131	])
132
133AC_CHECK_LIB([execinfo], [backtrace])
134AC_CHECK_LIB([m],        [acosh])
135AC_CHECK_LIB([pthread],  [sem_init])
136AC_CHECK_LIB([dl],       [dlopen])
137AC_CHECK_LIB([fftw3],    [fftw_plan_dft])
138AC_CHECK_LIB([xcb],      [xcb_connect])
139
140# check if SQLite3 is wanted and installed
141m4_include([m4/ax_lib_sqlite3.m4])            AX_LIB_SQLITE3([])
142if test "x$WANT1_SQLITE3" = "xyes"; then
143   AC_DEFINE_UNQUOTED([REALLY_WANT_SQLITE3], [1],
144                      [./configure with --with-sqlite3])
145fi
146
147
148# check if PostgreSQL is wanted and installed
149m4_include([m4/ax_lib_postgresql.m4])         AX_LIB_POSTGRESQL([])
150if test "x$want1_postgresql" = "xyes"; then
151   AC_DEFINE_UNQUOTED([REALLY_WANT_PostgreSQL], [1],
152                      [./configure with --with-postgresql])
153fi
154
155# check if PostgreSQL is usable (if present)
156if test "x$found_postgresql" = "xyes" ; then
157	AC_MSG_CHECKING([for PostgreSQL usability])
158	saved_CPPFLAGS="$CPPFLAGS"
159	CPPFLAGS="$CPPFLAGS $POSTGRESQL_CFLAGS"
160	AC_COMPILE_IFELSE(
161		[AC_LANG_PROGRAM([[@%:@include <libpq-fe.h>]],
162		[[PGconn *db = PQconnectdbParams( 0, 0, 1 );]])],
163		[USABLE_PostgreSQL=yes],
164		[USABLE_PostgreSQL=no])
165
166CPPFLAGS="$saved_CPPFLAGS"
167AC_MSG_RESULT([$USABLE_PostgreSQL])
168if test "x$USABLE_PostgreSQL" = "xyes"; then
169   AC_DEFINE_UNQUOTED([USABLE_PostgreSQL], [1], [PostgreSQL code compiles])
170fi
171fi
172
173# check if libxcb is installed
174PKG_CHECK_MODULES(XCBLIBS, [xcb >= 1.6], [HAVE_libxcb=yes], [HAVE_libxcb=no])
175AM_CONDITIONAL(HAVE_LIBXCB, test "$HAVE_libxcb" = yes)
176if test "$HAVE_libxcb" = yes; then
177   AC_DEFINE_UNQUOTED(HAVE_GTK3, [1], [libxcb is installed])
178else
179   AC_DEFINE_UNQUOTED(HAVE_GTK3, [0], [libxcb is NOT installed])
180fi
181
182# check if libpcre is installed
183m4_include([m4/ax_path_lib_pcre.m4])
184   AX_PATH_LIB_PCRE([])
185AM_CONDITIONAL(HAVE_LIBPCRE2_32,
186               test "x$ac_cv_lib_pcre2_32_pcre2_compile_32" = xyes)
187
188# check for GTK+ version 3
189#
190AC_ARG_WITH([gtk3], AS_HELP_STRING([--with-gtk3],
191     [enable ⎕GTK (interface to GTK+ version 3; needs libgtk-3 and more)]))
192PKG_CHECK_MODULES([GTK], [gtk+-3.0], [HAVE_gtk3=yes], [HAVE_gtk3=no])
193AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_gtk3" = xyes)
194if test "x$HAVE_gtk3" = xyes; then
195AC_DEFINE_UNQUOTED(HAVE_GTK3, [1], [GTK+ version 3 installed])
196else
197AC_DEFINE_UNQUOTED(HAVE_GTK3, [0], [GTK+ version 3 NOT installed])
198fi
199
200################################# rdtsc check #################################
201# check if rdtsc (read CPU cycle counter is available.
202# This is expected only on Intel CPUs
203AC_MSG_CHECKING([whether CPU has rdtsc (read CPU cycle counter) opcode])
204AC_COMPILE_IFELSE(
205        [AC_LANG_PROGRAM([[]],
206        [[unsigned int lo, hi;
207          __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));]]
208    )], [HAVE_rdtsc=yes], [HAVE_rdtsc=no])
209if test "x$HAVE_rdtsc" = "xyes"; then
210   AC_DEFINE_UNQUOTED([HAVE_RDTSC], [1],
211                      [Define to 1 iff the CPU has rdtsc opcode])
212fi
213AM_CONDITIONAL(HAVE_RDTSC, test "x$HAVE_rdtsc" = xyes)
214AC_MSG_RESULT([$HAVE_rdtsc])
215
216############################### sem_init() check ##############################
217# check if sem_init() works (it does not on OS-X)
218#
219apl_save_CXXFLAGS=$CXXFLAGS
220CXXFLAGS="-Wall -Werror"
221
222# This is expected only on Intel CPUs
223AC_MSG_CHECKING([whether sem_init() works])
224AC_COMPILE_IFELSE(
225        [AC_LANG_PROGRAM([[#include <semaphore.h>]],
226        [[sem_t sema;
227          sem_init(&sema, 0, 0);
228        ]]
229    )], [HAVE_SEM_INIT=yes], [HAVE_SEM_INIT=no])
230if test "x$HAVE_SEM_INIT" = "xyes"; then
231   AC_DEFINE_UNQUOTED([HAVE_SEM_INIT], [1], [Define to 1 iff sem_init() works])
232fi
233AM_CONDITIONAL(HAVE_SEM_INIT, test "x$HAVE_SEM_INIT" = xyes)
234CXXFLAGS=$apl_save_CXXFLAGS
235AC_MSG_RESULT([$HAVE_SEM_INIT])
236
237
238######################## pthread_getaffinity_np() check #######################
239# see if pthread_getaffinity_np() and pthread_setaffinity_np are available
240#
241AC_MSG_CHECKING([whether pthread_setaffinity_np is available])
242AC_COMPILE_IFELSE(
243    [AC_LANG_PROGRAM([ [#include <pthread.h>]
244                       [#include <ext/atomicity.h>]
245                     ],
246                     [ [cpu_set_t cpuset;]
247                       [pthread_setaffinity_np(0, sizeof(cpuset), &cpuset);]
248                       [pthread_getaffinity_np(0, sizeof(cpuset), &cpuset);]
249                       [_Atomic_word count = 0;]
250                       [__gnu_cxx::__exchange_and_add_dispatch(&count, 1);]
251                       [__gnu_cxx::__atomic_add_dispatch(&count, 1);]
252                     ])],
253    [HAVE_AFFINITY_NP=yes
254     AC_DEFINE_UNQUOTED([HAVE_AFFINITY_NP], [1],
255                        [Define to 1 iff pthread_setaffinity_np() is available])
256    ],
257    [HAVE_AFFINITY_NP=no])
258AM_CONDITIONAL(HAVE_AFFINITY_NP, test "x$HAVE_AFFINITY_NP" = xyes)
259AC_MSG_RESULT([$HAVE_AFFINITY_NP])
260
261############################### atomicity checks ##############################
262# check for alternatives for ext/atomicity.h on OS/X
263#
264AC_MSG_CHECKING([whether OSAtomicAdd32Barrier() is available])
265apl_save_CXXFLAGS=$CXXFLAGS
266CXXFLAGS="-Wall -Werror"
267AC_COMPILE_IFELSE(
268    [AC_LANG_PROGRAM([ [#include <libkern/OSAtomic.h>] ],
269                     [ [OSAtomicAdd32Barrier(0, 0);]   ])],
270    [HAVE_OSX_ATOMIC=yes
271     AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMIC], [1],
272                          [Define to 1 iff OSAtomicAdd32Barrier() is available])
273    ],
274    [HAVE_OSX_ATOMIC=no])
275CXXFLAGS=$apl_save_CXXFLAGS
276AC_MSG_RESULT([$HAVE_OSX_ATOMIC])
277
278
279# check for alternatives for ext/atomicity.h on Solaris
280#
281AC_MSG_CHECKING([whether atomic_add_32_nv() is available])
282AC_COMPILE_IFELSE(
283    [AC_LANG_PROGRAM([ [#include <atomic.h>] ],
284                     [ [atomic_add_32_nv(0, 0);]
285                       [atomic_add_32   (0, 0);]
286                     ])],
287    [HAVE_SOLARIS_ATOMIC=yes
288     AC_DEFINE_UNQUOTED([HAVE_SOLARIS_ATOMIC], [1],
289                          [Define to 1 iff atomic_add_32_nv() is available])
290    ],
291    [HAVE_SOLARIS_ATOMIC=no])
292AC_MSG_RESULT([$HAVE_SOLARIS_ATOMIC])
293
294
295# check if the user compiles for ANDROID
296#
297AC_MSG_CHECKING([if we are compiling for Android])
298user_wants_android=no
299AC_ARG_WITH( [android],
300             [AS_HELP_STRING([--with-android],
301                             [enable when compiling for Android])],
302             [user_wants_android=yes])
303
304if test "x$user_wants_android" = xyes ; then
305   AC_DEFINE([WANT_ANDROID], [1], [Define if compiling for Android])
306fi
307AM_CONDITIONAL(WANT_ANDROID, test "x$user_wants_android" = xyes)
308AC_MSG_RESULT([$user_wants_android])
309
310
311# check if the user wants the Erlang interface (and therefore also libapl)
312#
313AC_MSG_CHECKING([if we want to build an erlang interface (implies libapl.so)])
314user_wants_erlang=no
315AC_ARG_WITH( [erlang],
316             [AS_HELP_STRING([--with-erlang],
317                             [enable to build the Erlang interface])],
318             [user_wants_erlang=yes])
319
320if test "x$user_wants_libapl" = xyes ; then
321   AC_DEFINE([WANT_ERLANG], [1], [Define if building the Erlang interface])
322fi
323
324AM_CONDITIONAL(WANT_ERLANG, test "x$user_wants_erlang" = xyes)
325AC_MSG_RESULT([$user_wants_erlang])
326
327# check if the user wants to build libapl.so
328#
329AC_MSG_CHECKING([if we want to build libapl.so])
330user_wants_libapl=$user_wants_erlang   # Erlang needs libapl
331AC_ARG_WITH( [libapl],
332             [AS_HELP_STRING([--with-libapl],
333                             [enable to build libapl.so])],
334             [user_wants_libapl=yes])
335
336if test "x$user_wants_libapl" = xyes ; then
337   AC_DEFINE([WANT_LIBAPL], [1], [Define if building libapl.so])
338fi
339
340AM_CONDITIONAL(WANT_LIBAPL, test "x$user_wants_libapl" = xyes)
341AC_MSG_RESULT([$user_wants_libapl])
342
343# check if the user wants to build the python extension gnu_apl.so
344#
345AC_MSG_CHECKING([if we want to build libpython_apl.so])
346user_wants_python=no
347AC_ARG_WITH( [python],
348             [AS_HELP_STRING([--with-python],
349             [enable to build python extension lib_gnu_apl.so])],
350             [user_wants_python=yes])
351
352if test "x$user_wants_python" = xyes ; then
353   AC_DEFINE([WANT_PYTHON], [1], [Define if building lib_gnu_apl.so])
354fi
355AM_CONDITIONAL(WANT_PYTHON, test "x$user_wants_python" = xyes)
356
357AC_CONFIG_FILES([Makefile
358                 build/Makefile
359                 debian/Makefile
360                 debian/source/Makefile
361                 doc/Makefile
362                 erlang/Makefile
363                 erlang/apl.erl
364                 gnu-apl.d/Makefile
365                 gnu-apl.d/preferences
366                 HOWTOs/Makefile
367                 rpm/Makefile
368                 rpm/apl.spec
369                 src/Makefile
370                 src/APs/Makefile
371                 src/Gtk/Makefile
372                 src/emacs_mode/Makefile
373                 src/native/Makefile
374                 src/sql/Makefile
375                 src/testcases/Makefile
376                 src/workspaces/Makefile
377                 support-files/Makefile
378                 support-files/105-key-International-Keyboard/Makefile
379                 support-files/Dirk/Makefile
380                 support-files/Dyalog-Keyboard/Makefile
381                 support-files/Jürgen-Mint-19/Makefile
382                 support-files/old-Keyboard/Makefile
383                 support-files/OS-X-Keyboard/Makefile
384                 support-files/Unicomp-Keyboard/Makefile
385                 support-files/WASD-Keyboard/Makefile
386                 tools/Makefile
387                 websock/Makefile
388                 websock/client/Makefile
389                 websock/server/Makefile
390                 workspaces/Makefile
391                 wslib3/Makefile
392                 wslib4/Makefile
393                 wslib5/Makefile
394                 wslib5/APLComponentFiles/Makefile
395                 wslib5/iso-apl-cf/Makefile
396                ])
397
398# AM_CXXFLAGS: do/dont -Werror ?
399AC_ARG_VAR(CXX_WERROR,
400   [ turn warnings into errors (compiler flag -Werror) default: yes) ])
401if test "x$CXX_WERROR" = "xno"; then CXX_WERROR="";
402                                else CXX_WERROR="-Werror"; fi
403
404# APL: development configuration desired ? Set this before other xxx_WANTED
405# options so that the implied xxx_WANTED options set here can be overridden
406# further down
407AC_ARG_VAR(DEVELOP_WANTED,
408   [ set development options (see README-2-configure) default: no])
409if test "x$DEVELOP_WANTED" = "xyes"; then
410   AC_DEFINE_UNQUOTED([DEVELOP_WANTED], [yes],
411                   [define to set options typical for software development])
412   ASSERT_LEVEL_WANTED=2
413   DYNAMIC_LOG_WANTED=yes
414   PERFORMANCE_COUNTERS_WANTED=yes
415   RATIONAL_NUMBERS_WANTED=yes
416   VALUE_CHECK_WANTED=yes
417   VALUE_HISTORY_WANTED=yes
418fi
419
420# APL: max. rank ?
421AC_ARG_VAR(MAX_RANK_WANTED,
422   [ the max. Rank of APL values (see README-2-configure) default: 8) ])
423if test "x$MAX_RANK_WANTED" = "x"; then MAX_RANK_WANTED=8; fi
424AC_DEFINE_UNQUOTED([MAX_RANK_WANTED], [$MAX_RANK_WANTED],
425                   [max. rank of APL values ])
426
427
428# APL: CHECK() macro desired ?
429AC_ARG_VAR(VALUE_CHECK_WANTED,
430   [ enable CHECK() macro (see README-2-configure) default: no ])
431if test "x$VALUE_CHECK_WANTED" = "xyes"; then
432AC_DEFINE_UNQUOTED([VALUE_CHECK_WANTED], [yes],
433                   [ define to enable CHECK macro ])
434fi
435
436
437# APL: performance counters desired ?
438AC_MSG_CHECKING([whether internal performance counters shall be enabled)])
439AC_ARG_VAR(PERFORMANCE_COUNTERS_WANTED,
440   [ enable performance counters (see README-2-configure) default: no ])
441if test "x$PERFORMANCE_COUNTERS_WANTED" = "xyes"; then
442AC_DEFINE_UNQUOTED([PERFORMANCE_COUNTERS_WANTED], [yes],
443                   [ define to enable performance counters ])
444else PERFORMANCE_COUNTERS_WANTED="no"
445fi
446AC_MSG_RESULT([$PERFORMANCE_COUNTERS_WANTED])
447
448
449# APL: ADD_EVENT() macro and friends desired ?
450AC_MSG_CHECKING([whether to remember the history of APL values (debug feature)])
451AC_ARG_VAR(VALUE_HISTORY_WANTED,
452   [ enable value events (a debug facility, see README-2-configure) default: no ])
453if test "x$VALUE_HISTORY_WANTED" = "xyes"; then
454AC_DEFINE_UNQUOTED([VALUE_HISTORY_WANTED], [yes],
455                   [ define to enable value events])
456else VALUE_HISTORY_WANTED="no"
457fi
458AC_MSG_RESULT([$VALUE_HISTORY_WANTED])
459
460
461# APL: gprof profiling ?
462AC_MSG_CHECKING([whether gprof profiling shall be enabled])
463AC_ARG_VAR(GPROF_WANTED,
464   [ enable gprof (-pg) (see README-2-configure) default: no ])
465if test "x$GPROF_WANTED" = "xyes"; then
466   GPROF_WANTED="-pg"
467   AC_MSG_RESULT([yes])
468else
469   GPROF_WANTED=
470   AC_MSG_RESULT([no])
471fi
472
473# APL: gcov coverage testing ?
474AC_MSG_CHECKING([whether gcov coverage testing shall be enabled])
475AC_ARG_VAR(GCOV_WANTED,
476   [ enable gcov (-fprofile-arcs and -ftest-coverage) (see README-2-configure) default: no ])
477if test "x$GCOV_WANTED" = "xyes"; then
478   GCOV_WANTED="--coverage"
479   AC_MSG_RESULT([yes])
480else
481   GCOV_WANTED=
482   AC_MSG_RESULT([no])
483fi
484
485AC_DEFINE_UNQUOTED([GPROF_WANTED], [-pg],
486                   [ define to enable gprof profiling ])
487
488
489# APL: dynamic logging desired ?
490AC_MSG_CHECKING([whether dynamic logging shall be enabled])
491AC_ARG_VAR(DYNAMIC_LOG_WANTED,
492   [ enable dynamic logging (see README-2-configure) default: no ])
493if test "x$DYNAMIC_LOG_WANTED" = "xyes"; then
494AC_DEFINE_UNQUOTED([DYNAMIC_LOG_WANTED], [yes],
495                   [ define to enable dynamic logging ])
496else DYNAMIC_LOG_WANTED="no"
497fi
498AC_MSG_RESULT([$DYNAMIC_LOG_WANTED])
499
500
501# APL: tracing of value flags (produces lots of messages) desired ?
502AC_MSG_CHECKING([whether value flags shall be traced])
503AC_ARG_VAR(VF_TRACING_WANTED,
504   [ enable tracing of value flags (see README-2-configure) default: no ])
505if test "x$VF_TRACING_WANTED" = "xyes"; then
506AC_DEFINE_UNQUOTED([VF_TRACING_WANTED], [yes],
507                   [ define to enable tracing of value flags ])
508else VF_TRACING_WANTED="no"
509fi
510AC_MSG_RESULT([$VF_TRACING_WANTED])
511
512
513# APL: desired assert level ?
514AC_MSG_CHECKING([how picky internal tests shall be])
515AC_ARG_VAR(ASSERT_LEVEL_WANTED,
516   [ Assert level (see README-2-configure) default: 1) ])
517if test "x$ASSERT_LEVEL_WANTED" = "x"; then ASSERT_LEVEL_WANTED=1; fi
518AC_DEFINE_UNQUOTED([ASSERT_LEVEL_WANTED], [$ASSERT_LEVEL_WANTED],
519                   [assert level])
520AC_MSG_RESULT([$ASSERT_LEVEL_WANTED])
521
522# APL: desired security level ?
523AC_MSG_CHECKING([security level (0=none, 1=configured in preferences, 2=all)])
524AC_ARG_VAR(SECURITY_LEVEL_WANTED,
525   [ Assert level (see README-2-configure) default: 0) ])
526if test "x$SECURITY_LEVEL_WANTED" = "x"; then SECURITY_LEVEL_WANTED=0; fi
527AC_DEFINE_UNQUOTED([SECURITY_LEVEL_WANTED], [$SECURITY_LEVEL_WANTED],
528                   [security level])
529AC_MSG_RESULT([$SECURITY_LEVEL_WANTED])
530
531# APL: number of cores ?
532AC_MSG_CHECKING([how many CPU cores shall be used by APL (experimental!)])
533AC_ARG_VAR(CORE_COUNT_WANTED,
534   [ Core count (see README-2-configure) default: 0) ])
535if test "x$CORE_COUNT_WANTED" = "x";     then CORE_COUNT_WANTED=0;  fi
536if test "x$CORE_COUNT_WANTED" = "xall";  then CORE_COUNT_WANTED=-1; fi
537if test "x$CORE_COUNT_WANTED" = "xALL";  then CORE_COUNT_WANTED=-1; fi
538if test "x$CORE_COUNT_WANTED" = "xargv"; then CORE_COUNT_WANTED=-2; fi
539if test "x$CORE_COUNT_WANTED" = "xARGV"; then CORE_COUNT_WANTED=-2; fi
540if test "x$CORE_COUNT_WANTED" = "xsyl";  then CORE_COUNT_WANTED=-3; fi
541if test "x$CORE_COUNT_WANTED" = "xSYL";  then CORE_COUNT_WANTED=-3; fi
542AC_DEFINE_UNQUOTED([CORE_COUNT_WANTED], [$CORE_COUNT_WANTED],
543                   [core count])
544AC_MSG_RESULT([$CORE_COUNT_WANTED])
545
546# APL: APserver transport ?
547AC_MSG_CHECKING([which type of socket APserver shall use])
548AC_ARG_VAR(APSERVER_TRANSPORT,
549   [ APserver transport (see README-2-configure) default: TCP) ])
550if test "x$APSERVER_TRANSPORT" = "x";        then APSERVER_TRANSPORT=0;  fi
551if test "x$APSERVER_TRANSPORT" = "xTCP";     then APSERVER_TRANSPORT=0;  fi
552if test "x$APSERVER_TRANSPORT" = "xLINUX";   then APSERVER_TRANSPORT=1;  fi
553if test "x$APSERVER_TRANSPORT" = "xUNIX";    then APSERVER_TRANSPORT=2;  fi
554AC_DEFINE_UNQUOTED([APSERVER_TRANSPORT], [$APSERVER_TRANSPORT],
555                   [APserver transport: TCP=0, LINUX=1, UNIX=2])
556AC_MSG_RESULT([$APSERVER_TRANSPORT])
557
558# APL: APserver TCP port ?
559AC_MSG_CHECKING([which port number APserver shall use for TCP or UDP sockets])
560AC_ARG_VAR(APSERVER_PORT,
561   [ APserver transport (see README-2-configure) default: 16366) ])
562if test "x$APSERVER_PORT" = "x";   then APSERVER_PORT=16366;  fi
563AC_DEFINE_UNQUOTED([APSERVER_PORT], [$APSERVER_PORT],
564                   [APserver TCP listen port])
565AC_MSG_RESULT([$APSERVER_PORT])
566
567# APL: APserver port name ?
568AC_MSG_CHECKING([which port name APserver shall use for unix ports])
569AC_ARG_VAR(APSERVER_PATH,
570   [ APserver transport (see README-2-configure) default: /tmp/GNU-APL/APserver) ])
571if test "x$APSERVER_PATH" = "x";   then APSERVER_PATH="/tmp/GNU-APL/APserver";  fi
572AC_DEFINE_UNQUOTED([APSERVER_PATH], ["$APSERVER_PATH"],
573                   [APserver listen port name])
574AC_MSG_RESULT([$APSERVER_PATH])
575
576# APL: desired cellcount of short values ?
577AC_MSG_CHECKING([how long a short APL value shall be at most])
578AC_ARG_VAR(SHORT_VALUE_LENGTH_WANTED,
579    [ Cellcount of short values (see README-2-configure) default: 12) ])
580if test "x$SHORT_VALUE_LENGTH_WANTED" = "x"; then SHORT_VALUE_LENGTH_WANTED=12; fi
581AC_DEFINE_UNQUOTED([SHORT_VALUE_LENGTH_WANTED], [$SHORT_VALUE_LENGTH_WANTED],
582                   [short value cellcount])
583AC_MSG_RESULT([$SHORT_VALUE_LENGTH_WANTED])
584
585
586# APL: visible markers (debug only option) ?
587AC_MSG_CHECKING([whether visible markers shall be used])
588AC_ARG_VAR(VISIBLE_MARKERS_WANTED,
589   [ enable visible formatting markers (debug facility, see README-2-configure) default: no ])
590if test "x$VISIBLE_MARKERS_WANTED" = "xyes"; then
591AC_DEFINE_UNQUOTED([VISIBLE_MARKERS_WANTED], [yes],
592                   [ define to have visible markers (DONT!)])
593else VISIBLE_MARKERS_WANTED="no"
594fi
595AC_MSG_RESULT([$VISIBLE_MARKERS_WANTED])
596
597# APL: support for rational numbers ?
598AC_MSG_CHECKING([whether support for rational numbers is desired ])
599AC_ARG_VAR(RATIONAL_NUMBERS_WANTED,
600   [ enable support for rational numbers (see README-2-configure) default: no ])
601if test "x$RATIONAL_NUMBERS_WANTED" = "xyes"; then
602AC_DEFINE_UNQUOTED([RATIONAL_NUMBERS_WANTED], [yes],
603                   [ define to have support for rational numbers (EXPERIMENTAL!)])
604else RATIONAL_NUMBERS_WANTED="no"
605fi
606AC_MSG_RESULT([$VISIBLE_MARKERS_WANTED])
607
608# check if we are on i686 (to fix a strange rpmbuild problem
609AC_MSG_CHECKING([whether we compile for an i686 CPU])
610AM_CONDITIONAL([ON_i686], [test `uname -m` = i686])
611if test `uname -m` = "i686" ; then
612    AC_MSG_RESULT([yes])
613else
614    AC_MSG_RESULT([no])
615fi
616
617# check if we want development options
618AM_CONDITIONAL([DEVELOP],  [test x$DEVELOP_WANTED    = xyes])
619AM_CONDITIONAL([SQLITE3],  [test x$found_sqlite      = xyes])
620AM_CONDITIONAL([POSTGRES], [test x$USABLE_PostgreSQL = xyes])
621
622echo
623AC_OUTPUT
624
625echo
626
627# create src/buildtag.hh
628#
629echo "configure: creating $srcdir/src//buildtag.hh"
630rm -f $srcdir/src/buildtag.hh
631cd $srcdir/src ; . ./buildtag ; cd ..
632
633# create src/makefile.h
634#
635echo "configure: creating $srcdir/src/makefile.h"
636rm -f $srcdir/src/makefile.h
637make -C $srcdir/src makefile.h >/dev/null
638
639# remember how ./configure was called
640echo "configure: creating $srcdir/src/configure_args.cc"
641echo "extern const char * configure_args;" > $srcdir/src/configure_args.cc
642echo "const char * configure_args = \
643              \"$0 $ac_configure_args\";" >> $srcdir/src/configure_args.cc
644
645# summary
646  echo " "
647if test "x$USABLE_PostgreSQL" != "xyes" -a "x$want1_postgresql" = "xyes"; then
648  echo "NOTE: PostgreSQL support was requested, but the native function for "
649  echo "      accessing PostgreSQL cannot be built because your PostgreSQL "
650  echo "      installation appears to be missing or incomplete (see details above)"
651  echo " "
652fi
653
654 if test "x$found_sqlite" != "xyes" -a "x$WANT1_SQLITE3" = "xyes"; then
655  echo "NOTE: SQLite support was requested, but the native function for "
656  echo "      accessing SQLite cannot not be built because your SQLite "
657  echo "      installation appears to be missing or incomplete (see details above)"
658  echo " "
659fi
660
661echo "configure: saving configure options in $srcdir/configure_options"
662echo "$configure_options" > $srcdir/configure_options
663
664