~burner/xsb/debianized-xsb

« back to all changes in this revision

Viewing changes to build/configure.in

  • Committer: Michael R. Head
  • Date: 2006-09-06 22:11:55 UTC
  • Revision ID: burner@n23-20060906221155-7e398d23438a7ee4
Add the files from the 3.0.1 release package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## File:      configure.in
 
2
## Author(s): kifer
 
3
## Contact:   xsb-contact@cs.sunysb.edu
 
4
##
 
5
## Copyright (C) The Research Foundation of SUNY, 1998
 
6
##
 
7
## XSB is free software; you can redistribute it and/or modify it under the
 
8
## terms of the GNU Library General Public License as published by the Free
 
9
## Software Foundation; either version 2 of the License, or (at your option)
 
10
## any later version.
 
11
##
 
12
## XSB is distributed in the hope that it will be useful, but WITHOUT ANY
 
13
## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
14
## FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
 
15
## more details.
 
16
##
 
17
## You should have received a copy of the GNU Library General Public License
 
18
## along with XSB; if not, write to the Free Software Foundation,
 
19
## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
##
 
21
## $Id: configure.in,v 1.187 2006/06/25 01:08:48 harpreet_singh Exp $
 
22
##
 
23
##
 
24
 
 
25
dnl  Autoconf script for XSB
 
26
dnl  To rebuild the `configure' script from this, execute the command
 
27
dnl     autoconf
 
28
dnl  in the directory containing this script.
 
29
dnl
 
30
dnl
 
31
 
 
32
 
 
33
AC_PREREQ(2.12)dnl
 
34
 
 
35
AC_INIT(../emu/emuloop.c)
 
36
dnl
 
37
 
 
38
if test -f buildxsb.lock ; then
 
39
   echo "***Build lock exists: another configure/makexsb is probably running.
 
40
***Wait until the previous build is complete.
 
41
***If this is a stale lock, remove ./buildxsb.lock and run configure again."
 
42
   exit 1
 
43
fi
 
44
 
 
45
SHELL=/bin/sh
 
46
 
 
47
build_dir="`pwd`"
 
48
 
 
49
# strip the last directory and possibly trailing slashes
 
50
topdir=`echo "${build_dir}" | sed 's,/[[^/]][[^/]]*/*$,,'`
 
51
 
 
52
 
 
53
AC_CONFIG_AUX_DIR($build_dir)
 
54
 
 
55
# Needed by the xsb_config.h file
 
56
AC_DEFINE(CONFIG_INCLUDED)
 
57
AC_DEFINE(___ALWAYS_TRUE___)
 
58
 
 
59
 
 
60
AC_ARG_WITH(gcc,
 
61
[  --with-gcc                   use GCC to compile XSB])
 
62
AC_ARG_WITH(cc,
 
63
[  --with-cc                    use CC to compile XSB])
 
64
AC_ARG_WITH(acc,
 
65
[  --with-acc                   use ACC to compile XSB])
 
66
AC_ARG_WITH(os,
 
67
[  --with-os=wind               build XSB for Windows NT/95/98])
 
68
AC_ARG_WITH(wind,
 
69
[  --with-wind                  build XSB for Windows NT/95/98])
 
70
AC_ARG_WITH(libwww,
 
71
[  --with-libwww=DIR            the libwww library used for Web access is at DIR])
 
72
AC_ARG_WITH(xpath,
 
73
[  --with-xpath=DIR             the libxml2 library used for XPath is at DIR])
 
74
AC_ARG_WITH(dbdrivers,
 
75
[  --with-dbdrivers             configure dbdrivers package])
 
76
AC_ARG_WITH(oracle,
 
77
[  --with-oracle                compile with support of Oracle])
 
78
AC_ARG_WITH(odbc,
 
79
[  --with-odbc                  compile with support for ODBC])
 
80
AC_ARG_WITH(iodbc,
 
81
[  --with-iodbc                 use iODBC driver manager])
 
82
AC_ARG_WITH(interprolog,
 
83
[  --with-interprolog           compile with support for InterProlog.
 
84
                                It is possible you would need to use --site-includes
 
85
                                option to specify locations of jni.h and jni_md.h
 
86
                                files])
 
87
AC_ARG_WITH(smodels,
 
88
[  --with-smodels=path          use SMODELS for the XNMR module.
 
89
                                path is the path where smodels has
 
90
                                been installed and compiled])
 
91
AC_ARG_WITH(itkwish,
 
92
[  --with-itkwish=DIR                   DIR where the itkwish shell is located])
 
93
 
 
94
 
 
95
AC_ARG_ENABLE(no-cygwin,
 
96
[  --enable-no-cygwin           compiled with option -mno-cygwin (default: enabled)], ,
 
97
                            enable_no_cygwin=yes)
 
98
AC_ARG_ENABLE(general-tagging,
 
99
[  --enable-general-tagging     When this option is enabled XSB will determine
 
100
                               which bits in the address to tag during
 
101
                               runtime. This option is required for Linux
 
102
                               kernels > 2.6], general_tagging=yes)
 
103
AC_ARG_ENABLE(debug,
 
104
[  --enable-debug               compile with debugging turned on])
 
105
AC_ARG_ENABLE(debug-verbose,
 
106
[  --enable-debug-verbose       compile with verbose messages])
 
107
AC_ARG_ENABLE(debug-vm,
 
108
[  --enable-debug-vm            compile with VM-level debugging])
 
109
AC_ARG_ENABLE(debug-assertions,
 
110
[  --enable-debug-assertions    compile with debug assertions])
 
111
AC_ARG_ENABLE(dwarf-debug,
 
112
[  --enable-dwarf-debug         compile with extra (macro) debugging turned on])
 
113
AC_ARG_ENABLE(oracle-debug,
 
114
[  --enable-oracle-debug        compile with Oracle debugging turned on])
 
115
AC_ARG_ENABLE(profile,
 
116
[  --enable-profile             compile with profiling turned on])
 
117
AC_ARG_ENABLE(optimization,
 
118
[  --disable-optimization       compile with no optimization (default: enabled)],
 
119
                 disable_optimization=yes)
 
120
AC_ARG_ENABLE(batched-scheduling,
 
121
[  --enable-batched-scheduling  compile using the batched scheduling strategy;
 
122
                                default is the local strategy])
 
123
dnl AC_ARG_ENABLE(local-scheduling,
 
124
dnl [  --enable-local-scheduling  compile using the local scheduling strategy;
 
125
dnl                          default is the batched strategy])
 
126
dnl AC_ARG_ENABLE(local-scheduling,
 
127
dnl [  --with-local-scheduling  compile using the local scheduling strategy;
 
128
dnl                         default is the batched strategy])
 
129
dnl Allow some slack in how local scheduling is specified
 
130
AC_ARG_ENABLE(gc-test,
 
131
[  --enable-gc-test             stress-test the garbage collector (for developers)])
 
132
AC_ARG_ENABLE(demand,
 
133
[  --enable-demand              compile with demand support])
 
134
AC_ARG_ENABLE(jumptable,
 
135
[  --disable-jumptable          disables the jumptable-based emulator loop],
 
136
                   disable_jumptable=yes)
 
137
AC_ARG_ENABLE(mt,
 
138
[  --enable-mt                  compile multithreaded engine])
 
139
AC_ARG_ENABLE(fast-floats,
 
140
[  --enable-fast-floats         compile with single precision floats],
 
141
                   fast_floats=yes)
 
142
AC_ARG_ENABLE(ccmpl,
 
143
[  --enable-ccmpl                 compile mt engine with concurrent completion])
 
144
AC_ARG_ENABLE(profiling,
 
145
[  --enable-profiling           force gcc to generate information for profiling])
 
146
AC_ARG_ENABLE(electric-fence,
 
147
[  --enable-electric-fence      link with the electric fence malloc debugger])
 
148
 
 
149
if test "${fast_floats}" = "yes" ; then
 
150
   AC_DEFINE(FAST_FLOATS)
 
151
fi
 
152
 
 
153
if test "${with_debug}" = "yes" ; then
 
154
   enable_debug=yes
 
155
fi
 
156
 
 
157
if test "${with_debugging}" = "yes" ; then
 
158
   enable_debug=yes
 
159
fi
 
160
 
 
161
if test "${enable_dwarf_debug}" = "yes" ; then
 
162
   with_dwarf_debug=yes
 
163
fi
 
164
 
 
165
if test "${with_dwarf_debug}" = "yes" ; then
 
166
   enable_debug=yes
 
167
   enable_dwarf_debug=yes
 
168
fi
 
169
 
 
170
if test "${with_wind+set}" = "set" ; then
 
171
   with_os=wind
 
172
   # suppress config tag
 
173
   config_tag=
 
174
fi
 
175
 
 
176
if test "${enable_mt}" = "yes" -o "${enable_ccmpl}" = "yes" ; then
 
177
   engine_mode="multi-threading"
 
178
else
 
179
   engine_mode="slg-wam"
 
180
fi
 
181
 
 
182
# make sure new files are readable
 
183
umask 022
 
184
 
 
185
 
 
186
. ./version.sh
 
187
 
 
188
 
 
189
if test -n "$xsb_beta_version" ; then
 
190
    xsb_version=$xsb_major_version.${xsb_minor_version}-b${xsb_beta_version}
 
191
else
 
192
    xsb_version=$xsb_major_version.${xsb_minor_version}
 
193
fi
 
194
 
 
195
xsb_full_version_name="${xsb_version} (${xsb_codename})"
 
196
 
 
197
AC_DEFINE_UNQUOTED(XSB_VERSION, "${xsb_full_version_name}")
 
198
 
 
199
release_year=`echo ${xsb_release_date} \
 
200
          | sed 's,^\([[0-9]][[0-9]][[0-9]][[0-9]]\)[[-/.]].*$,\1,'`
 
201
release_month=`echo ${xsb_release_date} \
 
202
          | sed 's,^[[0-9]]*[[-/.]]\([[0-9]][[0-9]]\)[[-/.]].*$,\1,'`
 
203
release_day=`echo ${xsb_release_date} \
 
204
          | sed 's,^[[0-9]]*[[-/.]][[0-9]]*[[-/.]]\([[0-9]][[0-9]]\)$,\1,'`
 
205
 
 
206
if test "$release_year" = "${xsb_release_date}" ; then
 
207
   echo "configure: error:"
 
208
   echo "   XSB release date in "$build_dir"/version.sh"
 
209
   echo "   is not Y2K compliant!"
 
210
   echo "   Please specify the date as yyyy/mm/dd or yyy-mm-dd."
 
211
   echo ""
 
212
   rm -f  buildxsb.lock
 
213
   exit 1
 
214
elif test "$release_month" = "${xsb_release_date}" ; then
 
215
   echo "configure: error:"
 
216
   echo "   XSB release date in "$build_dir"/version.sh"
 
217
   echo "   must have the form yyyy/mm/dd, yyyy-mm-dd, or yyyy.mm.dd"
 
218
   echo ""
 
219
   rm -f  buildxsb.lock
 
220
   exit 1
 
221
elif test "$release_day" = "${xsb_release_date}" ; then
 
222
   echo "configure: error:"
 
223
   echo "   XSB release date in "$build_dir"/version.sh must have the form"
 
224
   echo "   must have the form yyyy/mm/dd, yyyy-mm-dd, or yyyy.mm.dd"
 
225
   echo ""
 
226
   rm -f  buildxsb.lock
 
227
   exit 1
 
228
fi
 
229
 
 
230
release_month=`echo ${release_month} | sed 's/^0//'`
 
231
release_day=`echo ${release_day} | sed 's/^0//'`
 
232
 
 
233
# get the name of the month: is there an easier way in sh?
 
234
case ${release_month} in
 
235
 1) release_monthname=January ;;
 
236
 2) release_monthname=February ;;
 
237
 3) release_monthname=March ;;
 
238
 4) release_monthname=April ;;
 
239
 5) release_monthname=May ;;
 
240
 6) release_monthname=June ;;
 
241
 7) release_monthname=July ;;
 
242
 8) release_monthname=August ;;
 
243
 9) release_monthname=September ;;
 
244
 10) release_monthname=October ;;
 
245
 11) release_monthname=November ;;
 
246
 12) release_monthname=December ;;
 
247
esac
 
248
 
 
249
dnl XSB release date
 
250
AC_DEFINE_UNQUOTED(RELEASE_DATE, ${xsb_release_date})
 
251
AC_DEFINE_UNQUOTED(RELEASE_YEAR, ${release_year})
 
252
AC_DEFINE_UNQUOTED(RELEASE_MONTH, ${release_month})
 
253
AC_DEFINE_UNQUOTED(RELEASE_DAY, ${release_day})
 
254
 
 
255
 
 
256
# set architecture-dependent directories
 
257
dnl orig_prefix is used only for site-prefix. It contains the value of
 
258
dnl prefix given by the user. The prefix variable will later get
 
259
dnl the <xsb-version> subdirectory added in.
 
260
orig_prefix=
 
261
if test "$prefix" = "NONE" -o -z "$prefix" ; then
 
262
    prefix=$topdir
 
263
    orig_prefix=$prefix
 
264
else
 
265
    dnl strip any trailing slashes in prefix
 
266
    prefix=`echo "${prefix}" | sed 's,\([[^/]]\)/*$,\1,'`
 
267
    orig_prefix=$prefix
 
268
    prefix="$prefix"/"$xsb_version"
 
269
fi
 
270
 
 
271
if test -n "$enable_debugging" && test -n "$enable_debug" ; then
 
272
   echo ""
 
273
   echo "***Both --en/disable-debug and --en/disable-debugging are specified."
 
274
   echo "***Will use the --enable-debug setting."
 
275
fi
 
276
 
 
277
if test -n "$enable_debugging" && test -z "$enable_debug" ; then
 
278
   enable_debug=$enable_debugging
 
279
fi
 
280
 
 
281
dnl Take care of the scheduling strategy
 
282
xsb_scheduling_strategy=local
 
283
enable_local_scheduling=yes
 
284
 
 
285
if test "${enable_batched_sched}" = "yes" || \
 
286
   test "${enable_batched_schedule}" = "yes" || \
 
287
   test "${enable_batched}" = "yes" || \
 
288
   test "${enable_batched_scheduling}" = "yes" ; then
 
289
   enable_local_scheduling=no
 
290
fi
 
291
 
 
292
if test "${enable_local_scheduling}" = "yes"; then
 
293
   AC_DEFINE(LOCAL_EVAL)
 
294
   xsb_scheduling_strategy=local
 
295
else
 
296
   xsb_scheduling_strategy=batched
 
297
fi
 
298
 
 
299
 
 
300
AC_DEFINE(GC)
 
301
AC_DEFINE(SLG_GC)
 
302
 
 
303
dnl The following is to be used only by developers for GC debugging
 
304
gc_test=no
 
305
 
 
306
if test "${with_gc_test}" = "yes" ; then
 
307
   enable_gc_test=yes
 
308
fi
 
309
if test "${enable_gc_test}" = "yes" ; then
 
310
   AC_DEFINE(GC_TEST)
 
311
   gc_test=yes
 
312
fi
 
313
 
 
314
demand=no
 
315
if test "${with_demand}" = "yes" ; then
 
316
   enable_demand=yes
 
317
fi
 
318
if test "${enable_demand}" = "yes" ; then
 
319
   AC_DEFINE(DEMAND)
 
320
   demand=yes
 
321
fi
 
322
 
 
323
config_prefix=${topdir}/config
 
324
install_config_prefix=${prefix}/config
 
325
 
 
326
if test "$config_tag" != "NONE" -a -n "$config_tag" ; then
 
327
    config_tag="-$config_tag"
 
328
fi
 
329
 
 
330
if test "${with_gcc+set}" = "set" ; then
 
331
    # allow --with-gcc=gcc-name
 
332
    CC=${with_gcc}
 
333
    if test "${with_gcc}" = "yes"; then
 
334
        CC=gcc
 
335
    fi
 
336
elif test "${with_cc+set}" = "set" ; then
 
337
    # allow --with-cc=compiler on cmd line
 
338
    CC=${with_cc}
 
339
    if test "${with_cc}" = "yes"; then
 
340
       CC=cc
 
341
    fi
 
342
elif test "${with_acc+set}" = "set" ; then
 
343
    CC=acc
 
344
fi
 
345
 
 
346
 
 
347
dnl Some more tags
 
348
 
 
349
dnl If the user didn't specify --config-tag, check maybe -aout, -bits-64,
 
350
dnl or -dbg are appropriate
 
351
if test "${config_tag}" = "NONE" ; then
 
352
    config_tag=
 
353
    dnl add -bits64 to the config tag, if --force64 is set on command line
 
354
    if test -n "$ac_force64" ; then
 
355
       config_tag="${config_tag}-bits64"
 
356
    fi
 
357
    dnl add -aout to the config tag, if --linuxaout is set on command line
 
358
    if test -n "$ac_linuxaout" ; then
 
359
       config_tag="${config_tag}-aout"
 
360
    fi
 
361
    dnl add -ss to config tag if compiling for simplescalar
 
362
    if test "${CC}" = "sslittle-na-sstrix-gcc"; then
 
363
       config_tag="${config_tag}-ss"
 
364
    fi
 
365
    if test "${CC}" = "arm-linux-gcc"; then
 
366
       config_tag="${config_tag}-arm"
 
367
    fi
 
368
    dnl If debugging, add -dbg
 
369
    if test "${enable_debug}" ; then
 
370
       config_tag="${config_tag}-dbg"
 
371
    fi
 
372
    dnl If vm-debugging, add -vm
 
373
    if test "${enable_debug_vm}" ; then
 
374
       config_tag="${config_tag}-vm"
 
375
    fi
 
376
    dnl If verbose debugging, add -vrb
 
377
    if test "${enable_debug_verbose}" ; then
 
378
       config_tag="${config_tag}-vrb"
 
379
    fi
 
380
    dnl If compiled with assertions, add -asrt
 
381
    if test "${enable_debug_assertions}" ; then
 
382
       config_tag="${config_tag}-asrt"
 
383
    fi
 
384
    dnl If gc stress test, add -gc
 
385
    if test "${gc_test}" = "yes" ; then
 
386
       config_tag="${config_tag}-gc"
 
387
    fi
 
388
    dnl If batched scheduling, add -btc
 
389
    if test "${xsb_scheduling_strategy}" = "batched" ; then
 
390
       config_tag="${config_tag}-btc"
 
391
    fi
 
392
    if test "${enable_mt}" = "yes" ; then
 
393
       config_tag="${config_tag}-mt"
 
394
    fi
 
395
    if test "${enable_ccmpl}" = "yes" ; then
 
396
       config_tag="${config_tag}-ccmpl"
 
397
    fi
 
398
fi
 
399
 
 
400
config_tag_sans_dash=`echo ${config_tag} | sed 's/^-//'`
 
401
 
 
402
 
 
403
echo ""
 
404
echo "Building XSB Version ${xsb_version} (${xsb_codename}) of ${xsb_release_date}"
 
405
echo ""
 
406
 
 
407
mno_cyg_inclib=""
 
408
mno_cyg_lib=""
 
409
 
 
410
# check for NT configurations
 
411
case "$with_os" in
 
412
  win* | *nt*) dnl Windows
 
413
    canonical=x86-pc-windows
 
414
    host_os=windows
 
415
    os_type=windows
 
416
    os_version=
 
417
    host_vendor=pc
 
418
    host_cpu=x86
 
419
    configuration_templ=xsb_configuration_wind.in
 
420
    config_dot_h_templ=def_config_wind.in
 
421
    echo 'Configuring for host system type... Windows NT/95/98/2000'
 
422
    with_os=wind;
 
423
    ;;
 
424
  *)    dnl check for unknown OS
 
425
    if test -n "$with_os" ; then
 
426
       echo "OS \`$with_os' is not supported"
 
427
       rm -f  buildxsb.lock
 
428
       exit 1
 
429
    fi
 
430
    configuration_templ=xsb_configuration.in
 
431
    config_dot_h_templ=def_config.in
 
432
 
 
433
    dnl Check configuration for a Unix variant
 
434
    if test "$configuration" = "NONE" ; then
 
435
        echo '
 
436
- You did not tell me what kind of host system you want to configure.
 
437
- I will attempt to guess the kind of system this is.
 
438
' 1>&6
 
439
        AC_CANONICAL_HOST
 
440
        canonical=$host
 
441
        configuration=$host_alias
 
442
    else
 
443
        canonical=`${CONFIG_SHELL-/bin/sh} ./config.sub $configuration 2>&1`
 
444
 
 
445
        AC_CANONICAL_HOST
 
446
        if test -n "`echo "$canonical" | sed -e [s/${configuration}//]`" ; then
 
447
        echo $canonical
 
448
        echo ""
 
449
        rm -f  buildxsb.lock
 
450
        exit 1
 
451
        else
 
452
        AC_CHECKING(host system type... $canonical)
 
453
        fi
 
454
    fi
 
455
 
 
456
    ;;
 
457
esac
 
458
 
 
459
 
 
460
# arch-independent XSB directories
 
461
libdir=${topdir}/lib
 
462
syslibdir=${topdir}/syslib
 
463
cmplibdir=${topdir}/cmplib
 
464
emudir=${topdir}/emu
 
465
scriptdir=${topdir}/bin   # where the xsb invocationscripts go
 
466
pkgdir=${topdir}/packages
 
467
etcdir=${topdir}/etc
 
468
 
 
469
src_prolog_includes=${topdir}/prolog_includes
 
470
 
 
471
# config-specific stuff
 
472
full_config_name=${canonical}${config_tag}
 
473
arch_config_prefix=${config_prefix}/${full_config_name}
 
474
 
 
475
cache_file="${arch_config_prefix}/config.cache"
 
476
 
 
477
dnl This is a redefined standard AC_CACHE_LOAD. The standard one is now no-op.
 
478
dnl We do this so we could place the cache file in the configuration directory.
 
479
if test -r "$cache_file" -a "$ac_caching" = "yes" ; then
 
480
  echo "loading cache $cache_file"
 
481
  . $cache_file
 
482
elif test ! -r "$cache_file" ; then
 
483
  echo "creating cache $cache_file"
 
484
  dnl If this fails, the user'll see a msg later that cache file isn't found
 
485
  (test -d $arch_config_prefix || mkdir -p ${arch_config_prefix}) 2> /dev/null
 
486
  ./touch.sh $cache_file
 
487
  chmod 644 "$cache_file"
 
488
fi
 
489
 
 
490
 
 
491
 
 
492
# where binary executables go (this is config-specific)
 
493
arch_bindir=${arch_config_prefix}/bin
 
494
 
 
495
# where object code goes (we need it only for the source tree)
 
496
arch_config_objlibdir=${arch_config_prefix}/saved.o
 
497
 
 
498
# where arch-specific XSB .{P,H,O} files go
 
499
arch_config_libdir=${arch_config_prefix}/lib
 
500
 
 
501
arch_config_file=${arch_config_libdir}/xsb_configuration.P
 
502
 
 
503
# site-specific directories
 
504
# where the site is
 
505
test "$site_prefix" = "NONE" && site_prefix=${orig_prefix}/site
 
506
# site-specific config-independent XSB libraries
 
507
site_libdir=${site_prefix}/lib
 
508
# site-specific config-dependent stuff goes
 
509
site_config_prefix=${site_prefix}/config/${canonical}
 
510
# site-specific config-dependent XSB libraries
 
511
site_config_libdir=${site_config_prefix}/lib
 
512
 
 
513
# Installation directories: We only check if they exist
 
514
install_libdir=${prefix}/lib
 
515
install_syslibdir=${prefix}/syslib
 
516
install_cmplibdir=${prefix}/cmplib
 
517
install_emudir=${prefix}/emu
 
518
install_scriptdir=${prefix}/bin     # where the xsb invocation script goes
 
519
install_builddir=${prefix}/build    # where the config detection scripts go
 
520
install_prolog_includes=${prefix}/prolog_includes
 
521
install_pkgdir=${prefix}/packages
 
522
install_pkgxmcdir=${prefix}/packages/xmc
 
523
install_examples=${prefix}/examples
 
524
install_etcdir=${prefix}/etc
 
525
 
 
526
arch_install_config_prefix=${install_config_prefix}/${full_config_name}
 
527
arch_install_bindir=${arch_install_config_prefix}/bin
 
528
arch_install_config_libdir=${arch_install_config_prefix}/lib
 
529
arch_install_objdir=${arch_install_config_prefix}/saved.o
 
530
 
 
531
 
 
532
dnl When running autoheader, uncoment these 2 lines and comment the next 2.
 
533
dnl Then move xsb_config.h.in to def_config.in.
 
534
dnl There probably will be no need to run autoheader any more!
 
535
dnl AC_CONFIG_HEADER(${arch_config_prefix}/xsb_config.h:def_config.in
 
536
dnl ${arch_config_prefix}/xsb_debug.h:def_debug.in])
 
537
 
 
538
AC_CONFIG_HEADER([${arch_config_prefix}/xsb_config.h:${config_dot_h_templ}
 
539
${arch_config_prefix}/xsb_debug.h:def_debug.in])
 
540
 
 
541
 
 
542
dnl Find the source directory.
 
543
 
 
544
if test ! -f "${emudir}/emuloop.h" -o ! -f "${syslibdir}/tables.P" ; then
 
545
  echo ""
 
546
  echo "    ******* I cannot find XSB sources!!! *******"
 
547
  echo "    You must run \`configure' in the directory \`srcDir/build' "
 
548
  echo "    where \`srcDir' is the top directory of the XSB source tree."
 
549
  echo ""
 
550
  rm -f  buildxsb.lock
 
551
  exit 1
 
552
fi
 
553
 
 
554
# Test if directories exist
 
555
echo "Checking installation directories..."
 
556
 
 
557
(
 
558
# clear out the dir for recording missing directories
 
559
rm -f .missingdirs.tmp
 
560
 
 
561
dnl The following must already exist; if not, it doesn't even make sense to try
 
562
AC_MSG_CHECKING($libdir) && \
 
563
     (test -d $libdir && AC_MSG_RESULT(OK)) \
 
564
        || (AC_MSG_RESULT(FAILED); \
 
565
              echo "+++Can't find $libdir" >> .missingdirs.tmp)
 
566
AC_MSG_CHECKING($syslibdir) && \
 
567
     (test -d $syslibdir && AC_MSG_RESULT(OK)) \
 
568
        || (AC_MSG_RESULT(FAILED); \
 
569
              echo "+++Can't find $syslibdir" >> .missingdirs.tmp)
 
570
AC_MSG_CHECKING($cmplibdir) && \
 
571
     (test -d $cmplibdir && AC_MSG_RESULT(OK)) \
 
572
        || (AC_MSG_RESULT(FAILED); \
 
573
              echo "+++Can't find $cmplibdir" >> .missingdirs.tmp)
 
574
 
 
575
# test if installation should fail
 
576
test -f .missingdirs.tmp && \
 
577
     (cat .missingdirs.tmp; echo "***Installation failed") && exit 1
 
578
 
 
579
 
 
580
AC_MSG_CHECKING($scriptdir) && \
 
581
     ((test -d $scriptdir || mkdir -p $scriptdir) && AC_MSG_RESULT(OK)) \
 
582
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $scriptdir" >> .missingdirs.tmp)
 
583
 
 
584
AC_MSG_CHECKING($arch_bindir) && \
 
585
     ((test -d $arch_bindir || mkdir -p $arch_bindir) && AC_MSG_RESULT(OK)) \
 
586
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $arch_bindir" >> .missingdirs.tmp)
 
587
 
 
588
AC_MSG_CHECKING($arch_config_libdir) && \
 
589
     ((test -d $arch_config_libdir || mkdir -p ${arch_config_libdir}) && AC_MSG_RESULT(OK)) \
 
590
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $arch_config_libdir" >> .missingdirs.tmp)
 
591
 
 
592
AC_MSG_CHECKING(${arch_config_objlibdir}) && \
 
593
     ((test -d "${arch_config_objlibdir}" || mkdir -p ${arch_config_objlibdir}) && AC_MSG_RESULT(OK)) \
 
594
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $arch_config_objlibdir" >> .missingdirs.tmp)
 
595
 
 
596
dnl Checking site directories
 
597
AC_MSG_CHECKING($site_libdir) && \
 
598
     ((test -d $site_libdir || mkdir -p $site_libdir) && AC_MSG_RESULT(OK)) \
 
599
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $site_libdir" >> .missingdirs.tmp)
 
600
 
 
601
AC_MSG_CHECKING($site_config_libdir) && \
 
602
     ((test -d $site_config_libdir || mkdir -p $site_config_libdir) && AC_MSG_RESULT(OK)) \
 
603
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $site_config_libdir" >> .missingdirs.tmp)
 
604
 
 
605
dnl Checking installation directories
 
606
AC_MSG_CHECKING($install_emudir) && \
 
607
     ((test -d $install_emudir || mkdir -p $install_emudir) && AC_MSG_RESULT(OK)) \
 
608
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_emudir" >> .missingdirs.tmp)
 
609
 
 
610
AC_MSG_CHECKING($install_libdir) && \
 
611
     ((test -d $install_libdir || mkdir -p $install_libdir) && AC_MSG_RESULT(OK)) \
 
612
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_libdir" >> .missingdirs.tmp)
 
613
 
 
614
AC_MSG_CHECKING($install_syslibdir) && \
 
615
     ((test -d $install_syslibdir || mkdir -p $install_syslibdir) && AC_MSG_RESULT(OK)) \
 
616
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_syslibdir" >> .missingdirs.tmp)
 
617
 
 
618
AC_MSG_CHECKING($install_cmplibdir) && \
 
619
     ((test -d $install_cmplibdir || mkdir -p $install_cmplibdir) && AC_MSG_RESULT(OK)) \
 
620
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_cmplibdir" >> .missingdirs.tmp)
 
621
 
 
622
AC_MSG_CHECKING($install_scriptdir) && \
 
623
     ((test -d $install_scriptdir || mkdir -p $install_scriptdir) && AC_MSG_RESULT(OK)) \
 
624
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_scriptdir" >> .missingdirs.tmp)
 
625
 
 
626
AC_MSG_CHECKING($install_builddir) && \
 
627
     ((test -d $install_builddir || mkdir -p $install_builddir) && AC_MSG_RESULT(OK)) \
 
628
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_builddir" >> .missingdirs.tmp)
 
629
 
 
630
AC_MSG_CHECKING($arch_install_bindir) && \
 
631
     ((test -d $arch_install_bindir || mkdir -p $arch_install_bindir) && AC_MSG_RESULT(OK)) \
 
632
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $arch_install_bindir" >> .missingdirs.tmp)
 
633
 
 
634
AC_MSG_CHECKING($arch_install_config_libdir) && \
 
635
     ((test -d $arch_install_config_libdir || mkdir -p ${arch_install_config_libdir}) && AC_MSG_RESULT(OK)) \
 
636
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $arch_install_config_libdir" >> .missingdirs.tmp)
 
637
 
 
638
AC_MSG_CHECKING($arch_install_objdir) && \
 
639
     ((test -d $arch_install_objdir || mkdir -p ${arch_install_objdir}) && AC_MSG_RESULT(OK)) \
 
640
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $arch_install_objdir" >> .missingdirs.tmp)
 
641
 
 
642
AC_MSG_CHECKING($install_etcdir) && \
 
643
     ((test -d $install_etcdir || mkdir -p ${install_etcdir}) && AC_MSG_RESULT(OK)) \
 
644
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_etcdir" >> .missingdirs.tmp)
 
645
 
 
646
AC_MSG_CHECKING($install_pkgdir) && \
 
647
     ((test -d $install_pkgdir || mkdir -p ${install_pkgdir}) && AC_MSG_RESULT(OK)) \
 
648
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_pkgdir" >> .missingdirs.tmp)
 
649
 
 
650
AC_MSG_CHECKING($install_pkgxmcdir) && \
 
651
     ((test -d $install_pkgxmcdir || mkdir ${install_pkgxmcdir}) && AC_MSG_RESULT(OK)) \
 
652
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_pkgxmcdir" >> .missingdirs.tmp)
 
653
 
 
654
AC_MSG_CHECKING($install_examples) && \
 
655
     ((test -d $install_examples || mkdir -p ${install_examples}) && AC_MSG_RESULT(OK)) \
 
656
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create: $install_examples" >> .missingdirs.tmp)
 
657
 
 
658
AC_MSG_CHECKING($install_prolog_includes) && \
 
659
     ((test -d $install_prolog_includes || mkdir -p ${install_prolog_includes}) && AC_MSG_RESULT(OK)) \
 
660
    || (AC_MSG_RESULT(FAILED); echo "+++Can't create  $install_prolog_includes" >> .missingdirs.tmp)
 
661
 
 
662
test -f .missingdirs.tmp && \
 
663
    (cat .missingdirs.tmp; \
 
664
     echo "***Make the above directories manually and rerun configure") \
 
665
     && exit 1
 
666
 
 
667
) 2> /dev/null
 
668
 
 
669
# installation failed
 
670
test -f .missingdirs.tmp && exit 1
 
671
 
 
672
echo "Checking installation directories ... Done"
 
673
 
 
674
 
 
675
AC_PROG_CC
 
676
AC_PROG_CPP
 
677
AC_PROG_INSTALL
 
678
dnl If on AIX, define _ALL_SOURCE, which allows the use of some BSD functions
 
679
dnl This must be AFTER AC_PROG_CC
 
680
AC_AIX
 
681
 
 
682
AC_CHECK_PROG(has_gcc, gcc, "yes", "no")
 
683
 
 
684
AC_MSG_CHECKING(whether we are using SunPro C)
 
685
AC_TRY_COMPILE([],[#ifndef __SUNPRO_C
 
686
#error Not a  SunPro compiler :-(
 
687
******* ======= ******** &&&&&&&&
 
688
#endif
 
689
], __sunpro_c=yes, __sunpro_c=no)
 
690
AC_MSG_RESULT($__sunpro_c)
 
691
 
 
692
 
 
693
dnl set some basic flags
 
694
# if --with-gcc, take it as a sign of trouble
 
695
# with gcc and lower optimization levels
 
696
if test -n "$with_gcc" ; then
 
697
   if test "${CC}" = "sslittle-na-sstrix-gcc" ; then
 
698
        emuloop_opt_level=-${optimization_level-"O1"}
 
699
        trutils_opt_level=-${optimization_level-"O1"}
 
700
        builtins_opt_level=-${optimization_level-"O1"}
 
701
        loader_opt_level=-${optimization_level-"O1"}
 
702
        CFLAGS=""
 
703
        c_inline_level=""
 
704
   else
 
705
        emuloop_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
706
        trutils_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
707
        builtins_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
708
        loader_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
709
 
 
710
        CFLAGS="-Wall -pipe -ansi -pedantic"
 
711
   fi
 
712
else
 
713
    case $CC in
 
714
        gcc)    emuloop_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
715
                trutils_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
716
                builtins_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
717
                loader_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
718
 
 
719
                CFLAGS="-Wall -pipe -ansi -pedantic"
 
720
        ;;
 
721
        cc) if test "$__sunpro_c" = "no"; then
 
722
                emuloop_opt_level=-${optimization_level-"O4"}
 
723
                trutils_opt_level=-${optimization_level-"O4"}
 
724
                builtins_opt_level=-${optimization_level-"O4"}
 
725
                loader_opt_level=-${optimization_level-"O4"}
 
726
            else
 
727
                # emuloop_opt_level is the optimization level for emuloop.c
 
728
                # Using xO4 would take SunPro more than an hour, hence xO2.
 
729
                emuloop_opt_level=-${optimization_level-"xO2"}
 
730
                trutils_opt_level=-${optimization_level-"xO4"}
 
731
                builtins_opt_level=-${optimization_level-"xO4"}
 
732
                loader_opt_level=-${optimization_level-"xO4"}
 
733
            fi
 
734
 
 
735
            c_inline_level=""
 
736
            CFLAGS=""
 
737
        ;;
 
738
        acc) # acc also seems to choke on high optimization levels for emuloop.c
 
739
            emuloop_opt_level=-${optimization_level-"O2"}
 
740
            trutils_opt_level=-${optimization_level-"O4"}
 
741
            builtins_opt_level=-${optimization_level-"O4"}
 
742
            loader_opt_level=-${optimization_level-"O4"}
 
743
 
 
744
            c_inline_level=""
 
745
            CFLAGS="-Xa"
 
746
        ;;
 
747
    esac
 
748
fi
 
749
 
 
750
 
 
751
dnl In XSB, CC is the C compiler to be used with the C interface
 
752
dnl Could be different from C compiler with which XSB was compiled,
 
753
dnl if it was done with a cross-compiler.
 
754
AC_DEFINE_UNQUOTED(CC, "${CC}")
 
755
 
 
756
dnl Set up the additional libraries
 
757
ld_site_libraries=
 
758
c_site_includes=
 
759
 
 
760
dnl --site-static-libraries (multiple dirs)
 
761
if test -n "$site_static_libraries"; then
 
762
    echo "    Adding static libraries to loader flags:"
 
763
    for arg in $site_static_libraries; do
 
764
        case "$arg" in
 
765
            dnl If it is a loader option, just pass it on, don't add -L
 
766
            -* ) ;;
 
767
            dnl strip trailing slashes
 
768
            * ) arg=`echo "-L${arg}" | sed 's,\([[^/]]\)/*$,\1,'` ;;
 
769
        esac
 
770
        ld_site_libraries="${ld_site_libraries} $arg"
 
771
        echo "          $arg"
 
772
    done
 
773
fi
 
774
 
 
775
dnl --site-includes (multiple dirs)
 
776
if test -n "$site_includes"; then
 
777
    echo "    Appending directories to the C include path:"
 
778
    for arg in $site_includes; do
 
779
        arg=`echo "-I${arg}" | sed 's,\([[^/]]\)/*$,\1,'`
 
780
        c_site_includes="${c_site_includes} $arg"
 
781
        echo "          $arg"
 
782
    done
 
783
fi
 
784
 
 
785
dnl --with-libwww=DIR
 
786
if test -n "$with_libwww" && test -d $topdir/packages/libwww; then
 
787
    cd $topdir/packages/libwww
 
788
    echo "***Configuring Libwww"
 
789
    ./configure --with-config="$canonical" --with-libwww="$with_libwww" > /dev/null
 
790
    cd $build_dir
 
791
fi
 
792
 
 
793
if test -n "$with_xpath" && test -d $topdir/packages/xpath; then
 
794
   cd $topdir/packages/xpath
 
795
   echo "***Configuring XPath"
 
796
    ./configure --prefix="$with_xpath" > /dev/null
 
797
    cd $build_dir
 
798
fi
 
799
 
 
800
if test -n "${with_dbdrivers}" && test -d $topdir/packages/dbdrivers; then
 
801
    cd $topdir/packages/dbdrivers
 
802
    echo "***Configuring DB drivers"
 
803
    ./run_configure_scripts --with-odbc-libdir="$with_odbc_libdir" \
 
804
                            --with-odbc-incdir="$with_odbc_incdir" \
 
805
                            --with-mysql-libdir="$with_mysql_libdir" \
 
806
                            --with-mysql-incdir="$with_mysql_incdir" \
 
807
                            > /dev/null
 
808
    cd $build_dir
 
809
fi
 
810
 
 
811
 
 
812
dnl check for Make feature
 
813
AC_PROG_MAKE_SET
 
814
 
 
815
# Check if 64 bit machine
 
816
#
 
817
dnl We use 4 in AC_CHECK_SIZEOF, below, as the size for cross-compiling,
 
818
dnl even though we aren't cross-compiling.
 
819
dnl This is done in order to get rid of a warning:
 
820
dnl        AC_TRY_RUN called without default to allow cross compiling
 
821
dnl This warning is really a buglet in the AC_CHECK_SIZEOF macro:
 
822
dnl it invokes AC_TRY_RUN without specifying an action for cross-compilation,
 
823
dnl if the second arg to AC_CHECK_SIZEOF is not given.
 
824
AC_CHECK_SIZEOF(long,4)
 
825
if test "${ac_cv_sizeof_long}" = 8 -o "$ac_force64" = "yes" ; then
 
826
    AC_DEFINE(BITS64)
 
827
    machine64bit=yes
 
828
    echo ""
 
829
    echo "    Configuring XSB for a 64 bit machine"
 
830
    echo ""
 
831
fi
 
832
 
 
833
if test "${ac_cv_sizeof_long}" = 0; then
 
834
    echo ""
 
835
    echo "*** PANIC!!! Configure tests are not working - compiler $CC is broken!"
 
836
    echo "*** $CC says that sizeof(long)=0 !!!"
 
837
    echo "*** Please check config.log for compilation errors and use a different compiler."
 
838
    echo ""
 
839
    rm -f  buildxsb.lock
 
840
    exit 1
 
841
fi
 
842
 
 
843
# A series of checks for essential libraries.
 
844
AC_CHECK_LIB(m, main,, have_errors=yes)
 
845
test -n "$have_errors" && AC_MSG_ERROR(Your system is missing library: \`m')
 
846
 
 
847
AC_CHECK_LIB(dl, main,, have_dl=no)
 
848
AC_CHECK_LIB(nsl, main, , have_nsl=no)
 
849
AC_CHECK_LIB(pthread, main, , have_pthread=no)
 
850
AC_CHECK_LIB(socket, main,, have_socket=no)
 
851
 
 
852
AC_CHECK_LIB(readline, readline, have_readline=yes)
 
853
if test "$have_readline" = yes ; then
 
854
    AC_DEFINE(HAVE_READLINE)
 
855
fi
 
856
 
 
857
 
 
858
AC_CHECK_HEADERS(stdarg.h, , have_errors=yes)
 
859
test "${have_errors}" = "yes" &&
 
860
    AC_MSG_ERROR([Your C compiler is not ANSI compliant: stdarg.h is missing!])
 
861
 
 
862
# Checks for header files
 
863
 
 
864
dnl Note, under NT, we sould include time.h instead
 
865
AC_CHECK_HEADERS(sys/time.h)
 
866
 
 
867
dnl defines TIME_WITH_SYS_TIME if both allowed
 
868
AC_HEADER_TIME
 
869
 
 
870
AC_CHECK_HEADERS(sys/resource.h, , have_errors=yes)
 
871
test "${have_errors}" = "yes" &&
 
872
    AC_MSG_ERROR([sys/resource.h is missing on your system])
 
873
 
 
874
AC_CHECK_FUNCS(malloc, have_malloc=yes,have_malloc=no)
 
875
test "${have_malloc}" = "no" &&
 
876
    AC_MSG_ERROR([malloc() is missing on your system])
 
877
 
 
878
AC_CHECK_HEADERS(unistd.h string.h stdlib.h, , have_errors=yes)
 
879
test "${have_errors}" = "yes" &&
 
880
    AC_MSG_ERROR([One of these header files is missing on your system:
 
881
            unistd.h
 
882
            string.h
 
883
            stdlib.h])
 
884
# Checks for typedefs, structures, and compiler characteristics.
 
885
AC_C_CONST
 
886
 
 
887
dnl Check for functions that are in standard libraries.
 
888
dnl Functions that aren't in standard libraries should be checked after
 
889
dnl their corresponding libraries are AC_CHECK_LIB'ed.
 
890
AC_TYPE_SIGNAL
 
891
AC_CHECK_FUNCS(strdup mkdir, , have_errors="yes")
 
892
test "${have_errors}" = "yes" && \
 
893
    AC_MSG_ERROR([One of these functions is missing on your system:
 
894
            strdup
 
895
            mkdir])
 
896
 
 
897
dnl defines HAVE_GETHOSTBYNAME, HAVE_GETTIMEOFDAY, HAVE_SOCKET,
 
898
dnl and HAVE_SNPRINTF if avail
 
899
AC_CHECK_FUNCS(gethostbyname gettimeofday socket snprintf)
 
900
 
 
901
AC_CHECK_FUNCS(regexec regerror regcomp, regmatch_support="yes", regmatch_support="no")
 
902
AC_CHECK_FUNCS(fnmatch glob globfree, wildmatch_support="yes", wildmatch_support="no")
 
903
 
 
904
dnl execvp
 
905
AC_CHECK_FUNCS(execvp)
 
906
 
 
907
dnl Checking for libraries that are NOT in standard places,
 
908
dnl so they require --site-libraries
 
909
LIBS="${ld_site_libraries} ${LIBS}"
 
910
 
 
911
 
 
912
if test "${enable_oracle_debug+yes}" = "yes" || \
 
913
    test "${enable_oracle_debugging+yes}" = "yes"; then
 
914
    AC_DEFINE(ORACLE_DEBUG)
 
915
    with_oracle=yes
 
916
    do_debugging=yes
 
917
fi
 
918
 
 
919
if test "${with_oracle+set}" = "set" ; then
 
920
    AC_DEFINE(ORACLE)
 
921
    with_oracle=yes
 
922
fi
 
923
 
 
924
#if test "${with_oracle+set}" = "set" ; then
 
925
#    if test -n "$with_os" ; then
 
926
#       AC_DEFINE(ORACLE)
 
927
#       cat <<EOT
 
928
#
 
929
#    Building for $with_os with Oracle support.
 
930
#    You must ensure that all the necessary Oracle libraries
 
931
#    are installed on the target machine.
 
932
#
 
933
#EOT
 
934
#
 
935
#    else
 
936
#       cat <<EOT
 
937
#
 
938
#    Checking whether XSB can be compiled with Oracle support.
 
939
#    If this fails, you will have to use the --site-libraries option
 
940
#    of \`configure' to specify the directory where Oracle libraries live.
 
941
#
 
942
#EOT
 
943
#
 
944
#       dnl If any library here is missing, set oracle_error
 
945
#       dnl `thread' is a standard library. The others come from Oracle.
 
946
#       dnl Therefore, must use --site-libraries
 
947
#       AC_CHECK_LIB(thread, main, , oracle_error=yes)
 
948
#
 
949
#       AC_CHECK_LIB(c3v6, main, , oracle_error=yes)
 
950
#       AC_CHECK_LIB(client, main, , oracle_error=yes)
 
951
#       AC_CHECK_LIB(clntsh, main, , oracle_error=yes)
 
952
#       AC_CHECK_LIB(common, main, , oracle_error=yes)
 
953
#       AC_CHECK_LIB(core, main, , oracle_error=yes)
 
954
#       AC_CHECK_LIB(core3, main, , oracle_error=yes)
 
955
#
 
956
#       AC_CHECK_LIB(epc, main, , oracle_error=yes)
 
957
#       AC_CHECK_LIB(generic, main, , oracle_error=yes)
 
958
#       AC_CHECK_LIB(nlsrtl, main, , oracle_error=yes)
 
959
#       AC_CHECK_LIB(nlsrtl3, main, , oracle_error=yes)
 
960
#
 
961
#       AC_CHECK_LIB(sql, main, , oracle_error=yes)
 
962
#       AC_CHECK_LIB(sqlnet, main, , oracle_error=yes)
 
963
#       AC_CHECK_LIB(cv6, main, , oracle_error=yes)
 
964
#       AC_CHECK_LIB(ncr, main, , oracle_error=yes)
 
965
#
 
966
#       dnl If oracle_error=yes, give up on oracle
 
967
#       if test "$oracle_error" = "yes" ; then
 
968
#           echo ""
 
969
#           AC_MSG_WARN([ ****Your system is missing a library that Oracle needs
 
970
#                    ****XSB will be built WITHOUT the Oracle support])
 
971
#           echo ""
 
972
#           with_oracle=no
 
973
#           have_warnings=yes
 
974
#       else
 
975
#           AC_DEFINE(ORACLE)
 
976
#           cat <<EOT
 
977
#
 
978
#    Building with support for Oracle
 
979
#
 
980
#EOT
 
981
#           with_oracle=yes
 
982
#       fi
 
983
#    fi
 
984
#fi
 
985
 
 
986
ODBCSRC=""
 
987
ODBCOBJ=""
 
988
 
 
989
if test "${with_odbc+set}" = "set"; then
 
990
    if test -n "$with_os" ; then
 
991
    echo -n ""
 
992
#       AC_DEFINE(XSB_ODBC)
 
993
    cat <<EOT
 
994
#
 
995
#    Building for $with_os with support for ODBC.
 
996
#    You must ensure that the requisite ODBC libraries
 
997
#    are installed on the target machine.
 
998
#
 
999
EOT
 
1000
#
 
1001
else
 
1002
#       cat <<EOT
 
1003
#
 
1004
#    Checking whether XSB can be built with ODBC support.
 
1005
#    If this fails, you will have to use the --site-includes option
 
1006
#    of \`configure' to tell where the ODBC .h files live and,
 
1007
#    possibly, the --site-libraries option to specify the directory
 
1008
#    where ODBC libraries live.
 
1009
#
 
1010
#EOT
 
1011
#       dnl Here we provide additional directories to check headers in
 
1012
#       dnl AC_CHECK_HEADERS uses CPPFLAGS to find the include path.
 
1013
#       dnl Since these aren't standard headers, we must use --site-includes
 
1014
#       saved_cpp_flags="${CPPFLAGS}"
 
1015
#       CPPFLAGS="${c_site_includes} ${CPPFLAGS}"
 
1016
#       AC_CHECK_HEADERS(odbcinst.h SQL.H SQLEXT.H windows.h, \
 
1017
#                        with_odbc=yes, odbc_error=yes)
 
1018
#       if test "$odbc_error" = "yes"; then
 
1019
#           echo ""
 
1020
#           AC_MSG_WARN([ ****Your system is missing a .h file required for ODBC support
 
1021
#                     ****XSB will be built WITHOUT ODBC support])
 
1022
#           echo ""
 
1023
#           have_warnings=yes
 
1024
#           with_odbc=no
 
1025
#       else
 
1026
#           AC_DEFINE(XSB_ODBC)
 
1027
        cat <<EOT
 
1028
 
 
1029
Building with support for ODBC
 
1030
 
 
1031
EOT
 
1032
#       fi
 
1033
#       dnl restore CPPFLAGS
 
1034
#       CPPFLAGS="${saved_cpp_flags}"
 
1035
 
 
1036
    ODBCSRC="odbc_xsb.c"
 
1037
    ODBCOBJ="odbc_xsb.o"
 
1038
 
 
1039
    fi
 
1040
fi
 
1041
 
 
1042
if test "${with_odbc+set}" = "set"; then
 
1043
    AC_DEFINE(XSB_ODBC)
 
1044
    with_odbc=yes
 
1045
fi
 
1046
 
 
1047
INTERPROLOGSRC=""
 
1048
INTERPROLOGOBJ=""
 
1049
 
 
1050
if test "${with_interprolog+set}" = "set"; then
 
1051
    AC_DEFINE(XSB_INTERPROLOG)
 
1052
    with_interprolog=yes
 
1053
    INTERPROLOGSRC="interprolog_callback.c"
 
1054
    INTERPROLOGOBJ="interprolog_callback.o"
 
1055
    dnl also needed to pass jni include file locations
 
1056
    dnl to windows make file through site-includes
 
1057
fi
 
1058
 
 
1059
win_site_includes=
 
1060
win_ld_site_libraries=
 
1061
 
 
1062
if test "$with_os" = wind ; then
 
1063
    dnl --site-includes (multiple dirs)
 
1064
 
 
1065
    if test -n "$site_includes"; then
 
1066
        echo "    Appending directories to the C library path:"
 
1067
        for arg in $site_includes; do
 
1068
            arg=`echo "/I\"${arg}\"" | sed 's,\([[^/]]\)/*$,\1,'`
 
1069
            win_site_includes="${win_site_includes} $arg"
 
1070
            echo "              \"$arg\""
 
1071
        done
 
1072
    fi
 
1073
 
 
1074
    dnl --site-static-libraries (multiple dirs)
 
1075
    if test -n "$site_static_libraries"; then
 
1076
        echo "    Appending directories to the C include path:"
 
1077
        for arg in $site_static_libraries; do
 
1078
            arg=`echo "/LIBPATH:\"${arg}\"" | sed 's,\([[^/]]\)/*$,\1,'`
 
1079
            win_ld_site_libraries="${win_ld_site_libraries} $arg"
 
1080
            echo "              \"$arg\""
 
1081
        done
 
1082
    fi
 
1083
 
 
1084
    if test "${enable_mt}" = "yes" -o "${enable_ccmpl}" = "yes" ; then
 
1085
        win_ld_site_libraries="pthreadVC1.lib ${win_ld_site_libraries}"
 
1086
    fi
 
1087
fi
 
1088
 
 
1089
AC_CHECK_PROG(perl_support, perl, "yes", "no")
 
1090
 
 
1091
if test "${perl_support}" = "yes"; then
 
1092
    #old versions of perl don't have Config module
 
1093
    # so we check for this as well
 
1094
    perl_archlib=`perl -MConfig -e 'print $Config{archlib}'` || perl_support=no
 
1095
fi
 
1096
 
 
1097
if test "${perl_support}" = "yes"; then
 
1098
    perl_cc_compiler=`perl -MConfig -e 'print $Config{cc}'`
 
1099
    perl_ccflags=`perl -MConfig -e 'print $Config{ccflags}'`
 
1100
    perl_libs=`perl -MConfig -e 'print $Config{libs}'`
 
1101
 
 
1102
    # Perl base revision comes out as 5.0, so we strip .0
 
1103
    perl_baserev=`perl -MConfig -e 'print "$Config{baserev}\n"' | sed -e 's/\..*//'`
 
1104
    perl_patchlevel=`perl -MConfig -e 'print $Config{patchlevel}'`
 
1105
 
 
1106
   # perl support doesn't work with perl < 5.004
 
1107
   if test $[perl_baserev] -lt 5 ; then
 
1108
        perl_support=no
 
1109
   fi
 
1110
 
 
1111
   if test "$perl_baserev" = "5" -a $[perl_patchlevel] -lt 4  ; then
 
1112
        perl_support=no
 
1113
   fi
 
1114
fi
 
1115
 
 
1116
if test "`echo $perl_libs | sed 's/-lgdbm//'`" != "$perl_libs"; then
 
1117
    AC_CHECK_LIB(gdbm, main,, perl_support=no)
 
1118
fi
 
1119
 
 
1120
if test "`echo $perl_libs | sed 's/-lndbm//'`" != "$perl_libs"; then
 
1121
    AC_CHECK_LIB(ndbm, main,, perl_support=no)
 
1122
fi
 
1123
 
 
1124
# Need to re-state the trap since configure resets it occasionally
 
1125
trap 'rm buildxsb.lock; exit 1' 1 2 3 15
 
1126
 
 
1127
AC_SUBST(regmatch_support)
 
1128
AC_SUBST(wildmatch_support)
 
1129
 
 
1130
AC_SUBST(perl_archlib)
 
1131
AC_SUBST(perl_cc_compiler)
 
1132
AC_SUBST(perl_ccflags)
 
1133
AC_SUBST(perl_libs)
 
1134
 
 
1135
 
 
1136
# Java support
 
1137
AC_CHECK_PROG(java_support, javac, "yes", "no")
 
1138
if test "${java_support}" = "yes"; then
 
1139
    dnl after AC_CHECK_PROG, ac_dir holds the directory where javac is found
 
1140
    javac="$ac_dir"/javac
 
1141
else
 
1142
    javac=javac
 
1143
fi
 
1144
 
 
1145
AC_SUBST(javac)
 
1146
AC_SUBST(java_support)
 
1147
 
 
1148
AC_PATH_PROG(java_path,javac,no)
 
1149
java_path=`dirname $java_path`
 
1150
java_path=`dirname $java_path`
 
1151
java_path=$java_path/include
 
1152
#java_path=`echo $java_path | sed 's,bin/javac,include,' `
 
1153
 
 
1154
if test "${with_interprolog}" = "yes"; then
 
1155
    if test "${java_support}" != "yes"; then
 
1156
        echo "Interprolog not supported due to failure to find Java"
 
1157
        with_interprolog=""
 
1158
        JAVA_HEADER_PATH=""
 
1159
        JAVA_PLATFORM_HEADER_PATH=""
 
1160
  else
 
1161
        JAVA_HEADER_PATH=${java_path}
 
1162
        JAVA_PLATFORM_HEADER_PATH=`ls ${JAVA_HEADER_PATH}/*/jni_md.h`
 
1163
        JAVA_PLATFORM_HEADER_PATH="${JAVA_PLATFORM_HEADER_PATH%jni_md.h}"
 
1164
    echo "Obtaining Java header files form ${JAVA_HEADER_PATH} and ${JAVA_PLATFORM_HEADER_PATH}"
 
1165
  fi
 
1166
else
 
1167
  JAVA_HEADER_PATH=""
 
1168
fi
 
1169
 
 
1170
 
 
1171
AC_SUBST(JAVA_HEADER_PATH)
 
1172
AC_SUBST(JAVA_PLATFORM_HEADER_PATH)
 
1173
 
 
1174
# profiling implies debug
 
1175
if test "${enable_profile}" = "yes"; then
 
1176
    AC_DEFINE(DEBUG)
 
1177
    AC_DEFINE(PROFILE)
 
1178
    do_debugging=yes
 
1179
fi
 
1180
 
 
1181
if test "${enable_debug}" = "yes"; then
 
1182
    AC_DEFINE(NON_OPT_COMPILE)
 
1183
    AC_DEFINE(DEBUG)
 
1184
dnl    AC_DEFINE(CP_DEBUG)
 
1185
    do_debugging=yes
 
1186
fi
 
1187
 
 
1188
if test "${enable_debug_verbose}" = "yes"; then
 
1189
   AC_DEFINE(DEBUG_VERBOSE)
 
1190
fi
 
1191
 
 
1192
if test "${enable_debug_vm}" = "yes"; then
 
1193
   AC_DEFINE(DEBUG_VM)
 
1194
fi
 
1195
 
 
1196
if test "${enable_debug_assertions}" = "yes"; then
 
1197
   AC_DEFINE(DEBUG_ASSERTIONS)
 
1198
   AC_DEFINE(CP_DEBUG)
 
1199
fi
 
1200
 
 
1201
 
 
1202
jumptable=no
 
1203
if test "${CC}" = "gcc" -o "${with_gcc+set}" = "set"; then
 
1204
   if test "${disable_jumptable}" != "yes"; then
 
1205
        AC_DEFINE(JUMPTABLE_EMULOOP)
 
1206
        jumptable=yes
 
1207
        CFLAGS=`echo ${CFLAGS} | sed -e "s/-ansi//"`
 
1208
        CFLAGS=`echo ${CFLAGS} | sed -e "s/-pedantic//"`
 
1209
   fi
 
1210
fi
 
1211
 
 
1212
AC_DEFINE(INSN_BLOCKS)
 
1213
 
 
1214
#AC_ARG_ENABLE(insn-blocks,
 
1215
#[  --enable-insn-blocks       Make temp variables local to wam insns])
 
1216
#insn_blocks=no
 
1217
#if test "${enable_insn_blocks}" = "yes" ; then
 
1218
#       AC_DEFINE(INSN_BLOCKS)
 
1219
#       insn_blocks=yes
 
1220
#fi
 
1221
 
 
1222
if test "${enable_mt}" = "yes" -o "${enable_ccmpl}" = "yes" ; then
 
1223
    AC_DEFINE(MULTI_THREAD)
 
1224
 
 
1225
    if test "${host_os}" = "cygwin"; then
 
1226
        LDFLAGS="${LDFLAGS} -lpthreadVSE1"
 
1227
    else
 
1228
        if test "$with_os" != wind ; then
 
1229
            LDFLAGS="${LDFLAGS} -lpthread"
 
1230
        fi
 
1231
    fi
 
1232
 
 
1233
    CFLAGS="${CFLAGS} -D_GNU_SOURCE"
 
1234
fi
 
1235
 
 
1236
if test "${enable_ccmpl}" = "yes" ; then
 
1237
    AC_DEFINE(CONC_COMPL)
 
1238
fi
 
1239
 
 
1240
if test "${enable_mt}" = "yes" ; then
 
1241
    AC_DEFINE(SHARED_COMPL_TABLES)
 
1242
fi
 
1243
 
 
1244
if test "${with_profiling}" = "yes" ; then
 
1245
    enable_profiling=yes
 
1246
fi
 
1247
if test "${enable_profiling}" = "yes" ; then
 
1248
    CFLAGS="-pg -ggdb -a ${CFLAGS}"
 
1249
    LDFLAGS="-pg ${LDFLAGS}"
 
1250
fi
 
1251
 
 
1252
if test "${with_electric_fence}" = "yes" ; then
 
1253
    enable_electric_fence=yes
 
1254
fi
 
1255
if test "${enable_electric_fence}" = "yes" ; then
 
1256
    echo "enabling electric fence..."
 
1257
    LDFLAGS="${LDFLAGS} -lefence"
 
1258
    AC_DEFINE(ELECTRIC_FENCE)
 
1259
fi
 
1260
 
 
1261
dnl Check for Incr Tcl (used in the XMC gui)
 
1262
 
 
1263
AC_PATH_PROG(itkwish_path, itkwish, no, $PATH:$with_itkwish)
 
1264
if test "${itkwish_path}" = "no"; then
 
1265
   echo "XMC GUI not supported due to failure to find Incr Tcl/Tk"
 
1266
fi
 
1267
 
 
1268
AC_SUBST(itkwish_path)
 
1269
 
 
1270
dnl experimental: use bp register for lpcreg
 
1271
dnl lfcastro
 
1272
#AC_ARG_ENABLE(bp-lpcreg,
 
1273
#[  --enable-bp-lpcreg          put local pcreg into BP register on x86s])
 
1274
#bp_free=no
 
1275
#if test "${enable_bp_lpcreg}" = "yes" ; then
 
1276
#   bp_free=`echo ${emuloop_opt_level} | \
 
1277
#       sed 's/.*\(-fomit-frame-pointer\).*/yes/'`
 
1278
#   if test "${bp_free}" = "yes" ; then
 
1279
#       AC_DEFINE(USE_BP_LPCREG)
 
1280
#  else
 
1281
#    AC_MSG_ERROR(Cannot use BP without -fomit-frame-pointer)
 
1282
#   fi
 
1283
#fi
 
1284
 
 
1285
 
 
1286
# Normally, the optimization level will be O4.
 
1287
# SGI64 must have O1 and 32 bit SGI's can have O2
 
1288
if test "$__sunpro_c" = "no"; then
 
1289
    if test "$CC" = "gcc" ; then
 
1290
        c_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
1291
    else
 
1292
        c_opt_level=-${optimization_level-"O4"}
 
1293
    fi
 
1294
else
 
1295
    c_opt_level=-${optimization_level-"xO4"}
 
1296
fi
 
1297
 
 
1298
 
 
1299
####### Test for -export-dynamic option of ld
 
1300
TEMP_LDFLAGS=$LDFLAGS
 
1301
LDFLAGS="-Wl,-export-dynamic"
 
1302
AC_MSG_CHECKING(whether loader understands -Wl,-export-dynamic)
 
1303
AC_TRY_LINK([],[], __export_dynamic=yes, __export_dynamic=no)
 
1304
AC_MSG_RESULT($__export_dynamic)
 
1305
LDFLAGS=$TEMP_LDFLAGS
 
1306
####### End of test for -export-dynamic option of ld
 
1307
 
 
1308
if test "${enable_no_cygwin}" != "yes" -o \( "${host_os}" != "cygwin" -a "${host_os}" != "windows" \); then
 
1309
    LDFLAGS="$LDFLAGS -lm"
 
1310
fi
 
1311
 
 
1312
 
 
1313
# these are used to set up the xsbdynmod parameters under Unixes and MacOS X
 
1314
DYNMOD_LINKFLAGS=-shared
 
1315
DYNMOD_SHAREDLIB_EXTENSION=so
 
1316
 
 
1317
# Set OS-specific variables for XSB
 
1318
case "$canonical" in
 
1319
    *alpha*)    AC_DEFINE(FOREIGN_ELF)
 
1320
        ;;
 
1321
    *hpux*)     AC_DEFINE(HP700)
 
1322
                AC_DEFINE(_HPUX_SOURCE)
 
1323
        ;;
 
1324
    *linux*)    AC_DEFINE(LINUX)
 
1325
                AC_DEFINE(_GNU_SOURCE)
 
1326
 
 
1327
                if test "`uname -r | cut -d "." -f "1 2"`" = "2.6"; then
 
1328
                    echo "Guessing the tagging for this version of Linux"
 
1329
                    AC_DEFINE(GENERAL_TAGGING)
 
1330
                fi
 
1331
 
 
1332
                case "${canonical}" in
 
1333
                    *ppc* | *powerpc* | *m68k* ) AC_DEFINE(MKLINUX_PPC)
 
1334
                    ;;
 
1335
                    dnl Linux a.out
 
1336
                    *)
 
1337
                    if test "${ac_linuxaout+set}" = "set" ; then
 
1338
                        AC_DEFINE(LINUX_AOUT)
 
1339
                    else
 
1340
                        dnl Linux ELF
 
1341
                        AC_DEFINE(LINUX_ELF)
 
1342
#                                   if test "${CC}" = "gcc" -o "${with_gcc+set}" = "set"; then
 
1343
#                                     CFLAGS="-m486 ${CFLAGS}"
 
1344
#                                     AC_DEFINE(USE_BP_LPCREG)
 
1345
#                                   fi
 
1346
 
 
1347
                        if test "${have_dl}" != "no" ; then
 
1348
                            AC_DEFINE(FOREIGN_ELF)
 
1349
                            LDFLAGS="${LDFLAGS} -ldl"
 
1350
 
 
1351
                            if test "$__export_dynamic" = "yes" ; then
 
1352
                                LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
 
1353
                            fi
 
1354
                        fi
 
1355
 
 
1356
                        if test "${have_pthread}" != "no" ; then
 
1357
                            LDFLAGS="${LDFLAGS} -lpthread"
 
1358
                        fi
 
1359
                    fi
 
1360
                ;;
 
1361
                esac
 
1362
        ;;
 
1363
    *freebsd* ) AC_DEFINE(FREEBSD)
 
1364
                AC_DEFINE(FOREIGN_ELF)
 
1365
                if test "$__export_dynamic" = "yes" ; then
 
1366
                    LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
 
1367
                fi
 
1368
 
 
1369
                if test "${have_dl}" = yes ; then
 
1370
                    LDFLAGS="${LDFLAGS} -ldl"
 
1371
                fi
 
1372
 
 
1373
                if test "${have_pthread}" != "no" ; then
 
1374
                    LDFLAGS="${LDFLAGS} -lpthread"
 
1375
                fi
 
1376
        ;;
 
1377
    *-rhapsody* | *-darwin* )
 
1378
                CFLAGS="-faltivec -fPIC ${CFLAGS} "
 
1379
                AC_DEFINE(DARWIN)
 
1380
                AC_DEFINE(FOREIGN_ELF)
 
1381
        DYNMOD_LINKFLAGS="-dynamiclib -single_module -nostartfiles"
 
1382
        DYNMOD_SHAREDLIB_EXTENSION=jnilib
 
1383
        ;;
 
1384
    *sgi* )     AC_DEFINE(FOREIGN_ELF)
 
1385
                if test "${machine64bit}" = yes ; then
 
1386
                    AC_DEFINE(SGI64)
 
1387
                    c_opt_level=-${optimization_level-"O1"}
 
1388
                    emuloop_opt_level=-${optimization_level-"O1"}
 
1389
                    trutils_opt_level=-${optimization_level-"O1"}
 
1390
                    builtins_opt_level=-${optimization_level-"O1"}
 
1391
                    loader_opt_level=-${optimization_level-"O1"}
 
1392
 
 
1393
                    if test ! "$CC" = gcc ; then
 
1394
                        CFLAGS="${CFLAGS} -64 -OPT:Olimit=9500"
 
1395
                        LDFLAGS="-64 -lm"
 
1396
                        LINKFLAGS="-64"
 
1397
                        GPPCFLAGS="-64"
 
1398
                    fi
 
1399
                else
 
1400
                    AC_DEFINE(SGI)
 
1401
                    c_opt_level=-${optimization_level-"O2"}
 
1402
                    emuloop_opt_level=-${optimization_level-"O2"}
 
1403
                    trutils_opt_level=-${optimization_level-"O2"}
 
1404
                    builtins_opt_level=-${optimization_level-"O2"}
 
1405
                    loader_opt_level=-${optimization_level-"O1"}
 
1406
 
 
1407
                    if test ! "$CC" = gcc ; then
 
1408
                        CFLAGS="${CFLAGS} -OPT:Olimit=7500"
 
1409
                        GPPCFLAGS="-OPT:Olimit=7500"
 
1410
                    fi
 
1411
                fi
 
1412
                trutils_opt_level=${c_opt_level}
 
1413
        ;;
 
1414
    *-solaris* | *-sunos5* )
 
1415
                AC_DEFINE(SOLARIS)
 
1416
                LDFLAGS="${LDFLAGS} -lnsl -ldl"
 
1417
 
 
1418
                if test "${have_dl}" = "no" ; then
 
1419
                    AC_MSG_ERROR(Your system is missing library: \`dl')
 
1420
                fi
 
1421
                if test "${have_nsl}" = "no" ; then
 
1422
                    AC_MSG_ERROR(Your system is missing library: \`nsl')
 
1423
                fi
 
1424
 
 
1425
                if test "${have_pthread}" != "no" ; then
 
1426
                    LDFLAGS="${LDFLAGS} -lpthread"
 
1427
                fi
 
1428
 
 
1429
                AC_DEFINE(BIG_MEM)
 
1430
                AC_DEFINE(FOREIGN_ELF)
 
1431
 
 
1432
                case "${canonical}" in
 
1433
                    *i*86-*-*) AC_DEFINE(SOLARIS_x86)
 
1434
                    ;;
 
1435
                    *)
 
1436
                    ;;
 
1437
                esac
 
1438
 
 
1439
                LDFLAGS="-lsocket ${LDFLAGS}"
 
1440
                if test "$__export_dynamic" = "yes" ; then
 
1441
                    LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
 
1442
                fi
 
1443
                if test "${have_socket}" = "no" ; then
 
1444
                    AC_MSG_ERROR(Your system is missing library: \`socket')
 
1445
                fi
 
1446
        ;;
 
1447
    *-aix*)     AC_DEFINE(IBM)
 
1448
        ;;
 
1449
    *-sunos4*)  AC_DEFINE(SUN)
 
1450
                AC_DEFINE(FOREIGN_AOUT)
 
1451
                CFLAGS="${CFLAGS} -DBIG_MEM"
 
1452
                LDFLAGS="${LDFLAGS} -N"
 
1453
        ;;
 
1454
    *-cygwin*)  AC_DEFINE(CYGWIN)
 
1455
                real_host_os=cygwin
 
1456
 
 
1457
                builtins_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
1458
                loader_opt_level=-${optimization_level-"O3 -fno-strict-aliasing"}
 
1459
 
 
1460
                if test "${enable_no_cygwin}" = "yes"; then
 
1461
                    echo 'Configuring for host system type... no-cygwin'
 
1462
                    host_os=windows
 
1463
                    os_type=windows
 
1464
                    os_version=
 
1465
                    host_vendor=pc
 
1466
                    host_cpu=x86
 
1467
                    configuration_templ=xsb_configuration.in
 
1468
                    config_dot_h_templ=def_config_mnoc.in
 
1469
                    GPPWNTFLAG="-D WIN_NT"
 
1470
 
 
1471
#                    if test "${xsb_scheduling_strategy}" = "local" ; then
 
1472
#                        emuloop_opt_level=-${optimization_level-"O1 -fomit-frame-pointer"}
 
1473
#                    fi
 
1474
 
 
1475
                    LDFLAGS="$LDFLAGS -lwsock32 -luser32"
 
1476
                fi
 
1477
        ;;
 
1478
esac
 
1479
 
 
1480
if test "${general_tagging}" = "yes" ; then
 
1481
   AC_DEFINE(GENERAL_TAGGING)
 
1482
fi
 
1483
 
 
1484
AC_SUBST(DYNMOD_SHAREDLIB_EXTENSION)
 
1485
AC_SUBST(DYNMOD_LINKFLAGS)
 
1486
 
 
1487
# check for MIPS
 
1488
case "$canonical" in
 
1489
    *mips*) AC_DEFINE(MIPS_BASED)
 
1490
    ;;
 
1491
esac
 
1492
 
 
1493
dnl Let autoconf take care of the "inline" and "const" keywords.
 
1494
if test -z "$with_os" ; then
 
1495
    dnl test for inlining only on Unix
 
1496
    dnl hard-set it in xsb_config.h on windows
 
1497
    AC_C_INLINE
 
1498
fi
 
1499
 
 
1500
# Don't optimize and inline if debugging!!
 
1501
if test "${do_debugging}" = "yes"  -o "${disable_optimization}" = "yes" ; then
 
1502
    c_opt_level=
 
1503
    emuloop_opt_level=
 
1504
    trutils_opt_level=
 
1505
    builtins_opt_level=
 
1506
    loader_opt_level=
 
1507
    c_inline_level=
 
1508
fi
 
1509
if test "${do_debugging}" = "yes" ; then
 
1510
    if test "${enable_dwarf_debug}" = "yes" ; then
 
1511
        CFLAGS="${CFLAGS} -gdwarf-2 -g3"
 
1512
    else
 
1513
        CFLAGS="${CFLAGS} -g"
 
1514
        LDFLAGS=" -g ${LDFLAGS}"
 
1515
        LINKFLAGS=" -g ${LINKFLAGS}"
 
1516
    fi
 
1517
fi
 
1518
 
 
1519
if test "${CC}" = "gcc" -a "${host_os}" != "windows"  ; then
 
1520
    dnl gcc is smarter when creating dynamic libraries in Unix
 
1521
    LD=gcc
 
1522
    LINKFLAGS="-nodefaultlibs -nostartfiles ${LINKFLAGS}"
 
1523
else
 
1524
    LD=ld
 
1525
fi
 
1526
 
 
1527
dnl special flags for simplescalar
 
1528
if test "${CC}" = "sslittle-na-sstrix-gcc"; then
 
1529
    AC_DEFINE(SIMPLESCALAR)
 
1530
    CROSS_SIMULATOR="sim-fast"
 
1531
    c_opt_level=-${optimization_level-"O1"}
 
1532
    LD=sslittle-na-sstrix-ld
 
1533
fi
 
1534
 
 
1535
if test "${CC}" = "arm-linux-gcc"; then
 
1536
    LD=arm-linux-ld
 
1537
fi
 
1538
 
 
1539
#dnl Prepend Oracle tricky library list
 
1540
#if test "${with_oracle}" = yes ; then
 
1541
#   LDFLAGS="-lclntsh -lsql -lsqlnet -lncr \
 
1542
#               -lsqlnet -lclient -lcommon -lgeneric -lsqlnet \
 
1543
#               -lncr -lsqlnet -lclient -lcommon -lgeneric \
 
1544
#               -lepc -lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 \
 
1545
#               -lnlsrtl3 -lsocket -lnsl -lm -ldl -lm -lthread \
 
1546
#               ${LDFLAGS}"
 
1547
#fi
 
1548
 
 
1549
# dnl ODBC library
 
1550
if test "${with_odbc}" = yes ; then
 
1551
   case "$canonical" in
 
1552
    *-cygwin*)  LDFLAGS="-lodbc32 ${LDFLAGS}"
 
1553
                LINKFLAGS="-lodbc32 ${LINKFLAGS}"
 
1554
        ;;
 
1555
    *)          if test -n "${with_iodbc}"; then
 
1556
                    LDFLAGS="-liodbc ${LDFLAGS}"
 
1557
                    LINKFLAGS="-liodbc ${LINKFLAGS}"
 
1558
                else
 
1559
                    LDFLAGS="-lodbc ${LDFLAGS}"
 
1560
                    LINKFLAGS="-lodbc ${LINKFLAGS}"
 
1561
                fi
 
1562
    esac
 
1563
fi
 
1564
 
 
1565
# this is needed for -mno-cygwin dll compilation
 
1566
DLLTYPE=nodll
 
1567
 
 
1568
if test "${enable_no_cygwin}" = "yes" -a "${real_host_os}" = "cygwin"; then
 
1569
    CC="${CC} -mno-cygwin"
 
1570
    DLLTYPE=cygdll
 
1571
fi
 
1572
 
 
1573
#These are used to compile the interface with sModels
 
1574
if test "x${with_smodels}" = "x"; then
 
1575
    echo "    Not using SMODELS"
 
1576
    smodels_goal=nope
 
1577
else
 
1578
    AC_PROG_CXX
 
1579
    smodels_goal=all
 
1580
    if test  "$os_type" = "windows"; then
 
1581
        XASPLIBNAME=xasppkg.dll
 
1582
        XASPDEFFILE=xasppkg.def
 
1583
        smoCFLAGS="-I${arch_config_prefix} -I${with_smodels}"
 
1584
        smoLDFLAGS="-L${arch_config_prefix}/bin -L${with_smodels}"
 
1585
        smoLIB="-lsmodels -lxsb"
 
1586
        if test "${enable_no_cygwin}" = "yes"; then
 
1587
            CXX="${CXX} -mno-cygwin"
 
1588
        fi
 
1589
    else
 
1590
        XASPLIBNAME=xasppkg.so
 
1591
        XASPDEFFILE=
 
1592
        smoCFLAGS="-I${arch_config_prefix} -I${with_smodels}"
 
1593
        smoLDFLAGS="-L${arch_config_prefix}/bin"
 
1594
        smoLIB="${with_smodels}/.libs/libsmodels.a"
 
1595
    fi
 
1596
 
 
1597
    AC_SUBST(XASPLIBNAME)
 
1598
    AC_SUBST(XASPDEFFILE)
 
1599
    AC_SUBST(smoCFLAGS)
 
1600
    AC_SUBST(smoLDFLAGS)
 
1601
    AC_SUBST(smoLIB)
 
1602
fi
 
1603
 
 
1604
AC_SUBST(with_smodels)
 
1605
AC_SUBST(smodels_goal)
 
1606
 
 
1607
 
 
1608
loaderCFLAGS="${c_site_includes} ${loader_opt_level} ${c_inline_level} ${CFLAGS}"
 
1609
builtinsCFLAGS="${c_site_includes} ${builtins_opt_level} ${c_inline_level} ${CFLAGS}"
 
1610
emuloopCFLAGS="${c_site_includes} ${emuloop_opt_level} ${c_inline_level} ${CFLAGS}"
 
1611
trutilsCFLAGS="${c_site_includes} ${trutils_opt_level} ${c_inline_level} ${CFLAGS}"
 
1612
dnl Set CFLAGS **after** emuloopCFLAGS, trutilsCFLAGS
 
1613
CFLAGS="${c_site_includes} ${c_opt_level} ${c_inline_level} ${CFLAGS}"
 
1614
LDFLAGS="${ld_site_libraries} ${LDFLAGS}"
 
1615
 
 
1616
 
 
1617
os_version=`echo $host_os | sed -e 's/[[^0-9]]*//'`
 
1618
os_type=`echo $host_os | sed -e 's/[[0-9]].*$//'`
 
1619
 
 
1620
dnl Some more #define symbols
 
1621
AC_DEFINE_UNQUOTED(CONFIGURATION, "${canonical}")
 
1622
AC_DEFINE_UNQUOTED(FULL_CONFIG_NAME, "${full_config_name}")
 
1623
 
 
1624
if test "${enable_profile+yes}" = "yes"; then
 
1625
    compile_mode=profile
 
1626
elif test "${enable_debug+yes}" = "yes"; then
 
1627
    compile_mode=debug
 
1628
elif test "$disable_optimization" = "yes"; then
 
1629
    compile_mode=normal
 
1630
else
 
1631
    compile_mode=optimal
 
1632
fi
 
1633
 
 
1634
### Specify what will be substituted into Makefile, xsb_config.h, etc.
 
1635
AC_SUBST(xsb_version)
 
1636
AC_SUBST(canonical)
 
1637
AC_SUBST(full_config_name)
 
1638
AC_SUBST(topdir)
 
1639
AC_SUBST(prefix)
 
1640
AC_SUBST(mt_mode)
 
1641
 
 
1642
AC_SUBST(CROSS_SIMULATOR)
 
1643
AC_SUBST(LD)
 
1644
 
 
1645
AC_SUBST(arch_config_prefix)
 
1646
AC_SUBST(arch_install_config_prefix)
 
1647
AC_SUBST(arch_config_file)
 
1648
AC_SUBST(config_tag)
 
1649
 
 
1650
AC_SUBST(arch_bindir)
 
1651
 
 
1652
AC_SUBST(CFLAGS)
 
1653
AC_SUBST(loaderCFLAGS)
 
1654
AC_SUBST(builtinsCFLAGS)
 
1655
AC_SUBST(emuloopCFLAGS)
 
1656
AC_SUBST(trutilsCFLAGS)
 
1657
AC_SUBST(GPPCFLAGS)
 
1658
AC_SUBST(GPPWNTFLAG)
 
1659
AC_SUBST(CC)
 
1660
AC_SUBST(CXX)
 
1661
AC_SUBST(LDFLAGS)
 
1662
dnl used for SGIs only
 
1663
AC_SUBST(LINKFLAGS)
 
1664
 
 
1665
# Just something so we won't forget to set it in the future
 
1666
emumake_goal=doodledandy
 
1667
 
 
1668
if test "${with_oracle}" = "yes" ; then
 
1669
    emumake_goal=xsbora
 
1670
else
 
1671
    emumake_goal=xsb
 
1672
fi
 
1673
AC_SUBST(emumake_goal)
 
1674
 
 
1675
# These are used in xsb_configuration.in
 
1676
AC_SUBST(host_os)
 
1677
AC_SUBST(os_version)
 
1678
AC_SUBST(os_type)
 
1679
AC_SUBST(host_vendor)
 
1680
AC_SUBST(host_cpu)
 
1681
AC_SUBST(compile_mode)
 
1682
AC_SUBST(xsb_major_version)
 
1683
AC_SUBST(xsb_minor_version)
 
1684
AC_SUBST(xsb_beta_version)
 
1685
AC_SUBST(xsb_codename)
 
1686
AC_SUBST(release_year)
 
1687
AC_SUBST(release_month)
 
1688
AC_SUBST(release_monthname)
 
1689
AC_SUBST(release_day)
 
1690
AC_SUBST(xsb_scheduling_strategy)
 
1691
AC_SUBST(site_prefix)
 
1692
 
 
1693
AC_SUBST(xsb_release_date)
 
1694
AC_SUBST(xsb_full_version_name)
 
1695
AC_SUBST(engine_mode)
 
1696
 
 
1697
AC_SUBST(ODBCSRC)
 
1698
AC_SUBST(ODBCOBJ)
 
1699
AC_SUBST(INTERPROLOGSRC)
 
1700
AC_SUBST(INTERPROLOGOBJ)
 
1701
AC_SUBST(mno_cyg_inclib)
 
1702
AC_SUBST(mno_cyg_lib)
 
1703
AC_SUBST(DLLTYPE)
 
1704
AC_SUBST(win_site_includes)
 
1705
AC_SUBST(win_ld_site_libraries)
 
1706
 
 
1707
## XSB file extensions
 
1708
xsb_src_extension_sans_dot=P
 
1709
xsb_hdr_extension_sans_dot=H
 
1710
xsb_obj_extension_sans_dot=xwam
 
1711
xsb_asm_extension_sans_dot=A
 
1712
xsb_dcl_extension_sans_dot=D
 
1713
AC_SUBST(xsb_src_extension_sans_dot)
 
1714
AC_SUBST(xsb_hdr_extension_sans_dot)
 
1715
AC_SUBST(xsb_obj_extension_sans_dot)
 
1716
AC_SUBST(xsb_asm_extension_sans_dot)
 
1717
AC_SUBST(xsb_dcl_extension_sans_dot)
 
1718
xsb_src_extension=.$xsb_src_extension_sans_dot
 
1719
xsb_hdr_extension=.$xsb_hdr_extension_sans_dot
 
1720
xsb_obj_extension=.$xsb_obj_extension_sans_dot
 
1721
xsb_asm_extension=.$xsb_asm_extension_sans_dot
 
1722
xsb_dcl_extension=.$xsb_dcl_extension_sans_dot
 
1723
AC_SUBST(xsb_src_extension)
 
1724
AC_SUBST(xsb_hdr_extension)
 
1725
AC_SUBST(xsb_obj_extension)
 
1726
AC_SUBST(xsb_asm_extension)
 
1727
AC_SUBST(xsb_dcl_extension)
 
1728
 
 
1729
AC_OUTPUT([ ${arch_config_prefix}/topMakefile:topMakefile.in
 
1730
        ${arch_config_prefix}/emuMakefile:emuMakefile.in
 
1731
        ${arch_config_prefix}/modMakefile:modMakefile.in
 
1732
        ${arch_config_prefix}/gppMakefile:gppMakefile.in
 
1733
        ${arch_config_prefix}/smoMakefile:smoMakefile.in
 
1734
        ${arch_config_prefix}/makedef.sh:makedef.sh.in
 
1735
        ${arch_config_file}:${configuration_templ}
 
1736
        makexsb:makexsb.in
 
1737
        ${emudir}/extensions_xsb.h:extensions_xsb.in
 
1738
        ${scriptdir}/xsb${config_tag}:xsb.in
 
1739
        ${scriptdir}/chr_pp${config_tag}:chr_pp.in
 
1740
        ${scriptdir}/xsb.bat:wxsb.in
 
1741
        ${arch_config_prefix}/banner.msg:banner.in
 
1742
        ${arch_config_prefix}/MSVC_mkfile.mak:MSVC_mkfile.in
 
1743
        ${prefix}/packages/xmc/xmc-gui:xmc-gui.in
 
1744
        ])
 
1745
 
 
1746
chmod 644 ${arch_config_file}
 
1747
 
 
1748
# Need to re-state the trap since configure resets it occasionally
 
1749
trap 'rm buildxsb.lock; exit 1' 1 2 3 15
 
1750
 
 
1751
############ End of configuration -- the rest is mostly cosmetic ##############
 
1752
###############################################################################
 
1753
 
 
1754
 
 
1755
#### Report on what we decided to do.
 
1756
dnl Start redirection to | tee Installation_summary
 
1757
 
 
1758
install_date=`date`
 
1759
 
 
1760
(
 
1761
echo "
 
1762
 
 
1763
            INSTALLATION SUMMARY
 
1764
            --------------------
 
1765
 
 
1766
XSB Version:       ${xsb_version}
 
1767
Code name:         ${xsb_codename}
 
1768
Release date:      ${xsb_release_date}
 
1769
Configuration:     ${canonical}
 
1770
Installation date: ${install_date}
 
1771
 
 
1772
  Build process is looking for XSB sources in:    ${topdir}
 
1773
  XSB should be installed in:                     ${prefix}
 
1774
  Configuration-specific executables go in:       ${arch_bindir}
 
1775
  Configuration-specific libraries go in:         ${arch_config_libdir}
 
1776
  Object code goes in:                            ${arch_config_objlibdir}
 
1777
  Site-specific code goes in:                     ${site_prefix}
 
1778
  Site configuration-specific code goes in:       ${site_config_prefix}
 
1779
  XSB will be built with:                         ${CC} ${CFLAGS}
 
1780
  builtin.c will be built with:                   ${CC} ${builtinsCFLAGS}
 
1781
  loader_xsb.c will be built with:                ${CC} ${loaderCFLAGS}
 
1782
  emuloop.c will be built with:                   ${CC} ${emuloopCFLAGS}
 
1783
  tr_utils.c will be built with:                  ${CC} ${trutilsCFLAGS}
 
1784
  Loader flags:                                 ${LDFLAGS}
 
1785
  Compilation mode:                               ${compile_mode}
 
1786
  XSB abstract machine:                           ${engine_mode}
 
1787
  XSB scheduling strategy:                        ${xsb_scheduling_strategy}
 
1788
  Garbage Collection Stress-Test:                 ${gc_test}
 
1789
  Jumptable-based emulator loop:                  ${jumptable}
 
1790
  Demand support:                                 ${demand}"
 
1791
 
 
1792
 
 
1793
 
 
1794
case "$with_oracle" in
 
1795
   "yes") echo "  Building with support for ORACLE:               yes"
 
1796
    ;;
 
1797
   "no")  echo "  Building with support for ORACLE:               NO"
 
1798
    ;;
 
1799
esac
 
1800
case "$with_odbc" in
 
1801
   "yes") echo "  Building with support for ODBC:                 yes"
 
1802
    ;;
 
1803
   "no")  echo "  Building with support for ODBC:                 NO"
 
1804
    ;;
 
1805
esac
 
1806
case "$with_interprolog" in
 
1807
   "yes") echo "  Building with support for InterProlog:          yes"
 
1808
    ;;
 
1809
   "no")  echo "  Building with support for InterProlog:          NO"
 
1810
    ;;
 
1811
esac
 
1812
 
 
1813
if test -n "$site_dynamic_libraries" ; then
 
1814
   echo "  Configured with dynamic libraries:"
 
1815
   for arg in $site_dynamic_libraries ; do
 
1816
    dnl Strip the trailing slashes
 
1817
    arg=`echo "${arg}" | sed 's,\([[^/]]\)/*$,\1,'`
 
1818
    echo "                            $arg"
 
1819
   done
 
1820
fi
 
1821
echo "  POSIX regexp matching libraries:                $regmatch_support"
 
1822
echo "  POSIX wildcard matching libraries:              $wildmatch_support"
 
1823
echo "  Perl support:                                   $perl_support"
 
1824
 
 
1825
if test "$perl_support" = "yes"; then
 
1826
   cat <<EOT
 
1827
  Perl archlib:                                   $perl_archlib/CORE
 
1828
  Perl C compiler:                                $perl_cc_compiler
 
1829
  Perl C flags:                                   $perl_ccflags
 
1830
  Perl loader flags:                              $perl_libs
 
1831
EOT
 
1832
fi
 
1833
 
 
1834
if test -n "${with_libwww}" && test -f $topdir/packages/libwww/Installation_summary; then
 
1835
    cat $topdir/packages/libwww/Installation_summary
 
1836
fi
 
1837
 
 
1838
if test -n "${with_dbdrivers}" && test -f $topdir/packages/dbdrivers/Installation_summary; then
 
1839
    cat $topdir/packages/dbdrivers/Installation_summary
 
1840
fi
 
1841
 
 
1842
if test -n "$javac"; then
 
1843
   cat <<EOT
 
1844
  Java compiler:                                  $javac
 
1845
EOT
 
1846
fi
 
1847
 
 
1848
 
 
1849
echo ""
 
1850
echo ""
 
1851
) | tee Installation_summary
 
1852
 
 
1853
 
 
1854
 
 
1855
# This is needed so that *after* XSB is installed in a common directory,
 
1856
# users could compile packages that produce arch-specific code.
 
1857
chmod 777 ${site_config_libdir};
 
1858
chmod a+t ${site_config_libdir};
 
1859
chmod 777 ${arch_install_config_libdir};
 
1860
chmod a+t ${arch_install_config_libdir};
 
1861
 
 
1862
 
 
1863
dnl Add site dynamic libraries to XSB library path
 
1864
if test -n "$site_dynamic_libraries"; then
 
1865
  tempfile=/tmp/libpath.$$
 
1866
  echo ""
 
1867
  echo "Appending dynamic libraries to the XSB library search path:"
 
1868
  echo "" > $tempfile
 
1869
  echo "%% ---  DO NOT EDIT THIS LINE AND BELOW: reserved for the configure script" >> $tempfile
 
1870
  echo "" >> $tempfile
 
1871
  for arg in $site_dynamic_libraries; do
 
1872
    dnl Strip the trailing slashes
 
1873
    arg=`echo "${arg}" | sed 's,\([[^/]]\)/*$,\1,'`
 
1874
    echo ":- assert(library_directory('${arg}'))." >> ${tempfile}
 
1875
    echo "              $arg"
 
1876
  done
 
1877
  echo ""
 
1878
 
 
1879
  dnl Append to siteinitrc.P and create it, if necessary
 
1880
  test -f ${site_prefix}/siteinitrc.P || ./touch.sh ${site_prefix}/siteinitrc.P
 
1881
 
 
1882
  dnl delete below the magic line
 
1883
  sed '/%%[[ \t]]*-[[-]]*[[ \t]]*DO NOT EDIT THIS LINE/,$ d' \
 
1884
    ${site_prefix}/siteinitrc.P | \
 
1885
        cat - ${tempfile} > ${tempfile}1
 
1886
 
 
1887
  mv -f ${tempfile}1 ${site_prefix}/siteinitrc.P
 
1888
  rm -f ${tempfile}
 
1889
fi
 
1890
 
 
1891
if test "$with_os" = wind ; then
 
1892
  ./MSVC.sh
 
1893
  mv MSVC.dep ${arch_config_prefix}
 
1894
 
 
1895
  # copy the windows-specific odbc files to the wondows specific directory
 
1896
  cp odbc/* ${arch_config_prefix} 2> /dev/null
 
1897
fi
 
1898
 
 
1899
 
 
1900
# Now set modes, copy some files
 
1901
chmod 555 ${scriptdir}/xsb${config_tag}  ${scriptdir}/chr_pp${config_tag}  makexsb
 
1902
 
 
1903
# These files should really be read-only, but this causes problems when
 
1904
# configuring for Windows over Samba, NFS, etc.
 
1905
chmod 644 ${arch_config_file} \
 
1906
      ${arch_config_prefix}/xsb_config.h \
 
1907
      ${arch_config_prefix}/xsb_debug.h \
 
1908
      ${arch_config_prefix}/*Makefile \
 
1909
      ${arch_config_prefix}/MSVC*
 
1910
 
 
1911
 
 
1912
# phantom private_builtin.c file
 
1913
test -f ${emudir}/private_builtin.c || \
 
1914
   cp ${build_dir}/private_builtin.in ${emudir}/private_builtin.c
 
1915
 
 
1916
dnl Copying to the installation directory ($prefix) is done in the top
 
1917
dnl makefile now!
 
1918
echo ""
 
1919
echo "XSB is configured for installation in ${prefix}"
 
1920
echo "Site libraries are to be found in ${site_prefix}"
 
1921
 
 
1922
 
 
1923
echo "Configuration report is saved in ./Installation_summary"
 
1924
 
 
1925
if test "$have_warnings" = "yes"; then
 
1926
    echo ""
 
1927
    echo "PLEASE SCAN THE ABOVE MESSAGES FOR CONFIGURATION WARNINGS"
 
1928
    echo ""
 
1929
fi
 
1930
 
 
1931
if test "$with_os" = wind ; then
 
1932
   xsb_compile_command=makexsb_wind
 
1933
else
 
1934
   xsb_compile_command=makexsb
 
1935
fi
 
1936
 
 
1937
echo ""
 
1938
if test -z "$config_tag" ; then
 
1939
    echo "***Now compile XSB with:   \`$xsb_compile_command'"
 
1940
else
 
1941
    echo "***Now compile XSB with:   \`$xsb_compile_command --config-tag=${config_tag_sans_dash}'"
 
1942
fi
 
1943
if test "$with_os" = wind ; then
 
1944
   echo "***on a windows box."
 
1945
fi
 
1946
 
 
1947
echo ""
 
1948
 
 
1949
rm -f  buildxsb.lock
 
1950