-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.in
516 lines (459 loc) · 10.9 KB
/
configure.in
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
dnl Process this file with autoconf to produce a configure script.
# Check this is the right package
AC_INIT(src/qem.h)
#
# Ensure that all messages are saved to a file `configure.log' by
# invoking ourself recursively without output piped into `tee configure.log'.
# The environment variable `SUPPRESS_LOG_FILE_RECURSION' is used to prevent
# infinite recursion.
#
#if test "$SUPPRESS_LOG_FILE_RECURSION" != "yes"; then
# SUPPRESS_LOG_FILE_RECURSION=yes
# export SUPPRESS_LOG_FILE_RECURSION
# trap 0 1 2 3 13 15
# case $# in
# 0) exec ${CONFIG_SHELL-/bin/sh} "$0" ;;
# *) exec ${CONFIG_SHELL-/bin/sh} "$0" "$@" ;;
# esac | exec tee configure.log
# exit
#fi
#
# Check for addtional command line options.
#
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging])
if test "$enable_debug" = yes; then
DEBUGGING=
else
DEBUGGING=" -DNDEBUG "
fi
AC_SUBST(DEBUGGING)
# Single versus multiple thread configuraation.
AC_ARG_ENABLE(multiple-threads, [ --disable-multiple-threads Single Prolog thread per process ])
if test "$enable_multiple_threads" != no; then
# Multiple threads is the default.
AC_DEFINE(MULTIPLE_THREADS)
else
AC_MSG_WARN(Configuring for single Prolog thread per process)
fi
AC_LANG_CPLUSPLUS
AC_CONFIG_HEADER(config.h)
dnl Which os are we on?
AC_CANONICAL_HOST
FULLARCH="$host"
dnl Which directory are we in?
QPHOME=`pwd`
AC_SUBST(QPHOME)
case "$host" in
arm*-*-linux*) AC_DEFINE(LINUX)
AC_DEFINE(ARM)
OS=LINUX
;;
*-*-linux*) AC_DEFINE(LINUX)
OS=LINUX
;;
*-*-solaris*) AC_DEFINE(SOLARIS)
OS=SOLARIS
;;
*-*-freebsd*) AC_DEFINE(FREEBSD)
OS=FREEBSD
;;
*-*-darwin*) AC_DEFINE(MACOSX)
OS=MACOSX
;;
*) AC_DEFINE(FREEBSD)
OS=FREEBSD
;;
esac
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LEX
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_YACC
AC_PATH_PROG(CMP, cmp, /usr/bin/cmp, $PATH:/bin:/usr/bin:/usr/local/bin)
AC_PATH_PROG(QPPP, cpp, NO_CPP,\
$PATH:/lib:/usr/lib:/usr/local/lib:\
/ccs/lib:/usr/ccs/lib:/usr/local/ccs/lib)
if
test $QPPP = NO_CPP
then
AC_MSG_WARN(No cpp per se, I'll try to use gcc -E)
QPPP=$QPHOME/bin/qppp
cp $QPHOME/bin/qppp.gcc.in $QPPP.in
else
cp $QPHOME/bin/qppp.cpp.in $QPHOME/bin/qppp.in
AC_MSG_CHECKING(whether cpp needs -traditional flag for QP chars)
cat > conftest.ql << EOF
0'x
EOF
if
echo $QPPP conftest.ql >&AC_FD_CC 2>&1 &&
$QPPP conftest.ql >&AC_FD_CC 2>&1
then
QPPP_TRADITIONAL=
result=no
else
if
echo "$QPPP -traditional" >&AC_FD_CC 2>&1 &&
$QPPP -traditional conftest.ql >&AC_FD_CC 2>&1
then
QPPP_TRADITIONAL=-traditional
result=yes
else
AC_MSG_ERROR(can't compile QP on this system!)
fi
fi
AC_MSG_RESULT($result)
AC_SUBST(QPPP_TRADITIONAL)
fi
AC_PATH_PROG(PERL, perl, NO_PERL,\
$PATH:/bin:/usr/bin:/usr/local/bin:/usr/local/perl/bin)
if test "$PERL" = NO_PERL; then
AC_MSG_ERROR(perl is required to compile QP)
fi
GCCINCLUDES=
AC_ARG_WITH(gcclib,
[--with-gcclib Indicate location of gcc STL includes],
[GCCINCLUDES=-I${withval}],
[GCCINCLUDES= ])
AC_SUBST(GCCINCLUDES)
if test "$OS" = MACOSX; then
XQP=$QPHOME/src/xqp/xqp.app/Contents/MacOS/xqp
XQPDEBUG=$QPHOME/src/xqpdebug/xqpdebug.app/Contents/MacOS/xqpdebug
else
XQP=$QPHOME/src/xqp/xqp
XQPDEBUG=$QPHOME/src/xqpdebug/xqpdebug
fi
AC_SUBST(XQP)
AC_SUBST(XQPDEBUG)
AC_PATH_PROG(PRINTF, printf, NO_PRINTF,\
$PATH:/bin:/usr/bin:/usr/local/bin:$HOME/bin)
if test "$PRINTF" = NO_PRINTF; then
AC_MSG_ERROR(The program printf is required to compile QP)
fi
dnl Checks for libraries.
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(posix4, main)
AC_CHECK_LIB(socket, socket)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(\
arpa/inet.h \
fcntl.h \
limits.h \
malloc.h \
netinet/in.h \
sys/file.h \
sys/ioctl.h \
sys/time.h \
sys/filio.h \
sys/sockio.h \
unistd.h \
)
dnl Checks for typedefs, structures, and compiler characteristics.
#AC_C_CONST
#AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS( \
gethostname \
gethostbyname \
poll \
putenv \
select \
sigwait \
sigtimedwait \
socket \
strerror \
strstr \
uname \
)
#----------------------------------------------------------------------------
dnl Check for CPP version
#AC_MSG_CHECKING([for GCC version])
#qp_cpp_ver=[`gcc --version 2>/dev/null | head -1 | sed -e 's/^[^[:digit:]]*\([[:digit:]][^[:space:]]*\).*$/\1/'`]
#if test -n "$qp_cpp_ver"; then
# AC_MSG_RESULT($qp_cpp_ver)
# case "$qp_cpp_ver" in
# 2.*)
# AC_DEFINE(GCC_VERSION_2, 1, [Whether or not the GCC is gcc 2])
# ;;
# esac
#else
# AC_MSG_RESULT(not found)
# AC_MSG_ERROR(Could not determine GCC version)
#fi
#
#-----------------------------------------------------------------------------
dnl Check for -fno-strict-aliasing
AC_MSG_CHECKING([for -fno-strict-aliasing])
echo "int i;" > aliasing_test.cc
qp_alias=[`gcc -fno-strict-aliasing -c aliasing_test.cc`]
rm aliasing_test.*
if test -n "$qp_alias"; then
AC_MSG_RESULT(not found)
GCC_ALIAS_FLAG=
else
AC_MSG_RESULT(found)
GCC_ALIAS_FLAG="-fno-strict-aliasing"
fi
AC_SUBST(GCC_ALIAS_FLAG)
#-----------------------------------------------------------------------------
AC_MSG_CHECKING(for an integer type with at least 16 bits)
AC_CACHE_VAL(qp_cv_short_type,
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen("conftest.short", "w");
if (fp == NULL)
exit(1);
if (sizeof(short) >= 2)
{
fprintf(fp, "short\n");
exit(0);
}
if (sizeof(int) >= 2)
{
fprintf(fp, "int\n");
exit(0);
}
if (sizeof(long) >= 2)
{
fprintf(fp, "long\n");
exit(0);
}
fprintf(fp, "unknown\n");
exit(1);
}],
[qp_cv_short_type=`cat conftest.short`],
[qp_cv_short_type=unknown],
[qp_cv_short_type=unknown])
)
if test "$qp_cv_short_type" = unknown; then
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen("conftest.short", "w");
if (fp == NULL)
exit(1);
if (sizeof(long long) >= 2)
{
fprintf(fp, "long long\n");
exit(0);
}
fprintf(fp, "unknown\n");
exit(1);
}],
[qp_cv_short_type=`cat conftest.short`],
[qp_cv_short_type=unknown],
[qp_cv_short_type=unknown])
fi
AC_MSG_RESULT($qp_cv_short_type)
AC_DEFINE_UNQUOTED(SHORT_TYPE, $qp_cv_short_type)
SHORT_TYPE=$qp_cv_short_type
AC_SUBST(SHORT_TYPE)
#------------------------------------------------------------------------------
AC_MSG_CHECKING(for an integer type with at least 32 bits)
AC_CACHE_VAL(qp_cv_int_type,
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen("conftest.int", "w");
if (fp == NULL)
exit(1);
if (sizeof(short int) >= 4)
{
fprintf(fp, "short int\n");
exit(0);
}
if (sizeof(int) >= 4)
{
fprintf(fp, "int\n");
exit(0);
}
if (sizeof(long) >= 4)
{
fprintf(fp, "long\n");
exit(0);
}
fprintf(fp, "unknown\n");
exit(1);
}],
[qp_cv_int_type=`cat conftest.int`],
[qp_cv_int_type=unknown],
[qp_cv_int_type=unknown])
)
if test "$qp_cv_int_type" = unknown; then
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen("conftest.int", "w");
if (fp == NULL)
exit(1);
if (sizeof(long long) >= 4)
{
fprintf(fp, "long long\n");
exit(0);
}
fprintf(fp, "unknown\n");
exit(1);
}],
[qp_cv_int_type=`cat conftest.int`],
[qp_cv_int_type=unknown],
[qp_cv_int_type=unknown])
fi
AC_MSG_RESULT($qp_cv_int_type)
AC_DEFINE_UNQUOTED(INT_TYPE, $qp_cv_int_type)
INT_TYPE=$qp_cv_int_type
AC_SUBST(INT_TYPE)
#------------------------------------------------------------------------------
AC_MSG_CHECKING(the number of bytes per word)
AC_CACHE_VAL(qp_cv_bytes_per_word,
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen("conftest.wordbytes", "w");
if (fp == NULL)
exit(1);
fprintf(fp, "%d\n", sizeof(void *));
exit(0);
}],
[qp_cv_bytes_per_word=`cat conftest.wordbytes`],
[qp_cv_bytes_per_word=0],
[qp_cv_bytes_per_word=0])
)
AC_MSG_RESULT($qp_cv_bytes_per_word)
AC_DEFINE_UNQUOTED(BYTES_PER_WORD, $qp_cv_bytes_per_word)
BYTES_PER_WORD=$qp_cv_bytes_per_word
AC_SUBST(BYTES_PER_WORD)
#------------------------------------------------------------------------------
AC_MSG_CHECKING(the number of bits per word)
AC_CACHE_VAL(qp_cv_bits_per_word,
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main() {
FILE *fp;
fp = fopen("conftest.wordbits", "w");
if (fp == NULL)
exit(1);
fprintf(fp, "%d\n", CHAR_BIT * sizeof(void *));
exit(0);
}],
[qp_cv_bits_per_word=`cat conftest.wordbits`],
[qp_cv_bits_per_word=0],
[qp_cv_bits_per_word=0])
)
AC_MSG_RESULT($qp_cv_bits_per_word)
AC_DEFINE_UNQUOTED(BITS_PER_WORD, $qp_cv_bits_per_word)
BITS_PER_WORD=$qp_cv_bits_per_word
AC_SUBST(BITS_PER_WORD)
#------------------------------------------------------------------------------
#-----------------------------------------------------------------------------#
AC_MSG_CHECKING(whether we can use gcc labels)
AC_CACHE_VAL(qp_cv_gcc_labels,
AC_TRY_RUN([
void *entry_foo_1;
void *entry_bar_1;
void *succip;
int global;
foo() {
entry_foo_1 = && foo_1;
return;
foo_1:
if (global != 42) exit(1);
goto *entry_bar_1;
}
bar() {
entry_bar_1 = && bar_1;
return;
bar_1:
if (global != 42) exit(1);
goto *succip;
}
main() {
global = 42;
foo();
bar();
succip = &&last;
goto *entry_foo_1;
exit(1);
last:
if (global != 42) exit(1);
exit(0);
}], [qp_cv_gcc_labels=yes], [qp_cv_gcc_labels=no],
[qp_cv_gcc_labels=no])
)
AC_MSG_RESULT($qp_cv_gcc_labels)
if test "$qp_cv_gcc_labels" = yes; then
AC_DEFINE(HAVE_GCC_LABELS)
fi
AC_MSG_CHECKING(whether pkg-config finds the PCRE library)
if pkg-config --exists libpcre; then
AC_DEFINE(PCRE)
else
AC_MSG_WARN(The PCRE library was not found using pkg-config)
fi
#------------------------------------------------------------------------------
AC_OUTPUT(LOGIN_CMDS \
Makefile \
PROFILE_CMDS \
bin/Makefile \
bin/kq \
bin/qc \
bin/qc1.boot \
bin/qcc \
bin/qppp \
prolog/Makefile \
prolog/compiler/Makefile \
prolog/library/Makefile \
prolog/qc1/Makefile \
prolog/qecat/Makefile
prolog/qg/Makefile \
prolog/qp/Makefile \
src/Makefile \
src/Makefile.heap \
src/Makefile.ipc \
src/Makefile.library \
src/Makefile.psi \
src/Makefile.qa \
src/Makefile.qdeal \
src/Makefile.qem \
src/Makefile.ql \
src/Makefile.qod \
src/Makefile.thread \
)
chmod -f a+x bin/kq \
bin/qc \
bin/qc1.boot \
bin/qcc \
bin/qppp \
echo
echo
echo
echo "*********************************************************************"
echo "Command history/editing/completion can be used if rlwrap is installed"
echo "*********************************************************************"
echo
echo
echo