3
AC_CONFIG_HEADER(h/gclincl.h)
5
VERSION=`cat majvers`.`cat minvers`
8
# some parts of this configure script are taken from the tcl configure.in
14
dnl help="--enable-maxpage=XXXX will compile in a page table of size XXX (default ${default_maxpage})"
16
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
17
dnl #include <stdio.h>
18
dnl #include <unistd.h>
20
dnl FILE *fp=fopen("conftest1","w");
21
dnl fprintf(fp,"%u",262144*( SIZEOF_LONG >>2)/(1<<($PAGEWIDTH-12)));
22
dnl return 0;]])],[def_maxpage=`cat conftest1`],[def_maxpage=262144])
24
dnl AC_ARG_ENABLE(maxpage,
25
dnl [ --enable-maxpage=XXXX will compile in a page table of size XXX
26
dnl (eg '--enable-maxpage=64*1024' would produce
27
dnl 64K pages allowing 256 MB if pages are 4K each)],
28
dnl ,enable_maxpage=$def_maxpage)
30
AC_ARG_ENABLE(widecons,[use a three word cons with simplified typing],[AC_DEFINE([WIDE_CONS],[1],[three word cons])])
33
AC_ARG_ENABLE(safecdr,[protect cdr from immfix and speed up type processing],,[enable_safecdr="no"])
34
if test "$enable_safecdr" = "yes" ; then
35
AC_DEFINE([USE_SAFE_CDR],[1],[protect cdr from immfix and speed up type processing])
37
AC_ARG_ENABLE(safecdrdbg,[debug safecdr code],[AC_DEFINE([DEBUG_SAFE_CDR],[1],[debug safecdr code])])
39
AC_ARG_ENABLE([fastimmfix],[--enable-fastimmfix=XXXX will reject low immediate fixnums unless 1<<XXXX can be attained],
40
,[enable_fastimmfix=64])
43
AC_ARG_ENABLE(holepage,[ --enable-holepage=XXXX will compile in a XXX-sized hole between the heap and relocatable memory area (eg '--enable-holepage=64*1024' would give 64K pages allowing 256 MB if pages are 4K each)] ,
44
[AC_DEFINE_UNQUOTED(HOLEPAGE,$enable_holepage,[number of pages to use for hole])])
46
AC_ARG_ENABLE(vssize,[ --enable-vssize=XXXX will compile in a value stack of size XXX] ,
47
,enable_vssize=262144)
48
AC_DEFINE_UNQUOTED(VSSIZE,$enable_vssize,[value stack size])
50
AC_ARG_ENABLE(bdssize,[ --enable-bdssize=XXXX will compile in a binding stack of size XXX] ,
52
AC_DEFINE_UNQUOTED(BDSSIZE,$enable_bdssize,[binding stack size])
54
AC_ARG_ENABLE(ihssize,[ --enable-ihssize=XXXX will compile in a invocation history stack of size XXX] ,
56
AC_DEFINE_UNQUOTED(IHSSIZE,$enable_ihssize,[invocation history stack size])
58
AC_ARG_ENABLE(frssize,[ --enable-frssize=XXXX will compile in a frame stack of size XXX] ,
60
AC_DEFINE_UNQUOTED(FRSSIZE,$enable_frssize,[frame stack size])
62
AC_ARG_ENABLE(machine,[ --enable-machine=XXXX will force the use of one of the definitions in h/XXXX.defs] ,
63
[enable_machine=$enableval],[enable_machine=""])
66
[ --enable-immfix will enable an immediate fixnum table
70
#AC_ARG_ENABLE(gmp,[ --enable-gmp=no will disable use of GMP gnu multiprecision arithmetic, (default is =yes)] ,
71
#[use_gmp=$enableval],[use_gmp="yes"])
75
AC_ARG_ENABLE(notify,[ --enable-notify=no will disable the automatic notification of gcl maintainers of successful builds/problems] ,
76
[enable_notify=$enableval],[enable_notify="yes"])
78
AC_ARG_ENABLE(tcltk,[ try to build gcl-tk ] ,
79
[enable_tcltk=$enableval],[enable_tcltk="yes"])
81
AC_ARG_ENABLE(tkconfig,[ --enable-tkconfig=XXXX will force the use of a TK_CONFIG_PREFIX=XXXXX as place to look for tkConfig.sh and tclConfig.sh ] ,
82
[TK_CONFIG_PREFIX=$enableval],[TK_CONFIG_PREFIX="unknown"])
85
AC_ARG_ENABLE(tclconfig,[ --enable-tclconfig=XXXX will force the use of a TCL_CONFIG_PREFIX=XXXXX as place to look for tclConfig.sh and tclConfig.sh ] ,
86
[TCL_CONFIG_PREFIX=$enableval],[TCL_CONFIG_PREFIX="unknown"])
88
AC_ARG_ENABLE(infodir,[ --enable-infodir=XXXX will force the use of a INFO_DIR=XXXXX as place to look for info ] ,
89
[INFO_DIR=$enableval],[INFO_DIR=$prefix/share/info])
90
INFO_DIR=`eval echo $INFO_DIR/`
92
AC_ARG_ENABLE(emacsdir,[ --enable-emacsdir=XXXX will manually specify the location for elisp files ] ,
93
[EMACS_SITE_LISP=$enableval],[EMACS_SITE_LISP=$prefix/share/emacs/site-lisp])
94
EMACS_SITE_LISP=`eval echo $EMACS_SITE_LISP/`
96
AC_ARG_ENABLE(common-binary,[ --enable-common-binary=yes forces use of lowest common denominator instruction sets, (default is =yes)] ,
97
[use_common_binary=$enableval],[use_common_binary="yes"])
99
AC_ARG_ENABLE(japi,[ --enable-japi=yes will compile in support for the JAPI graphical interface if present on your system],
100
[try_japi=$enableval],[try_japi="no"])
102
AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR],
103
[enable_xdr=$enableval],[enable_xdr="yes"])
105
AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for XGCL],
106
[enable_xgcl=$enableval],[enable_xgcl="yes"])
115
my_host_kernel=`echo $host_os | awk '{j=split($1,A,"-");print A[[1]]}'`
116
my_host_system=`echo $host_os | awk '{j=split($1,A,"-");if (j>=2) print A[[2]]}'`
117
AC_DEFINE_UNQUOTED(HOST_CPU,"`echo $host_cpu | awk '{print toupper($0)}'`",[Host cpu])
118
AC_DEFINE_UNQUOTED(HOST_KERNEL,"`echo $my_host_kernel | awk '{print toupper($0)}'`",[Host kernel])
119
if test "$my_host_system" != "" ; then
120
AC_DEFINE_UNQUOTED(HOST_SYSTEM,"`echo $my_host_system | awk '{print toupper($0)}'`",[Host system])
122
## host=CPU-COMPANY-SYSTEM
123
AC_MSG_RESULT(host=$host)
125
PROCESSOR_FLAGS=${PROCESSOR_FLAGS:-""}
151
# m6800 not working with gcc-3.2
153
if test "$use_common_binary" = "yes"; then
154
host=m68020-unknown-linux-gnu
155
echo "The host is canonicalised to $host"
191
if test "$build_cpu" = "x86_64" ; then
192
CFLAGS="-m64 $CFLAGS";
193
LDFLAGS="-m64 -Wl,-headerpad,72 $LDFLAGS";
195
CFLAGS="-m32 $CFLAGS";
196
LDFLAGS="-m32 -Wl,-headerpad,56 $LDFLAGS";
298
if test "$use_common_binary" = "yes"; then
300
PROCESSOR_FLAGS="-march=i386 "
301
echo "The host is canonicalised to $host"
306
if $CC -v 2>&1 | fgrep ming > /dev/null ;
312
# 'ld -Z' means disable W^X
313
TLDFLAGS="$TLDFLAGS -Z"
318
AC_SUBST(PROCESSOR_FLAGS)
320
echo enable_machine=$enable_machine
321
if test "x$enable_machine" != "x" ; then
328
#def_statsysbfd="yes"
337
ln -snf linux.defs h/$use.defs;;
339
ln -snf linux.defs h/$use.defs;;
341
ln -snf linux.defs h/$use.defs;
343
# def_static -- Function descriptors are currently realized at runtime in a non-reproducible fashion
344
# on these architectures -- CM
346
if test "$host_cpu" = "powerpc64" ; then def_dlopen="yes" ; def_custreloc="no" ; fi
349
def_dlopen="yes" ; def_custreloc="no" ;;
352
# def_dlopen="yes" ; def_custreloc="no" ; def_pic="yes" ;;
356
AC_ARG_ENABLE(dlopen,
357
[ --enable-dlopen uses dlopen for loading objects, which can then not be retained in saved images ]
358
,,enable_dlopen="$def_dlopen")
359
AC_ARG_ENABLE(statsysbfd,
360
[ --enable-statsysbfd uses a static sytem bfd library for loading and relocationing object files ]
361
,,enable_statsysbfd="$def_statsysbfd")
362
AC_ARG_ENABLE(dynsysbfd,
363
[ --enable-dynsysbfd uses a dynamic shared sytem bfd library for loading and relocationing object files ]
364
,,enable_dynsysbfd="no")
365
#AC_ARG_ENABLE(locbfd,
366
# [ --enable-locbfd uses a static bfd library built from this source tree for loading and relocationing object files ]
367
# ,,enable_locbfd="$def_locbfd")
368
AC_ARG_ENABLE(custreloc,
369
[ --enable-custreloc uses custom gcl code if available for loading and relocationing object files ]
370
,,enable_custreloc="$def_custreloc")
372
[ --enable-debug builds gcl with -g in CFLAGS to enable running under gdb ]
373
,,enable_debug="$def_debug")
375
[ --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof ]
377
AC_ARG_ENABLE(static,[ --enable-static will link your GCL against static as opposed to shared system libraries ] ,
378
[enable_static=$enableval],[enable_static="$def_static"])
380
[ --enable-pic builds gcl with -fPIC in CFLAGS ]
381
,,enable_pic="$def_pic")
383
AC_ARG_ENABLE(oldgmp,
384
[ --enable-oldgmp will link against gmp2 instead of gmp3 ]
385
,,enable_oldgmp="$def_oldgmp")
387
AC_ARG_ENABLE(dynsysgmp,
388
[ --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source ]
389
,,enable_dynsysgmp="yes")
392
if test "$enable_dlopen" = "yes" ; then
395
if test "$enable_statsysbfd" = "yes" ; then
401
if test "$enable_dynsysbfd" = "yes" ; then
408
if test "$enable_locbfd" = "yes" ; then
416
if test "$enable_custreloc" = "yes" ; then
426
if test "$load_opt" != "1" ; then
427
echo "Exactly one loader option must be chosen: dlopen=$enable_dlopen statsysbfd=$enable_statsysbfd dynsysbfd=$enable_dynsysbfd locbfd=$enable_locbfd custreloc=$enable_custreloc"
432
if test "$enable_static" = "yes" ; then
433
TLDFLAGS="-static -Wl,-zmuldefs $TLDFLAGS"; #FIXME should be in unixport/makefile
434
AC_DEFINE(STATIC_LINKING,1,[staticly linked images])
438
## finally warn if we did not find a recognized machine.s
440
#if test "$use" = "unknown" ; then
441
#types=`echo h/*.defs` | sed -e "s:h/::g" -e "s:\.defs:g"`
442
#echo got canonical=$canonical, but was not recognized.
443
#echo Unable to guess type to use. Try one of
447
AC_MSG_RESULT([use=$use])
454
# We set the default CFLAGS below, and don't want the autoconf default
456
if test "$CFLAGS" = "" ; then
459
if test "$LDFLAGS" = "" ; then
468
# can only test for numbers -- CM
469
# if test "${GCC}" -eq "yes" ; then
470
#if [[ "${GCC}" = "yes" ]] ; then
471
# Allog for environment variable overrides on compiler selection -- CM
476
# subst GCC not only under 386-linux, but where available -- CM
478
if test "$GCC" = "yes" ; then
480
TCFLAGS="-Wall -DVOL=volatile -fsigned-char"
482
#FIXME -Wno-unused-but-set-variable when time
483
TMPF=-Wno-unused-but-set-variable
484
AC_MSG_CHECKING([for CFLAG $TMPF])
486
CFLAGS="$CFLAGS $TMPF"
487
AC_TRY_RUN([int main() {return 0;}],TCFLAGS="$TCFLAGS $TMPF";AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
491
TCFLAGS="-DVOL=volatile -fsigned-char"
493
if test "$GCC" = "yes" ; then
494
TCFLAGS="$TCFLAGS -pipe"
497
echo "WARNING: Remove -fno-zero-initialized-in-bss from makedefs if gcc less than 3.3.1."
498
echo " It is ptherwise needed for the Unexec stuff to work."
499
# if test "$enable_debug" = "yes" ; then TCFLAGS="$TCFLAGS -gstabs" ; fi
500
TCFLAGS="$TCFLAGS -fno-zero-initialized-in-bss -mms-bitfields";;
503
#if test -f /proc/sys/kernel/exec-shield ; then
504
# exec_stat=`cat /proc/sys/kernel/exec-shield`
505
# if test "$exec_stat" != "0" ; then
506
# # CFLAGS here to hopefully cover the DBEGIN routine below
507
# CFLAGS="$CFLAGS -Wa,--execstack"
514
#TFPFLAG="-fomit-frame-pointer"
515
# FIXME -- remove when mingw compiler issues are fixed
519
m68k*)#FIXME gcc 4.x bug workaround
522
TFPFLAG="-fomit-frame-pointer";;
525
AC_CHECK_PROGS(AWK,[gawk nawk awk])
527
# Work around system/gprof mips/hppa hang
529
sh4*) enable_gprof="no";;
530
ia64*) enable_gprof="no";;
531
# mips*) enable_gprof="no";;
532
hppa*) enable_gprof="no";;
533
arm*) enable_gprof="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
534
*gnu) enable_gprof="no";;
537
if test "$enable_gprof" = "yes" ; then
538
AC_MSG_CHECKING(for text start)
539
echo 'int main () {return(0);}' >foo.c
541
GCL_GPROF_START=`nm foo | $AWK '/ *[[TD]] *__*start$/ {print $NF}'` # D for ppc64 -- FIXME custreloc
543
if test "$GCL_GPROF_START" != "" ; then
544
AC_MSG_RESULT($GCL_GPROF_START)
545
AC_DEFINE_UNQUOTED(GCL_GPROF_START,$GCL_GPROF_START,[starting address for gprof])
548
#FIXME report and remove this when done
549
AC_MSG_RESULT(Reducing optimization on profiling arm build to workaround gcc bug)
552
TCFLAGS="$TCFLAGS -pg";
555
AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
561
if $CC -v 2>&1 | tail -n 1 | grep -q "gcc version 4.6.1" ; then
564
#FIXME report and remove this when done
565
AC_MSG_RESULT(Reducing optimization on arm build to workaround gcc 4.6 bug)
571
if test "$enable_debug" = "yes" ; then
572
TCFLAGS="$TCFLAGS -g"
573
# for subconfigurations
576
TO3FLAGS="-O3 $TFPFLAG"
580
# gcc on ppc cannot compile our new_init.c with full opts --CM
584
TCFLAGS="$TCFLAGS -mlongcall";;
587
# amd64*) # stack-boundary option does not work
588
# TCFLAGS="$TCFLAGS -m64 -mpreferred-stack-boundary=8";;
590
TCFLAGS="$TCFLAGS -mieee"
591
if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.8.1
594
# TCFLAGS="$TCFLAGS -ffloat-store";;
596
TCFLAGS="$TCFLAGS -mlong-calls "
597
# TCFLAGS="$TCFLAGS -ffunction-sections"
598
# if test "$enable_debug" != "yes" ; then TO3FLAGS="-O $TFPFLAG" ; fi
599
# if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
602
# if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.6.2
605
if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
608
TCFLAGS="$TCFLAGS -mlong-calls -fdollars-in-identifiers -g "
609
# if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.6.2
610
# if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi
613
TCFLAGS="$TCFLAGS -mlongcall"
615
# if $CC -v 2>&1 | grep -q "gcc version 3.2" ; then
616
# echo Reducing optimization for buggy gcc-3.2
617
# if test "$enable_debug" != "yes" ; then TONIFLAGS="-O $TFPFLAG" ; fi
619
# echo Probing for longcall
620
# if ! $CC -v 2>&1 | $AWK '/^gcc version / {split($3,A,".");if (A[[1]]+0>3 || (A[[1]]+0>=3 && A[[2]]+0>=3)) exit 1;}'; then
621
# echo Enabling longcall on gcc 3.3 or later
622
# TCFLAGS="$TCFLAGS -mlongcall"
623
# echo Reducing optimization for buggy gcc 3.3 or later
624
# if test "$enable_debug" != "yes" ; then TONIFLAGS="-O $TFPFLAG" ; fi
628
if test "$enable_pic" = "yes" ; then
629
TCFLAGS="$TCFLAGS -fPIC"
632
FDEBUG=`echo $CFLAGS | tr ' ' '\012' |grep "^\-g$"|tr '\012' ' '`
633
#CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-g$"`
634
FOMITF=`echo $CFLAGS | tr ' ' '\012' |grep "^\-fomit-frame-pointer$"|tr '\012' ' '`
635
CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-fomit-frame-pointer$"|tr '\012' ' '`
636
FOOPT3=`echo $CFLAGS | tr ' ' '\012' |grep "^\-O3$"|tr '\012' ' '`
637
CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-O3$"|tr '\012' ' '`
638
FOOPT2=`echo $CFLAGS | tr ' ' '\012' |grep "^\-O2$"|tr '\012' ' '`
639
CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-O2$"|tr '\012' ' '`
640
FOOPT1=`echo $CFLAGS | tr ' ' '\012' |grep "^\-O1$"|tr '\012' ' '`
641
TMP=`echo $CFLAGS | tr ' ' '\012' |grep "^\-O$"|tr '\012' ' '`
643
CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-O1$"|grep -v "^\-O$"|tr '\012' ' '`
644
FOOPT0=`echo $CFLAGS | tr ' ' '\012' |grep "^\-O0$"|tr '\012' ' '`
645
CFLAGS=`echo $CFLAGS | tr ' ' '\012' |grep -v "^\-O0$"|tr '\012' ' '`
647
if test "$FOOPT0" != "" ; then
648
TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[[123 ]],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
649
TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[[123 ]],-O0 ,g' | sed 's,\-O$,-O0 ,g'`
651
if test "$FOOPT1" != "" ; then
652
TO3FLAGS=`echo $TO3FLAGS | sed 's,\-O[[2-3]],-O1,g'`
653
TO2FLAGS=`echo $TO2FLAGS | sed 's,\-O[[2-3]],-O1,g'`
655
if test "$FOOPT2" != "" ; then
656
TO3FLAGS=`echo "$TO3FLAGS" | sed 's,\-O3,-O2,g'`
657
TO2FLAGS=`echo "$TO2FLAGS" | sed 's,\-O3,-O2,g'`
662
if test "$FDEBUG" != "" ; then
663
TO3FLAGS=`echo $TO3FLAGS | sed 's,\-fomit-frame-pointer,,g'`
664
TO2FLAGS=`echo $TO2FLAGS | sed 's,\-fomit-frame-pointer,,g'`
667
if test "$FOMITF" != "" ; then
668
TO3FLAGS="$TO3FLAGS $FOMITF"
671
# Step 1: set the variable "system" to hold the name and version number
672
# for the system. This can usually be done via the "uname" command, but
673
# there are a few systems, like Next, where this doesn't work.
675
AC_MSG_CHECKING([system version (for dynamic loading)])
676
if machine=`uname -m` ; then true; else machine=unknown ; fi
678
AC_CHECK_PROGS(MAKEINFO,makeinfo,"false")
681
if test -f /usr/lib/NextStep/software_version; then
682
system=NEXTSTEP-`${AWK} '/3/,/3/' /usr/lib/NextStep/software_version`
684
system=`uname -s`-`uname -r`
685
if test "$?" -ne 0 ; then
686
AC_MSG_RESULT([unknown (can't find uname command)])
689
# Special check for weird MP-RAS system (uname returns weird
690
# results, and the version is kept in special file).
692
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
693
system="MP-RAS-`${AWK} '{print $3}' '/etc/.relid'`"
695
if test "`uname -s`" = "AIX" ; then
696
system=AIX-`uname -v`.`uname -r`
698
AC_MSG_RESULT($system)
704
AC_CHECK_HEADERS(malloc/malloc.h,,[AC_MSG_ERROR([need malloc.h on macosx])])
705
AC_CHECK_MEMBER([struct _malloc_zone_t.memalign],
706
AC_DEFINE(HAVE_MALLOC_ZONE_MEMALIGN,1,[memalign element present]), [],
708
#include <malloc/malloc.h>
710
AC_SUBST(HAVE_MALLOC_ZONE_MEMALIGN)
719
AC_CHECK_HEADERS(unistd.h,
720
AC_CHECK_LIB(c,sysconf,
721
AC_MSG_CHECKING(_SC_CLK_TCK)
722
AC_TRY_RUN([#include <unistd.h>
726
FILE *fp=fopen("conftest1","w");
727
fprintf(fp,"%lu\n",sysconf(_SC_CLK_TCK));
732
AC_DEFINE_UNQUOTED(HZ,$hz,[time system constant])
735
AC_MSG_CHECKING(_SC_PHYS_PAGES)
741
FILE *fp=fopen("conftest1","w");
742
fprintf(fp,"%lu\n",sysconf(_SC_PHYS_PAGES));
746
[phys=`cat conftest1`
748
AC_DEFINE(HAVE_SYSCONF_PHYS_PAGES,$phys,[probe runtime phys pages for gc performance])],
749
[AC_MSG_RESULT(no)])))
761
if test $use_gmp = yes ; then
764
if test "$enable_dynsysgmp" = "yes" ; then
765
AC_CHECK_HEADERS(gmp.h,
766
AC_CHECK_LIB(gmp,__gmpz_init,
767
AC_MSG_CHECKING("for external gmp version")
768
AC_TRY_RUN([#include <gmp.h>
770
#if __GNU_MP_VERSION == 4 || __GNU_MP_VERSION == 5
776
# MPFILES=$GMPDIR/mpn/mul_n.o
777
# PATCHED_SYMBOLS=__gmpn_toom3_mul_n
780
# if test "$use" = "m68k-linux" ; then
781
# MPFILES="$MPFILES $GMPDIR/mpn/lshift.o $GMPDIR/mpn/rshift.o"
782
# PATCHED_SYMBOLS="$PATCHED_SYMBOLS __gmpn_lshift __gmpn_rshift"
785
echo "#include \"gmp.h\"" >foo.c
786
echo "int main() {return 0;}" >>foo.c
787
MP_INCLUDE=`cpp foo.c | grep /gmp.h | head -n 1 | $AWK '{print $3}' | tr -d '"'`
789
echo "Cannot use dynamic gmp lib" , echo "Cannot use dynamic gmp lib" ),
790
echo "Cannot use dynamic gmp lib" ,),
791
echo "Cannot use dynamic gmp lib" ,)
795
if test "$MP_INCLUDE" = "" ; then
798
if test "$PATCHED_SYMBOLS" != "" ; then
802
if test "$NEED_LOCAL_GMP" != "" ; then
805
AC_MSG_CHECKING([use_gmp=yes, doing configure in gmp directory])
809
echo "# -------------------"
810
echo "# Subconfigure of GMP"
814
if test "$use_common_binary" = "yes"; then
815
cd $GMPDIR && ./configure --build=$host && cd ..
817
cd $GMPDIR && ./configure && cd ..
819
#MY_SUBDIRS="$MY_SUBDIRS $GMPDIR"
824
echo "# Subconfigure of GMP done"
825
echo "# ------------------------"
828
if test "$MP_INCLUDE" = "" ; then
829
cp $GMPDIR/gmp.h h/gmp.h
836
AC_MSG_CHECKING("for leading underscore in object symbols")
840
int main() {FILE *f;double d=0.0;getc(f);cos(d);return 0;}
842
$CC -c foo.c -o foo.o
843
if nm foo.o |grep " U " | grep "_cos" >/dev/null || nm foo.o |grep " U " | grep " _getc" >/dev/null ; then
845
AC_DEFINE(LEADING_UNDERSCORE,1,[symbol name mangling convention])
848
LEADING_UNDERSCORE=""
853
AC_MSG_CHECKING("for GNU ld option -Map")
855
$CC -o foo [ -Wl,-Map ] map foo.o >/dev/null 2>&1
856
if test `cat map | wc -l` != "0" ; then
858
AC_DEFINE(HAVE_GNU_LD,1,[gnu linker present])
864
rm -f foo.c foo.o foo map
866
AC_MSG_CHECKING([for size of gmp limbs])
867
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
869
#include "$MP_INCLUDE"
871
FILE *fp=fopen("conftest1","w");
872
fprintf(fp,"%u",sizeof(mp_limb_t));
875
]])],[mpsize=`cat conftest1`],[AC_MSG_ERROR([Cannot determine mpsize])])
876
AC_DEFINE_UNQUOTED(MP_LIMB_BYTES,$mpsize,[sizeof mp_limb in gmp library])
877
AC_MSG_RESULT($mpsize)
879
AC_MSG_CHECKING([_SHORT_LIMB])
880
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
882
#include "$MP_INCLUDE"
889
]])],[AC_DEFINE(__SHORT_LIMB,1,[short gmp3 limbs]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
891
AC_MSG_CHECKING([_LONG_LONG_LIMB])
892
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
894
#include "$MP_INCLUDE"
896
#ifdef _LONG_LONG_LIMB
901
]])],[AC_DEFINE(__LONG_LONG_LIMB,1,[long gmp3 limbs]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
904
AC_DEFINE(GMP,1,[using gmp])
908
echo "MPFILES=$MPFILES" >> makedefsafter
909
echo "PATCHED_SYMBOLS=$PATCHED_SYMBOLS" >> makedefsafter
910
echo >> makedefsafter
918
if test "$enable_xgcl" = "yes" ; then
928
# AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)#FIXME remove these
929
# AC_CHECK_LIB(Xt,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)
930
# AC_CHECK_LIB(Xext,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)
931
# AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS",miss=1,$X_LIBS)#until here
932
AC_CHECK_LIB(X11,main,X_LIBS="$X_LIBS -lX11",miss=1,$X_LIBS)
934
if test "$miss" = "1" ; then
939
echo missing x libraries -- cannot compile xgcl
941
AC_DEFINE(HAVE_XGCL,1,[using xgcl])
953
if test "$enable_dlopen" = "yes" ; then
955
AC_CHECK_LIB(dl,dlopen,have_dl=1,have_dl=0)
956
if test "$have_dl" = "0" ; then
957
echo "Cannot find dlopen in -dl"
960
dnl AC_SEARCH_LIBS(dlopen, dl, have_dl=1, AC_ERROR(dlopen not found))
961
dnl LIBS and TLIBS - why not merged from the beginning?
963
TLIBS="$TLIBS -ldl -rdynamic"
964
dnl TLIBS="$TLIBS -rdynamic"
965
AC_DEFINE(USE_DLOPEN,1,[link compiled objects via libdl])
968
if test "$enable_statsysbfd" = "yes" || test "$enable_dynsysbfd" = "yes" ; then
969
AC_CHECK_HEADERS(bfd.h,
970
AC_CHECK_LIB(bfd,bfd_init,
972
# Old binutils appear to need CONST defined to const
974
AC_MSG_CHECKING(if need to define CONST for bfd)
975
AC_TRY_RUN([#define IN_GCC
977
int main() { symbol_info t; return 0;}],
979
AC_TRY_RUN([#define CONST const
982
int main() {symbol_info t; return 0;}],
984
AC_DEFINE(NEED_CONST,1,[binutils requires CONST definition]),
985
AC_MSG_ERROR([cannot use bfd]),
986
AC_MSG_ERROR([cannot use bfd])),
987
AC_MSG_ERROR([cannot use bfd]))
990
AC_DEFINE(HAVE_LIBBFD,1,[use libbfd])
996
AC_MSG_CHECKING(for useable bfd_boolean)
997
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1000
bfd_boolean foo() {return FALSE;}
1003
AC_DEFINE(HAVE_BFD_BOOLEAN,1,[bfd_boolean defined])],
1004
[AC_MSG_RESULT(no)])
1007
# bfd_link_info.output_bfd minimal configure change check
1010
AC_CHECK_MEMBER([struct bfd_link_info.output_bfd],
1011
AC_DEFINE(HAVE_OUTPUT_BFD,1,[output_bfd element present]), [],
1014
#include <bfdlink.h>
1016
AC_SUBST(HAVE_OUTPUT_BFD)
1019
# FIXME: Need to workaround mingw before this point -- CM
1021
if test "$enable_statsysbfd" = "yes" && ! $CC -v 2>&1 | fgrep ming > /dev/null ; then
1022
echo 'int main() {bfd_init();bfd_openr("/dev/null",0);return 0;}' >foo.c
1023
MP=`$CC [ -Wl,-M ] -static -o foo foo.c -lbfd -liberty -ldl 2>&1 | grep -v : | tr '()' '\012\012' | $AWK '{print $NF}' | sort | uniq`
1025
if echo $MP | tr ' ' '\012' | grep -q libbfd.a ; then
1026
LIBBFD="`echo $MP | tr ' ' '\012' | grep libbfd.a | $AWK '{i=split($1,A,"/");for (j=1;j<=i;j++) if (j>1 && A[[j]]=="..") {j--;i-=2;for (k=j;k<=i;k++) A[[k]]=A[[k+2]];j--;}} END {for (j=1;j<=i;j++) printf("%s%s",A[[j]],j!=i ? "/" : "")}'`"
1028
echo Guessing path to libbfd.a due to gcc bug
1029
LIBBFD="/usr/lib/libbfd.a"
1031
if echo $MP | tr ' ' '\012' | grep -q libiberty.a ; then
1032
LIBIBERTY="`echo $MP | tr ' ' '\012' | grep libiberty.a | $AWK '{i=split($1,A,"/");for (j=1;j<=i;j++) if (j>1 && A[[j]]=="..") {j--;i-=2;for (k=j;k<=i;k++) A[[k]]=A[[k+2]];j--;}} END {for (j=1;j<=i;j++) printf("%s%s",A[[j]],j!=i ? "/" : "")}'`"
1034
echo Guessing path to libiberty.a due to gcc bug
1035
LIBIBERTY="/usr/lib/libiberty.a"
1038
AC_CHECK_LIB(z,inflate,
1039
[TLIBS="$TLIBS -lz"],
1040
AC_MSG_ERROR([Need zlib for bfd linking]),[])
1041
AC_CHECK_LIB(dl,dlsym,
1042
[TLIBS="$TLIBS -ldl"],
1043
AC_MSG_ERROR([Need libdl for bfd linking]),[])
1049
TLIBS="$TLIBS -lbfd -liberty -ldl"
1053
if test "$enable_locbfd" = "yes" ; then
1055
# check for gettext. It is part of glibc, but others
1056
# need GNU gettext separately.
1057
# AC_CHECK_HEADERS(libintl.h, true,
1058
# AC_MSG_ERROR(libintl.h (gettext) not found))
1059
# AC_SEARCH_LIBS(dgettext, intl, true, AC_MSG_ERROR(gettext library not found))
1063
echo "# -------------------------"
1064
echo "# Subconfigure of LIBINTL"
1067
cd binutils/intl && chmod +x configure && ./configure --disable-nls && cd ../..
1068
# MY_SUBDIRS="$MY_SUBDIRS binutils/libiberty "
1072
echo "# Subconfigure of LIBINTL done"
1073
echo "# ------------------------------"
1077
echo "# -------------------------"
1078
echo "# Subconfigure of LIBIBERTY"
1081
cd binutils/libiberty && chmod +x configure && ./configure --disable-nls && cd ../..
1082
# MY_SUBDIRS="$MY_SUBDIRS binutils/libiberty "
1086
echo "# Subconfigure of LIBIBERTY done"
1087
echo "# ------------------------------"
1091
echo "# -------------------"
1092
echo "# Subconfigure of BFD"
1095
cd binutils/bfd && chmod +x configure && ./configure --with-included-gettext --disable-nls && cd ../..
1096
# MY_SUBDIRS="$MY_SUBDIRS binutils/bfd "
1100
echo "# Subconfigure of BFD done"
1101
echo "# ------------------------"
1103
# TLIBS="$TLIBS `pwd`/binutils/bfd/libbfd.a `pwd`/binutils/libiberty/libiberty.a"
1104
AC_DEFINE(HAVE_LIBBFD,1,[use libbfd])
1105
BUILD_BFD="h/bfd.h h/bfdlink.h h/ansidecl.h h/symcat.h"
1110
if test "$enable_xdr" = "yes" ; then
1111
AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions]),
1112
AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions]) TLIBS="$TLIBS -ltirpc",
1113
AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions]) TLIBS="$TLIBS -lrpc",
1114
AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions]) TLIBS="$TLIBS -loncrpc"))))
1118
AC_MSG_CHECKING([__builtin_clzl])
1119
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1125
if (__builtin_clzl(0)!=sizeof(long)*8)
1127
for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
1128
if (__builtin_clzl(u)!=j)
1131
}]])],[AC_MSG_RESULT([yes])
1132
AC_DEFINE(HAVE_CLZL,[1],[clzl instruction])],
1133
[AC_MSG_RESULT([no])])
1135
AC_MSG_CHECKING([__builtin_ctzl])
1136
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1142
if (__builtin_ctzl(0)!=sizeof(long)*8)
1144
for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
1145
if (__builtin_ctzl(u)!=j)
1148
}]])],[AC_MSG_RESULT([yes])
1149
AC_DEFINE(HAVE_CTZL,[1],[ctzl instruction])],
1150
[AC_MSG_RESULT([no])])
1154
sh4*) ;; #FIXME, these exceptions needed as of gcc 4.7
1160
AC_MSG_CHECKING(__builtin___clear_cache)
1163
__builtin___clear_cache(v,ve);
1165
[AC_DEFINE(HAVE_BUILTIN_CLEAR_CACHE,1,[have __builtin__clear_cache instruction])
1166
AC_MSG_RESULT(yes)],
1167
AC_MSG_RESULT(no));;
1170
#AC_CONFIG_SUBDIRS($MY_SUBDIRS)
1172
# Find where Data begins. This is used by the storage allocation
1173
# mechanism, in the PAGE macro. This offset is subtracted from
1174
# addresses, in calculating a page for an address in the heap.
1176
AC_CHECK_SIZEOF(long,0)
1178
#### Memory areas and alignment
1180
AC_MSG_CHECKING(for byte order)
1185
/* Are we little or big endian? Adapted from Harbison&Steele. */
1186
union {long l;char c[sizeof(long)];} u;
1188
return u.c[sizeof(long)-1] ? 1 : 0;
1190
AC_MSG_RESULT(little)],
1192
AC_DEFINE(WORDS_BIGENDIAN,1,[big endian byte order])])
1193
AC_SUBST(WORDS_BIGENDIAN)
1196
AC_MSG_CHECKING(for word order)
1200
/* Are we little or big endian? Adapted from Harbison&Steele. */
1201
union {double d;int l[sizeof(double)/sizeof(int)];} u;
1203
return u.l[sizeof(double)/sizeof(int)-1] ? 0 : 1;
1205
[AC_MSG_RESULT(little)],
1207
AC_DEFINE(DOUBLE_BIGENDIAN,1,[big endian word order])])
1208
AC_SUBST(DOUBLE_BIGENDIAN)
1211
AC_MSG_CHECKING(for pagewidth)
1213
mips*) min_pagewidth=14;;
1214
*) min_pagewidth=12;;
1221
size_t i=getpagesize(),j;
1222
FILE *fp=fopen("conftest1","w");
1223
for (j=0;i>>=1;j++);
1224
j=j<$min_pagewidth ? $min_pagewidth : j;
1228
[PAGEWIDTH=`cat conftest1`],
1230
AC_MSG_RESULT($PAGEWIDTH)
1231
AC_DEFINE_UNQUOTED(PAGEWIDTH,$PAGEWIDTH,[system pagewidth])
1234
AC_MSG_CHECKING([for required object alignment])
1235
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1238
#include "$MP_INCLUDE"
1239
#include "./h/enum.h"
1240
#include "./h/bits.h"
1242
#include "./h/object.h"
1245
FILE *fp=fopen("conftest1","w");
1246
for (i=1;i && NOT_OBJECT_ALIGNED(i); i<<=1);
1248
fprintf(fp,"%lu",i);
1252
[obj_align=`cat conftest1`
1253
AC_MSG_RESULT($obj_align)
1254
AC_DEFINE_UNQUOTED(OBJ_ALIGNMENT,$obj_align,[needed object alignment in bytes])],
1255
[AC_MSG_ERROR([Cannot find object alignent])])
1257
AC_MSG_CHECKING([for C extension variable alignment])
1258
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
1259
char *v __attribute__ ((aligned ($obj_align)));
1260
return 0;]])],[obj_align="__attribute__ ((aligned ($obj_align)))"],[obj_align=])
1261
AC_MSG_RESULT($obj_align)
1262
AC_DEFINE_UNQUOTED(OBJ_ALIGN,$obj_align,[can use C extension for object alignment])
1264
AC_MSG_CHECKING(sizeof struct contblock)
1266
# work around MSYS pwd result incompatibility
1267
if test "$use" = "mingw" ; then
1268
AC_TRY_RUN([#include <stdio.h>
1270
#include "$MP_INCLUDE"
1273
#include "h/object.h"
1274
int main(int argc,char **argv,char **envp) {
1275
FILE *f=fopen("conftest1","w");
1276
fprintf(f,"%u",sizeof(struct contblock));
1279
}],sizeof_contblock=`cat conftest1`,
1280
echo Cannot find sizeof struct contblock;exit 1,
1281
echo Cannot find sizeof struct contblock;exit 1)
1283
AC_TRY_RUN([#include <stdio.h>
1285
#include "$MP_INCLUDE"
1286
#include "`pwd`/h/enum.h"
1287
#include "`pwd`/h/bits.h"
1288
#include "`pwd`/h/object.h"
1289
int main(int argc,char **argv,char **envp) {
1290
FILE *f=fopen("conftest1","w");
1291
fprintf(f,"%u",sizeof(struct contblock));
1294
}],sizeof_contblock=`cat conftest1`,
1295
echo Cannot find sizeof struct contblock;exit 1,
1296
echo Cannot find sizeof struct contblock;exit 1)
1298
AC_MSG_RESULT($sizeof_contblock)
1299
AC_DEFINE_UNQUOTED(SIZEOF_CONTBLOCK,$sizeof_contblock,[sizeof linked list for contiguous pages])
1301
AC_MSG_CHECKING([for sbrk])
1303
AC_TRY_RUN([#include <unistd.h>
1307
if (!(f=fopen("conftest1","w")))
1309
fprintf(f,"%u",sbrk(0));
1314
AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]),
1315
AC_MSG_RESULT([no: WARNING you must be able to emulate sbrk: as on mingw or macosx]))
1317
if test "$use" = "386-macosx" ; then
1318
AC_MSG_RESULT(emulating sbrk for mac);
1322
if test "$HAVE_SBRK" = "1" ; then
1324
AC_MSG_CHECKING([for ADDR_NO_RANDOMIZE constant])
1327
#include <sys/personality.h>
1331
if (!(f=fopen("conftest1","w"))) return -1;
1332
fprintf(f,"%x",ADDR_NO_RANDOMIZE);
1335
[ADDR_NO_RANDOMIZE=`cat conftest1`
1336
AC_MSG_RESULT([yes $ADDR_NO_RANDOMIZE])],
1337
[ADDR_NO_RANDOMIZE=0
1338
AC_MSG_RESULT([no assuming 0x40000])
1339
AC_DEFINE_UNQUOTED(ADDR_NO_RANDOMIZE,0x40000,[punt guess for no randomize value])])
1341
AC_MSG_CHECKING([for ADDR_COMPAT_LAYOUT constant])
1344
#include <sys/personality.h>
1348
if (!(f=fopen("conftest1","w"))) return -1;
1349
fprintf(f,"%x",ADDR_COMPAT_LAYOUT);
1352
[ADDR_COMPAT_LAYOUT=`cat conftest1`
1353
AC_MSG_RESULT([yes $ADDR_COMPAT_LAYOUT])],
1354
[ADDR_COMPAT_LAYOUT=0
1355
AC_MSG_RESULT([no])]
1356
AC_DEFINE_UNQUOTED(ADDR_COMPAT_LAYOUT,0,[constant to reserve upper 3Gb for C stack]))
1358
AC_MSG_CHECKING([for ADDR_LIMIT_3GB constant])
1361
#include <sys/personality.h>
1365
if (!(f=fopen("conftest1","w"))) return -1;
1366
fprintf(f,"%x",ADDR_LIMIT_3GB);
1369
[ADDR_LIMIT_3GB=`cat conftest1`
1370
AC_MSG_RESULT([yes $ADDR_LIMIT_3GB])],
1372
AC_MSG_RESULT([no])]
1373
AC_DEFINE_UNQUOTED(ADDR_LIMIT_3GB,0,[only 3Gb of address space]))
1375
AC_MSG_CHECKING([for personality(ADDR_NO_RANDOMIZE) support])
1380
void gprof_cleanup() {};
1381
int main(int argc,char **argv,char **envp) {
1382
#include "h/unrandomize.h"
1385
AC_DEFINE(CAN_UNRANDOMIZE_SBRK,1,[can prevent sbrk from returning random values])],
1386
[AC_MSG_RESULT(no)])
1388
AC_MSG_CHECKING([that sbrk is (now) non-random])
1389
AC_TRY_RUN([#include <stdio.h>
1391
void gprof_cleanup() {};
1392
int main(int argc,char * argv[],char * envp[]) {
1394
#ifdef CAN_UNRANDOMIZE_SBRK
1395
#include "h/unrandomize.h"
1397
if (!(f=fopen("conftest1","w"))) return -1;
1398
fprintf(f,"%u",sbrk(0));
1399
return 0;}],SBRK=`cat conftest1`,SBRK=0,SBRK=0)
1400
if test "$SBRK" = "0" ; then
1401
AC_MSG_RESULT(cannot trap sbrk)
1404
AC_TRY_RUN([#include <stdio.h>
1406
void gprof_cleanup() {};
1407
int main(int argc,char * argv[],char * envp[]) {
1409
#ifdef CAN_UNRANDOMIZE_SBRK
1410
#include "h/unrandomize.h"
1412
if (!(f=fopen("conftest1","w"))) return -1;
1413
fprintf(f,"%u",sbrk(0));
1414
return 0;}],SBRK1=`cat conftest1`,SBRK1=0,SBRK1=0)
1415
if test "$SBRK1" = "0" ; then
1416
AC_MSG_RESULT(cannot trap sbrk)
1419
if test "$SBRK" = "$SBRK1" ; then
1423
echo "Cannot build with randomized sbrk. Your options:"
1424
echo " - upgrade to a kernel/libc that knows about personality(ADDR_NO_RANDOMIZE)"
1425
echo " - recompile your kernel with CONFIG_COMPAT_BRK (if it has that option)"
1426
echo " - run sysctl kernel.randomize_va_space=0 before using gcl"
1431
dnl AC_MSG_CHECKING(DBEGIN)
1432
dnl AC_RUN_IFELSE([AC_LANG_SOURCE([[
1433
dnl #include <stdio.h>
1434
dnl #include <stdlib.h>
1435
dnl #include <unistd.h>
1436
dnl void gprof_cleanup() {};
1438
dnl int main(int argc,char **argv,char **envp) {
1443
dnl #ifdef CAN_UNRANDOMIZE_SBRK
1444
dnl #include "h/unrandomize.h"
1447
dnl fp = fopen("conftest1","w");
1450
dnl fprintf ( fp,"0x%lx", 0x3000000 ); /* Windows custom allocation from this point up */
1452
dnl #if defined (__APPLE__) && defined (__MACH__)
1453
dnl fprintf(fp,"0x0");
1456
dnl fprintf(fp,"0x%lx",((unsigned long) b) & ~(unsigned long)((1<<PAGEWIDTH)-1));
1461
dnl [dbegin=`cat conftest1`],[dbegin=0])
1463
dnl AC_MSG_RESULT($dbegin)
1465
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1466
dnl #include <stdio.h>
1467
dnl #include <unistd.h>
1469
dnl FILE *fp=fopen("conftest1","w");
1470
dnl fprintf(fp,"%u",262144*( SIZEOF_LONG >>2)/(1<<($PAGEWIDTH-12)));
1471
dnl return 0;]])],[def_maxpage=`cat conftest1`],[def_maxpage=262144])
1473
dnl AC_ARG_ENABLE(maxpage,
1474
dnl [ --enable-maxpage=XXXX will compile in a page table of size XXX
1475
dnl (eg '--enable-maxpage=64*1024' would produce
1476
dnl 64K pages allowing 256 MB if pages are 4K each)],
1477
dnl ,enable_maxpage=$def_maxpage)
1480
AC_MSG_CHECKING(CSTACK_ADDRESS)
1481
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1490
void gprof_cleanup() {};
1491
int main(int argc,char **argv,char **envp) {
1493
FILE *fp = fopen("conftest1","w");
1496
#ifdef CAN_UNRANDOMIZE_SBRK
1497
#include "h/unrandomize.h"
1502
i=(unsigned long)&v;
1507
fprintf(fp,"0x%lx",i-1);
1510
}]])],[cstack_address=`cat conftest1`],[cstack_address=0])
1511
AC_DEFINE_UNQUOTED(CSTACK_ADDRESS,$cstack_address,[starting C stack address])
1512
AC_MSG_RESULT($cstack_address)
1514
AC_MSG_CHECKING([cstack bits])
1515
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1524
void gprof_cleanup() {};
1525
int main(int argc,char **argv,char **envp) {
1527
FILE *fp = fopen("conftest1","w");
1530
#ifdef CAN_UNRANDOMIZE_SBRK
1531
#include "h/unrandomize.h"
1536
i=(unsigned long)&v;
1541
for (j=0;(i>>j)!=(i>>(sizeof(long)*8-1));j++);
1545
}]])],[cstack_bits=`cat conftest1`],[cstack_bits=0])
1546
AC_DEFINE_UNQUOTED(CSTACK_BITS,$cstack_bits,[log starting C stack address])
1547
AC_MSG_RESULT($cstack_bits)
1549
AC_MSG_CHECKING(NEG_CSTACK_ADDRESS)
1550
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1553
void gprof_cleanup() {};
1554
int main(int argc,char **argv,char **envp) {
1555
#ifdef CAN_UNRANDOMIZE_SBRK
1556
#include "h/unrandomize.h"
1558
return (long)$cstack_address<0 ? 0 : -1;
1559
}]])],[AC_MSG_RESULT(yes)
1560
neg_cstack_address=1
1561
AC_DEFINE(NEG_CSTACK_ADDRESS,1,[C stack address is negative])],
1563
neg_cstack_address=0])
1566
AC_MSG_CHECKING([finding CSTACK_ALIGNMENT])
1567
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1570
void gprof_cleanup() {};
1571
int main(int argc,char **argv,char **envp) {
1573
FILE *fp = fopen("conftest1","w");
1575
#ifdef CAN_UNRANDOMIZE_SBRK
1576
#include "h/unrandomize.h"
1578
b=alloca(sizeof(b));
1579
c=alloca(sizeof(c));
1581
n=n>sizeof(c) ? n : 1;
1582
fprintf(fp,"%ld",n);
1585
}]])],[cstack_alignment=`cat conftest1`],[cstack_alignment=0])
1586
AC_DEFINE_UNQUOTED(CSTACK_ALIGNMENT,$cstack_alignment,[C stack alignment])
1587
AC_MSG_RESULT($cstack_alignment)
1589
AC_MSG_CHECKING(CSTACK_DIRECTION)
1590
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1599
void gprof_cleanup() {};
1600
int main(int argc,char **argv,char **envp) {
1602
FILE *fp = fopen("conftest1","w");
1603
#ifdef CAN_UNRANDOMIZE_SBRK
1604
#include "h/unrandomize.h"
1606
fprintf(fp,"%d",((long) &b) > ((long) foo()) ? -1 : 1);
1609
}]])],[cstack_direction=`cat conftest1`],[cstack_direction=0])
1610
AC_DEFINE_UNQUOTED(CSTACK_DIRECTION,$cstack_direction,[whether C stack grows up or down])
1611
AC_MSG_RESULT($cstack_direction)
1614
dnl AC_MSG_CHECKING(for shared library/C stack ceiling to heap)
1615
dnl if test "$use" = "mingw" ; then
1616
dnl heap_ceiling=2000000000
1618
dnl if test "$use" = "solaris-i386" ; then
1619
dnl heap_ceiling=0x0
1621
dnl if test "$enable_static" = "yes" ; then
1622
dnl heap_ceiling=0x0
1624
dnl if ! test -x `which ldd` && ! test -f /proc/self/maps ; then
1625
dnl heap_ceiling=0x0
1627
dnl if test -f /proc/self/maps ; then
1628
dnl heap_ceiling=0x`/bin/cat /proc/self/maps | grep "/lib.*/ld-" | cut -f1 -d- | head -1`
1630
dnl if test "`which ldd`" = "" ; then
1631
dnl heap_ceiling=0x0
1633
dnl #echo -e "#include <stdio.h>\n int main() {printf(\"foo\");return 0;}" >foo.c
1634
dnl #$CC foo.c -o foo
1635
dnl AAWK=`which awk`
1636
dnl # | grep -v ld-kfreebsd needed on some strange bsd amd64 boxes
1637
dnl heap_ceiling=`ldd $AAWK | tail -n 1 | $AWK '{print $NF}' | tr -d '()'`
1640
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1641
dnl #include <stdio.h>
1643
dnl FILE *fp=fopen("conftest1","w");
1644
dnl unsigned long h=$heap_ceiling,d=$dbegin,c=$cstack_address;
1646
dnl h=c>d && c<h ? c : h;
1647
dnl fprintf(fp,"0x%lx",h);
1648
dnl return 0;]])],[heap_ceiling=`cat conftest1`],[AC_MSG_ERROR([failed])])
1653
dnl AC_MSG_RESULT($heap_ceiling)
1654
dnl AC_DEFINE_UNQUOTED(SHARED_LIB_HEAP_CEILING,$heap_ceiling,
1655
dnl [address at which shared lib placement terminates heap growth])
1657
dnl ## Don't lower heap start if C stack is below default dbegin, as we're
1658
dnl # likely to get more heap this way.
1659
dnl if test "$enable_static" = "yes" ; then
1660
dnl echo "int main() {return !((unsigned long)$dbegin < (unsigned long)$cstack_address);}" >foo.c
1662
dnl echo "int main() {return !($heap_ceiling && (unsigned long)$dbegin < (unsigned long)$cstack_address);}" >foo.c
1664
dnl $CC foo.c -o foo
1667
if test "$use" != "386-gnu" ; then #hurd can push .data below C stack, but sbrk(0) remains above, foiling unexec
1669
AC_MSG_CHECKING([finding default linker script])
1670
touch unixport/gcl.script
1671
echo "int main() {return 0;}" >foo.c
1672
$CC -Wl,--verbose foo.c -o foo 2>&1 | \
1673
$AWK '/==================================================/ {i=1-i;next} {if (i) print}' >gcl.script
1676
if test "`cat gcl.script | wc -l`" != "0" ; then
1677
AC_MSG_RESULT(got it)
1678
AC_MSG_NOTICE([trying to adjust text start])
1679
cp gcl.script gcl.script.def
1683
lim=`$AWK 'END {printf("%d\n",m*8-2)}' m=$ac_cv_sizeof_long`;
1686
while test $n -lt $lim ; do
1687
j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$n </dev/null`
1688
cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
1689
# diff -u gcl.script.def gcl.script
1690
echo "int main() {return 0;}" >foo.c
1691
if ( $CC -Wl,-T gcl.script foo.c -o foo && ./foo ) >/dev/null 2>&1 ; then
1692
if test $n -lt $min ; then min=$n; fi;
1693
if test $n -gt $max; then max=$n; fi;
1694
elif test $max -gt 0 ; then
1697
n=`$AWK 'END {print n+1}' n=$n </dev/null`
1700
AC_MSG_NOTICE([min log text start $min])
1701
AC_MSG_NOTICE([max log text start $max])
1703
if test $neg_cstack_address -eq 1 ; then #FIXME test this
1704
if test $cstack_bits -lt $max ; then
1706
AC_MSG_NOTICE([max log text start reduced to $max considering c stack address])
1712
if test $min -le $max ; then
1713
if test $max -ge $enable_fastimmfix && test "$enable_immfix" = "yes" ; then
1714
j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$max </dev/null`
1715
low_shft=`$AWK 'END {print n+1}' n=$max </dev/null`;
1716
AC_MSG_NOTICE([raising log text to $j for a $max bit wide low immfix table])
1718
j=`$AWK 'END {for (i=j=0;j<=n;j++) i=i ? i*2 : 1;printf("%x\n",3*i)}' n=$min </dev/null`
1719
AC_MSG_NOTICE([lowering log text to $j to maximize data area])
1723
if test "$low_shft" != "" ; then
1724
AC_DEFINE_UNQUOTED(LOW_SHFT,$low_shft,[upper immediate fixnum bound])
1725
AC_DEFINE_UNQUOTED(OBJNULL,(object)0x$j,[lowest address non-object])
1727
AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
1731
AC_MSG_CHECKING([our linker script])
1732
if test "$j" -ne "-1" ; then
1733
cat gcl.script.def | $AWK '/SIZEOF_HEADERS/ {gsub("0x[[0-9]]*","0x" j,$0);} {print}' j=$j >gcl.script
1734
AC_MSG_RESULT([done])
1735
rm -f gcl.script.def
1736
LDFLAGS="$LDFLAGS -Wl,-T gcl.script "
1737
cp gcl.script unixport
1739
AC_MSG_RESULT([none found or not needed])
1740
rm -f gcl.script gcl.script.def
1744
AC_MSG_RESULT([not found])
1749
AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])
1753
dnl old_LDFLAGS="$LDFLAGS"
1754
dnl LDFLAGS="$LDFLAGS $TLDFLAGS"
1755
dnl AC_MSG_CHECKING([revised DBEGIN])
1756
dnl AC_RUN_IFELSE([AC_LANG_SOURCE([[
1757
dnl #include <stdio.h>
1758
dnl #include <stdlib.h>
1759
dnl #include <unistd.h>
1761
dnl int main(int argc,char **argv,char **envp) {
1766
dnl #ifdef CAN_UNRANDOMIZE_SBRK
1767
dnl #include "h/unrandomize.h"
1769
dnl fp = fopen("conftest1","w");
1772
dnl fprintf ( fp,"0x%lx", 0x1a000000 ); /* Windows custom allocation from this point up */
1774
dnl #if defined (__APPLE__) && defined (__MACH__)
1775
dnl fprintf(fp,"((unsigned long)get_dbegin())");
1778
dnl fprintf(fp,"0x%lx",((unsigned long) b) & ~(unsigned long)0xffffff);
1782
dnl return 0;}]])],[dbegin=`cat conftest1`],[dbegin=0])
1783
dnl AC_MSG_RESULT($dbegin)
1784
dnl LDFLAGS="$old_LDFLAGS"
1786
dnl dnl AC_DEFINE_UNQUOTED(DBEGIN,$dbegin,[down-rounded beginning address of lisp data])
1789
dnl AC_MSG_CHECKING(for maxpage revision)
1790
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1791
dnl #include <stdio.h>
1794
dnl unsigned long i,j;
1795
dnl FILE *fp = fopen("conftest1","w");
1796
dnl j=((unsigned long)$enable_maxpage <<$PAGEWIDTH) + $dbegin;
1797
dnl j=$heap_ceiling && j>$heap_ceiling ? $heap_ceiling : j;
1799
dnl /* for (i=1;i<<1 && i<=j;i<<=1); */
1800
dnl /* if (i>j) i>>=1; */
1802
dnl fprintf(fp,"%ld",i>>$PAGEWIDTH);
1805
dnl ]])],[tmp_maxpage=`cat conftest1`],[tmp_maxpage=0])
1806
dnl if test "$tmp_maxpage" != "$enable_maxpage" ; then
1807
dnl enable_maxpage=$tmp_maxpage
1808
dnl AC_MSG_RESULT($enable_maxpage)
1810
dnl AC_MSG_RESULT($enable_maxpage is OK)
1812
dnl AC_DEFINE_UNQUOTED(MAXPAGE,$enable_maxpage,[maximum number of pages to be allocated])
1814
dnl AC_MSG_CHECKING(for C stack size floor from heap)
1815
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1816
dnl #include <stdio.h>
1819
dnl FILE *fp = fopen("conftest1","w");
1820
dnl unsigned long j,k;
1822
dnl j=$cstack_address + $cstack_direction * $enable_cssize;
1823
dnl k=($dbegin + ((unsigned long)$enable_maxpage << $PAGEWIDTH));
1824
dnl j=abs(j-$cstack_address)!=$enable_cssize || (j<k && $dbegin < $cstack_address) ? k : j;
1825
dnl j-=$cstack_address;
1826
dnl j*=$cstack_direction;
1827
dnl fprintf(fp,"%lu",j);
1830
dnl ]])],[tmp_cssize=`cat conftest1`],[tmp_cssize=0])
1831
dnl if test "$tmp_cssize" != "$enable_cssize" ; then
1832
dnl enable_cssize=$tmp_cssize;
1833
dnl AC_MSG_RESULT($enable_cssize)
1835
dnl AC_MSG_RESULT($enable_cssize is OK)
1838
dnl AC_MSG_CHECKING(for C stack size limit from fixnum table)
1839
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1840
dnl #include <stdio.h>
1843
dnl FILE *fp = fopen("conftest1","w");
1844
dnl unsigned long j,k;
1846
dnl j=$cstack_address + $cstack_direction * $enable_cssize;
1847
dnl if ($cstack_direction>0) {
1848
dnl k=$cstack_address + ((-(unsigned long)$cstack_address)>>1);
1849
dnl j=j<$cstack_address || j > k ? k : j;
1850
dnl j=$cstack_address < $dbegin && j > $dbegin ? $dbegin : j;
1852
dnl j-=$cstack_address;
1853
dnl j*=$cstack_direction;
1854
dnl fprintf(fp,"%lu",j);
1857
dnl ]])],[tmp_cssize=`cat conftest1`],[tmp_cssize=0])
1858
dnl if test "$tmp_cssize" != "$enable_cssize" ; then
1859
dnl enable_cssize=$tmp_cssize;
1860
dnl AC_MSG_RESULT($enable_cssize)
1862
dnl AC_MSG_RESULT($enable_cssize is OK)
1865
dnl AC_MSG_CHECKING(for C stack size limit from address wrap)
1866
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1867
dnl #include <stdio.h>
1870
dnl FILE *fp = fopen("conftest1","w");
1871
dnl unsigned long j,k;
1873
dnl j=-$cstack_address * $cstack_direction;
1874
dnl j=j>$enable_cssize ? $enable_cssize : j;
1875
dnl fprintf(fp,"%lu",j);
1878
dnl ]])],[tmp_cssize=`cat conftest1`],[tmp_cssize=0])
1879
dnl if test "$tmp_cssize" != "$enable_cssize" ; then
1880
dnl enable_cssize=$tmp_cssize;
1881
dnl AC_MSG_RESULT($enable_cssize)
1883
dnl AC_MSG_RESULT($enable_cssize is OK)
1885
dnl AC_DEFINE_UNQUOTED(CSSIZE,$enable_cssize,[maximum C stack size])
1887
dnl AC_MSG_CHECKING(for fast NULL_OR_ON_CSTACK macro)
1888
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1889
dnl #include <stdio.h>
1891
dnl return ((long)$dbegin>=0 &&
1892
dnl ((long)$dbegin+(long)($enable_maxpage<<$PAGEWIDTH)) >=0 &&
1893
dnl ((long)$cstack_address<0)) ? 0 : 1;
1894
dnl ]])],[tmp_fnocm=yes],[tmp_fnocm=no])
1895
dnl if test "$tmp_fnocm" = "yes" ; then
1896
dnl AC_MSG_RESULT(yes)
1897
dnl AC_DEFINE(USE_FAST_NULL_OR_ON_CSTACK_MACRO,1,[whether one instruction heap address check can be used])
1899
dnl AC_MSG_RESULT(no)
1904
AC_MSG_CHECKING(mem top)
1905
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1909
unsigned long i,j,k,l,m;
1910
FILE *fp = fopen("conftest1","w");
1912
for (i=2,k=1;i;k=i,i<<=1);
1914
l=$cstack_direction==1 ? (l<k ? k-1 : -1) : l;
1915
for (i=j=k;j && i<l;j>>=1,i|=j);
1923
fprintf(fp,"0x%lx",i);
1926
]])],[mem_top=`cat conftest1`],[mem_top="0x0"])
1927
AC_MSG_RESULT($mem_top)
1928
if test "$mem_top" != "0x0" ; then
1929
AC_MSG_CHECKING(finding upper mem half range)
1930
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1934
FILE *fp = fopen("conftest1","w");
1936
for (j=1;j && !(j& $mem_top);j<<=1);
1937
fprintf(fp,"0x%lx",j>>1);
1940
]])],[mem_range=`cat conftest1`],[mem_range="0x0"])
1941
AC_MSG_RESULT($mem_range)
1942
if test "$mem_range" != "0x0" ; then
1943
AC_DEFINE_UNQUOTED(MEM_TOP,$mem_top,[beginning address for immediate fixnum range])
1944
AC_DEFINE_UNQUOTED(MEM_RANGE,$mem_range,[size of immediate fixnum address space])
1948
if test "$enable_immfix" = "yes" ; then
1949
if test "$mem_top" != "0x0" ; then
1950
if test "$mem_range" != "0x0" ; then
1951
AC_DEFINE_UNQUOTED(IM_FIX_BASE,$mem_top,[beginning address for immediate fixnum range])
1952
AC_DEFINE_UNQUOTED(IM_FIX_LIM,$mem_range,[size of immediate fixnum address space])
1958
dnl AC_MSG_CHECKING(for word order)
1959
dnl AC_TRY_RUN([int main () {
1960
dnl /* Are we little or big endian? Adapted from Harbison&Steele. */
1964
dnl int l[sizeof(double)/sizeof(int)];
1967
dnl return u.l[sizeof(double)/sizeof(int)-1] ? 0 : 1;
1968
dnl }],AC_MSG_RESULT(little)
1969
dnl AC_DEFINE(LITTLE_END),
1970
dnl AC_MSG_RESULT(big),
1971
dnl AC_MSG_RESULT([WARNING: ASSUMING LITTLE ENDIAN FOR CROSS COMPILING !!!]
1972
dnl AC_DEFINE(LITTLE_END)))
1973
dnl AC_SUBST(LITTLE_END)
1976
# On systems with execshield, brk is randomized. We need to catch
1977
# this and restore the traditional behavior here
1979
dnl old_LDFLAGS="$LDFLAGS"
1980
dnl LDFLAGS="$TLDFLAGS"
1981
dnl AC_MSG_CHECKING("finding DBEGIN")
1982
dnl AC_TRY_RUN([#include <stdio.h>
1983
dnl #include <stdlib.h>
1985
dnl void gprof_cleanup() {};
1987
dnl main(int argc,char * argv[],char *envp[])
1992
dnl #ifdef CAN_UNRANDOMIZE_SBRK
1993
dnl #include "h/unrandomize.h"
1995
dnl b = (void *) malloc(1000);
1996
dnl fp = fopen("conftest1","w");
1999
dnl fprintf(fp,"_dbegin");
2001
dnl #if defined (__APPLE__) && defined (__MACH__)
2002
dnl fprintf(fp,"mach_mapstart");
2004
dnl b1=((unsigned long) b) & ~(unsigned long)0xffffff;b=(void *)b1<(void *)&b1 && (void *)b>(void *)&b ? ((unsigned long) b) & ~(unsigned long)((1<<PAGEWIDTH)-1) : b1;
2005
dnl fprintf(fp,"0x%lx",b);
2010
dnl }],dbegin=`cat conftest1`,dbegin=0,dbegin=0)
2011
dnl AC_DEFINE_UNQUOTED(DBEGIN,$dbegin /* where data begins */)
2012
dnl AC_MSG_RESULT(got $dbegin)
2013
dnl LDFLAGS="$old_LDFLAGS"
2016
dnl AC_MSG_CHECKING("finding CSTACK_ADDRESS")
2017
dnl AC_TRY_RUN([#include <stdio.h>
2021
dnl FILE *fp = fopen("conftest1","w");
2022
dnl fprintf(fp,"%ld",((long) &b));
2025
dnl }],cstack_address=`cat conftest1`,cstack_address=0,cstack_address=0)
2026
dnl AC_DEFINE_UNQUOTED(CSTACK_ADDRESS,$cstack_address \
2028
dnl AC_MSG_RESULT(got $cstack_address)
2032
AC_MSG_CHECKING([sizeof long long int])
2033
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2036
if (sizeof(long long int) == 2*sizeof(long)) return 0;
2038
]])],[AC_DEFINE(HAVE_LONG_LONG,1,[long long is available]) AC_MSG_RESULT(yes)],
2039
[AC_MSG_RESULT(no)])
2041
AC_SUBST(HAVE_LONG_LONG)
2044
AC_ARG_ENABLE(readline,
2045
[--enable-readline enables command line completion via the readline library ],,
2046
enable_readline="yes")
2049
AC_ARG_ENABLE(ansi,[--enable-ansi builds a large gcl aiming for ansi compliance,
2050
--disable-ansi builds the smaller traditional CLtL1 image],,enable_ansi="no")
2052
if test "$enable_ansi" = "yes" ; then
2054
AC_DEFINE(ANSI_COMMON_LISP,1,[compile ansi compliant image])
2061
FLISP="saved_$SYSTEM"
2064
AC_SUBST(CLSTANDARD)
2066
# Maximum number of pages
2070
# Check if Posix compliant getcwd exists, if not we'll use getwd.
2071
AC_CHECK_FUNCS(getcwd)
2072
AC_CHECK_FUNCS(getwd)
2073
AC_CHECK_FUNC(uname, , AC_DEFINE(NO_UNAME,1,[no uname call]))
2074
AC_CHECK_FUNC(gettimeofday, , AC_DEFINE(NO_GETTOD))
2077
AC_CHECK_HEADERS(sys/ioctl.h)
2079
# OpenBSD has elf_abi.h instead of elf.h
2080
AC_CHECK_HEADERS(elf.h elf_abi.h)
2082
AC_CHECK_HEADERS(sys/sockio.h)
2085
#--------------------------------------------------------------------
2086
# The code below deals with several issues related to gettimeofday:
2087
# 1. Some systems don't provide a gettimeofday function at all
2088
# (set NO_GETTOD if this is the case).
2089
# 2. SGI systems don't use the BSD form of the gettimeofday function,
2090
# but they have a BSDgettimeofday function that can be used instead.
2091
# 3. See if gettimeofday is declared in the <sys/time.h> header file.
2092
# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
2094
#--------------------------------------------------------------------
2096
AC_CHECK_FUNC([BSDgettimeofday],
2097
[AC_DEFINE(HAVE_BSDGETTIMEOFDAY,1,[have bsdgettimeofday])],
2098
[AC_CHECK_FUNC([gettimeofday], ,
2099
[AC_DEFINE([NO_GETTOD],1,[no gettimeofday call])])])
2101
AC_MSG_CHECKING([for gettimeofday declaration])
2103
AC_EGREP_HEADER([gettimeofday],
2105
[AC_MSG_RESULT([present])],
2106
[AC_MSG_RESULT([missing])
2107
AC_DEFINE(GETTOD_NOT_DECLARED,1,[No gettimeofday call -- fixme])])
2110
AC_CHECK_LIB(m,sin,LIBS="${LIBS} -lm",true)
2111
AC_CHECK_LIB(mingwex,main,LIBS="${LIBS} -lmingwex",true)
2114
if test "$try_japi" = "yes" ; then
2115
AC_CHECK_HEADERS(japi.h,[AC_DEFINE(HAVE_JAPI_H)
2116
EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o"
2117
LIBS="${LIBS} -ljapi -lwsock32"] )
2119
dnl if test "$use" = "mingw" ; then
2120
dnl if test "$try_xdr" = "yes" ; then
2121
dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
2122
dnl LIBS="${LIBS} -loncrpc"] )
2125
dnl if test "$try_xdr" = "yes" ; then
2126
dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR)
2127
dnl LIBS="${LIBS} -lrpc"] )
2131
# Should really find a way to check for prototypes, but this
2132
# basically works for now. CM
2134
AC_CHECK_HEADERS(math.h,AC_DEFINE(HAVE_MATH_H,1,[have math.h]))
2135
AC_CHECK_HEADERS(complex.h,AC_DEFINE(HAVE_COMPLEX_H,1,[have complex.h]))
2138
# For DBL_MAX et. al. on (only) certain Linux arches, apparently CM
2140
AC_CHECK_HEADERS(values.h,AC_DEFINE(HAVE_VALUES_H,1,[have values.h]))
2143
# Sparc solaris keeps this in float.h, rework either/or with values.h later
2145
AC_CHECK_HEADERS(float.h,AC_DEFINE(HAVE_FLOAT_H,1,[have float.h]))
2148
# The second alternative is for solaris. This needs to be
2149
# a more comprehensive later, i.e. checking that the fpclass
2150
# test makes sense. CM
2152
AC_MSG_CHECKING([for isnormal])
2153
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2158
return isnormal(f) || !isnormal(f) ? 0 : 1;
2160
[AC_DEFINE(HAVE_ISNORMAL,1,[Have isnormal function]) AC_MSG_RESULT(yes)],
2161
[AC_MSG_CHECKING([for fpclass in ieeefp.h])
2162
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2166
return fpclass(f)>=FP_NZERO || fpclass(f)<FP_NZERO ? 0 : 1;
2167
]])],[AC_DEFINE(HAVE_IEEEFP,1,[Have ieeefp fpclass function]) AC_MSG_RESULT(yes)],
2168
[AC_MSG_RESULT(no)])])
2170
AC_MSG_CHECKING([for isfinite])
2171
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2176
return isfinite(f) || !isfinite(f) ? 0 : 1;
2177
]])],[AC_DEFINE(HAVE_ISFINITE,1,[Have isfinite function]) AC_MSG_RESULT(yes)],
2178
[AC_MSG_CHECKING([for finite()])
2179
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2184
return finite(f) || !finite(f) ? 0 : 1;
2185
]])],[AC_DEFINE(HAVE_FINITE,1,[Have finite function]) AC_MSG_RESULT(yes)],
2186
[AC_MSG_ERROR(no)])])
2188
dnl AC_MSG_CHECKING([for INFINITY])
2189
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2190
dnl #define _GNU_SOURCE
2191
dnl #include <math.h>
2193
dnl double d=INFINITY;
2195
dnl ]])],[AC_MSG_RESULT(yes)],
2196
dnl [AC_MSG_CHECKING([for builtin_inf()])
2197
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2198
dnl #include <math.h>
2199
dnl #include <ieeefp.h>
2201
dnl double d=__builtin_inf();
2203
dnl ]])],[AC_DEFINE_UNQUOTED(INFINITY,__builtin_inf(),[Have builtin_inf]) AC_MSG_RESULT(yes)],
2204
dnl [AC_MSG_ERROR(no)])])
2206
dnl AC_MSG_CHECKING([for NAN])
2207
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2208
dnl #define _GNU_SOURCE
2209
dnl #include <math.h>
2213
dnl ]])],[AC_MSG_RESULT(yes)],
2214
dnl [AC_MSG_CHECKING([for builtin_nan()])
2215
dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2216
dnl #include <math.h>
2217
dnl #include <ieeefp.h>
2219
dnl double d=__builtin_nan("0x0");
2221
dnl ]])],[AC_DEFINE_UNQUOTED(NAN,__builtin_nan("0x0"),[Have builtin_nan]) AC_MSG_RESULT(yes)],
2222
dnl [AC_MSG_ERROR(no)])])
2224
#--------------------------------------------------------------------
2225
# Check for the existence of the -lsocket and -lnsl libraries.
2226
# The order here is important, so that they end up in the right
2227
# order in the command line generated by make. Here are some
2228
# special considerations:
2229
# 1. Use "connect" and "accept" to check for -lsocket, and
2230
# "gethostbyname" to check for -lnsl.
2231
# 2. Use each function name only once: can't redo a check because
2232
# autoconf caches the results of the last check and won't redo it.
2233
# 3. Use -lnsl and -lsocket only if they supply procedures that
2234
# aren't already present in the normal libraries. This is because
2235
# IRIX 5.2 has libraries, but they aren't needed and they're
2236
# bogus: they goof up name resolution if used.
2237
# 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2238
# To get around this problem, check for both libraries together
2239
# if -lsocket doesn't work by itself.
2240
#--------------------------------------------------------------------
2241
AC_MSG_CHECKING([for sockets])
2243
AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2244
if test "$tcl_checkSocket" = 1; then
2245
AC_CHECK_LIB(socket, main, TLIBS="$TLIBS -lsocket", tcl_checkBoth=1)
2249
if test "$tcl_checkBoth" = 1; then
2251
TLIBS="$TLIBS -lsocket -lnsl"
2252
AC_CHECK_FUNC(accept, tcl_checkNsl=0, [TLIBS=$tk_oldLibs])
2254
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [TLIBS="$TLIBS -lnsl"]))
2258
if test "$enable_readline" = "yes" ; then
2259
AC_CHECK_HEADERS(readline/readline.h,
2260
AC_CHECK_LIB(readline,rl_initialize,
2261
AC_DEFINE(HAVE_READLINE,1,[have readline library])
2262
TLIBS="$TLIBS -lreadline" #some machines don't link this, e.g. Slackware
2263
RL_OBJS=gcl_readline.o
2264
# Readline support now initialized automatically when compiled in, this lisp
2265
# object no longer needed -- 20040102 CM
2266
# RL_LIB=lsp/gcl_readline.o
2269
# These tests discover differences between readline 4.1 and 4.3
2270
AC_CHECK_LIB(readline,rl_completion_matches,
2271
AC_DEFINE(HAVE_DECL_RL_COMPLETION_MATCHES,1,[have readline completion matches])
2272
AC_DEFINE(HAVE_RL_COMPENTRY_FUNC_T,1,[have readline completion matches]),,)
2278
AC_MSG_CHECKING(For network code for nsocket.c)
2280
#include <sys/time.h>
2281
#include <sys/types.h>
2288
/************* for the sockets ******************/
2289
#include <sys/socket.h> /* struct sockaddr, SOCK_STREAM, ... */
2291
# include <sys/utsname.h> /* uname system call. */
2293
#include <netinet/in.h> /* struct in_addr, struct sockaddr_in */
2294
#include <arpa/inet.h> /* inet_ntoa() */
2295
#include <netdb.h> /* gethostbyname() */
2296
],[ connect(0,(struct sockaddr *)0,0);
2297
gethostbyname("jil");
2298
socket(AF_INET, SOCK_STREAM, 0);
2300
[AC_DEFINE(HAVE_NSOCKET,1,[can use nsocket library])
2301
AC_MSG_RESULT(yes)],
2305
AC_MSG_CHECKING(check for listen using fcntl)
2306
AC_TRY_COMPILE([#include <stdio.h>
2309
[FILE *fp=fopen("configure.in","r");
2311
orig = fcntl(fileno(fp), F_GETFL);
2312
if (! (orig & O_NONBLOCK )) return 0;
2314
[AC_DEFINE(LISTEN_USE_FCNTL,1,[can use fcntl for listen function])
2315
AC_MSG_RESULT(yes)],
2321
AC_CHECK_FUNC(profil, ,[AC_DEFINE(NO_PROFILE,1,[no profil system call])])
2322
AC_SUBST(NO_PROFILE)
2323
AC_CHECK_FUNC(setenv,[AC_DEFINE(HAVE_SETENV,1,[have setenv call])],no_setenv=1 )
2324
AC_SUBST(HAVE_SETENV)
2325
if test "$no_setenv" = "1" ; then
2326
AC_CHECK_FUNC(putenv,[AC_DEFINE(HAVE_PUTENV,1,[have putenv call])],)
2327
AC_SUBST(HAVE_PUTENV)
2330
AC_CHECK_FUNC(_cleanup, [AC_DEFINE(USE_CLEANUP,1,[have _cleanup function])],)
2331
AC_SUBST(USE_CLEANUP)
2334
dnl AC_HEADER_EGREP(LITTLE_ENDIAN, ctype.h, gcl_ok=yes, gcl_ok=noo)
2335
dnl if test $gcl_ok = yes ; then
2336
dnl AC_DEFINE(ENDIAN_ALREADY_DEFINED)
2339
dnl AC_SUBST(ENDIAN_ALREADY_DEFINED)
2344
# if test "x$enable_machine" = "x" ; then
2345
AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2349
AC_DEFINE(USE_FIONBIO,1,[use fionbio for non-blocking io])
2350
AC_MSG_RESULT(FIONBIO)
2353
AC_DEFINE(USE_FIONBIO,1,[use fionbio for non-blocking io])
2354
AC_MSG_RESULT(FIONBIO)
2357
AC_DEFINE(USE_FIONBIO,1,[use fionbio for non-blocking io])
2358
AC_MSG_RESULT(FIONBIO)
2361
AC_MSG_RESULT(O_NONBLOCK)
2366
AC_MSG_CHECKING(check for SV_ONSTACK)
2367
AC_TRY_COMPILE([#include <signal.h>
2371
[AC_DEFINE(HAVE_SV_ONSTACK,1,[have sv_onstack])
2372
AC_SUBST(HAVE_SV_ONSTACK)
2373
AC_MSG_RESULT(yes)],
2376
AC_MSG_CHECKING(check for SIGSYS)
2377
AC_TRY_COMPILE([#include <signal.h>
2381
[AC_DEFINE(HAVE_SIGSYS,1,[have SIGSYS signal])
2382
AC_SUBST(HAVE_SIGSYS)
2383
AC_MSG_RESULT(yes)],
2387
AC_MSG_CHECKING(check for SIGEMT)
2388
AC_TRY_COMPILE([#include <signal.h>
2392
[AC_DEFINE(HAVE_SIGEMT,1,[have SIGEMT signal])
2393
AC_SUBST(HAVE_SIGEMT)
2394
AC_MSG_RESULT(yes)],
2400
#if test $use = "386-linux" ; then
2401
AC_CHECK_HEADERS(asm/sigcontext.h)
2402
AC_CHECK_HEADERS(asm/signal.h)
2403
AC_MSG_CHECKING([for sigcontext...])
2404
AC_TRY_COMPILE([#include <signal.h>
2407
struct sigcontext foo;
2411
AC_DEFINE(SIGNAL_H_HAS_SIGCONTEXT,1,[have sigcontext in signal.h])
2412
AC_MSG_RESULT(sigcontext in signal.h)
2415
[sigcontext_works=0;
2416
AC_MSG_RESULT(sigcontext NOT in signal.h)]
2418
if test "$sigcontext_works" = 0 ; then
2419
AC_MSG_CHECKING([for sigcontext...])
2420
AC_TRY_COMPILE([#include <signal.h>
2421
#ifdef HAVE_ASM_SIGCONTEXT_H
2422
#include <asm/sigcontext.h>
2424
#ifdef HAVE_ASM_SIGNAL_H
2425
#include <asm/signal.h>
2429
struct sigcontext foo;
2432
AC_DEFINE(HAVE_SIGCONTEXT,1,[have sigcontext])
2433
AC_MSG_RESULT(sigcontext in asm files)
2436
AC_MSG_RESULT(no sigcontext found)
2441
# echo 'foo() {}' > conftest1.c
2442
# $CC -S conftest1.c
2444
# if fgrep _foo conftest1.s ; then use_underscore=1 ; fi
2445
# if test $use_underscore = 0 ; then
2446
# MPI_FILE=mpi-386_no_under.o
2448
# MPI_FILE=mpi-386d.o
2450
# AC_SUBST(MPI_FILE)
2452
# if test -x /usr/bin/i386-glibc20-linux-gcc ; then
2453
# GCC=/usr/bin/i386-glibc20-linux-gcc
2459
AC_PATH_PROG(EMACS,emacs)
2462
# check for where the emacs site lisp directory is.
2464
cat >> conftest.el <<EOF
2465
(let ((ans ".") (tem load-path) cur)
2466
(while (setq cur (car tem))
2467
(setq tem (cdr tem))
2468
(cond ((and (string-match "site-lisp/?$" cur) (file-directory-p cur))
2470
(if (string-match "-[0-9.]+$" cur) nil
2475
AC_MSG_CHECKING([emacs site lisp directory])
2476
if [[ "$EMACS_SITE_LISP" = "unknown" ]] ; then
2477
if [[ "$EMACS" != "" ]] ; then
2478
EMACS_SITE_LISP=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | grep -v ^Warning: | sed -e /Loading/d | sed -e /load/d `
2483
AC_MSG_RESULT($EMACS_SITE_LISP)
2484
AC_SUBST(EMACS_SITE_LISP)
2486
# check for where the emacs site lisp default.el is
2488
cat >> conftest.el <<EOF
2489
(let ((ans "./default.el") file (tem load-path))
2491
(cond ((file-exists-p
2492
(setq file (expand-file-name "/default.el" (car tem))))
2493
(setq tem nil) (setq ans file)))
2494
(setq tem (cdr tem)))
2498
AC_MSG_CHECKING([emacs default.el])
2499
if [[ "$EMACS" != "" ]] ; then
2500
EMACS_DEFAULT_EL=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d `
2504
if test -f "${EMACS_DEFAULT_EL}" ; then true;else
2505
if test -d $EMACS_SITE_LISP ; then
2506
EMACS_DEFAULT_EL=${EMACS_SITE_LISP}/default.el
2509
AC_MSG_RESULT($EMACS_DEFAULT_EL)
2510
AC_SUBST(EMACS_DEFAULT_EL)
2514
# check for where the emacs site lisp info/dir is
2516
cat >> conftest.el <<EOF
2517
(let ((ans "") file (tem Info-default-directory-list))
2519
(cond ((file-exists-p (setq file (expand-file-name "dir" (car tem))))
2520
(setq ans (file-name-as-directory (car tem)))
2522
(setq tem (cdr tem)))
2526
AC_MSG_CHECKING([emacs info/dir])
2527
if test "$use" = "mingw" ; then
2528
INFO_DIR=\$\(prefix\)/lib/gcl-$VERSION/info/
2530
if [[ "$EMACS" != "" ]] && [[ "$INFO_DIR" = "unknown" ]] ; then
2531
INFO_DIR=`$EMACS -q -batch --no-site-file -l conftest.el 2>&1 | sed -e /Loading/d | sed -e /load/d `
2535
AC_MSG_RESULT($INFO_DIR)
2538
if test "$enable_tcltk" = "yes" ; then
2540
AC_MSG_CHECKING([for tcl/tk])
2543
if test -d "${TCL_CONFIG_PREFIX}" ; then true ; else
2545
cat >> conftest.tcl <<EOF
2547
set dir [set tcl_library]
2548
if { [file exists [file join [set dir] tclConfig.sh]] } {
2552
set dir [file dirname [set tcl_library]]
2553
if { [file exists [file join [set dir] tclConfig.sh]] } {
2558
#cp conftest.tcl foo.tcl
2560
AC_CHECK_PROG(TCLSH,tclsh,tclsh,${TCLSH})
2561
#AC_CHECK_PROG(TCLSH,tclsh8.0,tclsh8.0,${TCLSH})
2563
if test "${TCLSH}" = "" ; then true ; else
2564
TCL_CONFIG_PREFIX=`${TCLSH} < conftest.tcl`
2567
if test -f ${TCL_CONFIG_PREFIX}/tclConfig.sh ; then . ${TCL_CONFIG_PREFIX}/tclConfig.sh ; fi
2570
if test -d "${TK_CONFIG_PREFIX}" ; then true ; else
2571
if test -f ${TCL_CONFIG_PREFIX}/tkConfig.sh ; then
2572
TK_CONFIG_PREFIX=${TCL_CONFIG_PREFIX}
2575
#cat >> conftest.tcl <<EOF
2577
#set dir [set tk_library]
2578
#if { [file exists [file join [set dir] tkConfig.sh]] } {
2582
#set dir [file dirname [set tk_library]]
2583
#if { [file exists [file join [set dir] tkConfig.sh]] } {
2589
#cp conftest.tcl foo.tcl
2590
#AC_CHECK_PROG(TKSH,wish,wish,${TKSH})
2591
##AC_CHECK_PROG(TKSH,wish8.0,wish8.0,${TKSH})
2592
#if test "${TKSH}" = "" ; then true ; else
2593
#TK_CONFIG_PREFIX=`${TKSH} < conftest.tcl`
2596
if test "${TCLSH}" = "" ; then true ; else
2597
TK_CONFIG_PREFIX=`echo tcl_findLibrary \"tk\" \"${TCL_VERSION}\" \"\" \"tkConfig.sh\" \"TK_LIBRARY\" tk_library | ${TCLSH} 2>&1 | ${AWK} '/"source / {if (i++) next;sub("/[[^/]]*$","",$2);print $2}'`
2602
#AC_MSG_CHECKING(TK_CONFIG_PREFIX=${TK_CONFIG_PREFIX})
2603
if test -f ${TK_CONFIG_PREFIX}/tkConfig.sh ; then . ${TK_CONFIG_PREFIX}/tkConfig.sh ; fi
2605
if test -d ${TK_CONFIG_PREFIX}/tk${TK_VERSION} ; then
2606
TK_LIBRARY=${TK_CONFIG_PREFIX}/tk${TK_VERSION}
2608
if test -d ${TK_CONFIG_PREFIX}/../tk${TK_VERSION} ; then
2609
TK_LIBRARY=${TK_CONFIG_PREFIX}/../tk${TK_VERSION}
2612
if test -d ${TK_CONFIG_PREFIX}/tcl${TCL_VERSION} ; then
2613
TCL_LIBRARY=${TK_CONFIG_PREFIX}/tcl${TCL_VERSION}
2615
if test -d ${TK_CONFIG_PREFIX}/../tcl${TCL_VERSION} ; then
2616
TCL_LIBRARY=${TK_CONFIG_PREFIX}/../tcl${TCL_VERSION}
2619
if test -f ${TK_CONFIG_PREFIX}/../include/tk.h ; then
2620
TK_INCLUDE=-I${TK_CONFIG_PREFIX}/../include
2622
if test -f /usr/include/tcl${TCL_VERSION}/tk.h ; then
2623
TK_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
2626
if test -f ${TCL_CONFIG_PREFIX}/../include/tcl.h ; then
2627
TCL_INCLUDE=-I${TCL_CONFIG_PREFIX}/../include
2629
if test -f /usr/include/tcl${TCL_VERSION}/tcl.h ; then
2630
TCL_INCLUDE=-I/usr/include/tcl${TCL_VERSION}
2636
AC_CHECK_LIB(lieee,main,have_ieee=1,have_ieee=0)
2637
if test "$have_ieee" = "0" ; then
2638
TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-lieee::g" `
2640
if test "$have_dl" = "0" ; then
2641
TCL_LIBS=`echo ${TCL_LIBS} | sed -e "s:-ldl::g"`
2645
AC_SUBST(TK_CONFIG_PREFIX)
2646
AC_SUBST(TK_LIBRARY)
2647
AC_SUBST(TCL_LIBRARY)
2648
AC_SUBST(TK_XINCLUDES)
2649
AC_SUBST(TK_INCLUDE)
2650
AC_SUBST(TCL_INCLUDE)
2651
AC_SUBST(TK_LIB_SPEC)
2652
AC_SUBST(TK_BUILD_LIB_SPEC)
2654
AC_SUBST(TK_XINCLUDES)
2655
AC_SUBST(TCL_LIB_SPEC)
2656
AC_SUBST(TCL_DL_LIBS)
2664
if test -d "${TK_CONFIG_PREFIX}" ; then
2665
AC_MSG_RESULT([using TK_VERSION=${TK_VERSION} in ${TK_CONFIG_PREFIX}])
2667
AC_MSG_RESULT([not found])
2670
NOTIFY=$enable_notify
2676
# for sgbc the mprotect capabilities.
2678
# the time handling for unixtime, add timezone
2685
# idea make it so you do something dlopen(libX.so,RTLD_GLOBAL)
2686
# then dlload("foo.o") a lisp file can refer to things in libX.so
2689
# what machine this is, and include then a machine specific hdr.
2690
# and machine specific defs.
2694
# check getcwd, getwd etc..
2699
# check socket stuff..
2705
# redhat/cygnus released for some reason a buggy version of gcc,
2706
# which no one else released. Catch that here.
2707
dnl AC_MSG_CHECKING([Checking for buggy gcc version from redhat])
2708
dnl if 2>&1 $CC -v | fgrep "gcc version 2.96" > /dev/null
2711
dnl AC_DEFINE(BROKEN_O4_OPT)
2712
dnl AC_SUBST(BROKEN_O4_OPT)
2713
dnl echo ODIR_DEBUG=-O >> makedefsafter
2714
dnl echo >> makedefsafter
2715
dnl AC_MSG_RESULT([yes .. turning off -O4])
2717
dnl AC_MSG_RESULT([no])
2720
LDFLAGS="`echo $LDFLAGS | sed 's,gcl.script,../unixport/gcl.script,g'`"
2722
LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TLDFLAGS $LIBS $TLIBS"
2724
FINAL_CFLAGS="$CFLAGS $X_CFLAGS $TCFLAGS $PROCESSOR_FLAGS"
2725
AC_SUBST(FINAL_CFLAGS)
2726
# Work around bug with gcc on ppc -- CM
2727
NIFLAGS="$CFLAGS $TCFLAGS $TONIFLAGS $PROCESSOR_FLAGS -I\$(GCLDIR)/o"
2729
CFLAGS="$CFLAGS $TCFLAGS $TO3FLAGS $PROCESSOR_FLAGS -I\$(GCLDIR)/o"
2736
AC_SUBST(EXTRA_LOBJS)
2737
AC_SUBST(LEADING_UNDERSCORE)
2739
if test -f h/$use.defs ; then
2742
AC_OUTPUT(makedefc windows/gcl.iss windows/sysdir.bat windows/install.lsp )
2747
CC=$CC ./add-defs1 $use
2750
echo "Unable to guess machine type"
2751
echo use configure --enable-machine=XXX, for XXX such that h/XXX.defs exists, ie in h/*.defs