scsh-0.5/configure.in

394 lines
9.4 KiB
Plaintext
Raw Normal View History

1995-10-13 23:34:21 -04:00
dnl Process this file with autoconf 2.x to produce a configure script.
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl Autoconf does not seems to fit the needs of dynamic linking well -bri
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl We might want AC_CHAR_UNSIGNED in the future.
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl The -cckr (K&R) flag is for the IRIX C compiler. If this is left
dnl out, scheme48vm.c breaks because the rather pedantic SGI compiler
dnl decides that a char is not the same thing as an unsigned char.
dnl - Bryan O'Sullivan 3/94
AC_DEFUN(S48_CFLAG_CKR, [
AC_MSG_CHECKING(${CC} for -cckr)
AC_CACHE_VAL(s48_cv_cflag_ckr,[
if test ${CC} != gcc; then
echo "main(){int i=1;}" > conftest.c
if CFLAGS="-cckr ${CFLAGS}" eval $ac_compile
then
s48_cv_cflag_ckr=yes
else
s48_cv_cflag_ckr=no
fi
else
s48_cv_cflag_ckr=no
fi
rm -f conftest*])
AC_MSG_RESULT($s48_cv_cflag_ckr)
if test $s48_cv_cflag_ckr = yes; then
CFLAGS=$CFLAGS
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_POSIX_LIBC, [
AC_MSG_CHECKING(for RISC/OS POSIX library lossage)
AC_CACHE_VAL(s48_cv_posix_libc,[
if test -f /usr/posix/usr/lib/libc.a; then
s48_cv_posix_libc=yes
else
s48_cv_posix_libc=no
fi])
AC_MSG_RESULT($s48_cv_posix_libc)
if test $s48_cv_posix_libc = yes; then
LIBS="${LIBS} /usr/posix/usr/lib/libc.a"
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_CFLAG_O2, [
AC_MSG_CHECKING(whether we can use -O2)
AC_CACHE_VAL(s48_cv_cflag_o2,[
if test "z$CFLAGS" = "z"; then
if test "z$GCC" = "z"; then
s48_cv_cflag_o2=yes
else
s48_cv_cflag_o2=no
fi
else
s48_cv_cflag_o2=preset
fi])
AC_MSG_RESULT($s48_cv_cflag_o2)
case "$s48_cv_cflag_o2" in
yes )
CFLAGS="-O"
;;
no )
CFLAGS="-O2 -g"
;;
esac
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_USCORE, [
AC_MSG_CHECKING(for underscore before symbols)
AC_CACHE_VAL(s48_cv_uscore,[
echo "main(){int i=1;}
fnord(){int i=23; int ltuae=42;}" > conftest.c
${CC} -o a.out conftest.c > /dev/null
1995-10-13 23:34:21 -04:00
if (nm a.out | grep _fnord) > /dev/null; then
s48_cv_uscore=yes
else
s48_cv_uscore=no
fi])
AC_MSG_RESULT($s48_cv_uscore)
1996-11-17 13:49:56 -05:00
rm -f conftest.c a.out
1995-10-13 23:34:21 -04:00
if test $s48_cv_uscore = yes; then
AC_DEFINE(USCORE)
1996-11-17 13:49:56 -05:00
if test $ac_cv_func_dlopen = yes ; then
AC_MSG_CHECKING(whether dlsym always adds an underscore for us)
AC_CACHE_VAL(s48_cv_dlsym_adds_uscore,AC_TRY_RUN( [
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 && !ptr2) exit(0); } exit(1); }
], [s48_cv_dlsym_adds_uscore=yes
AC_DEFINE(DLSYM_ADDS_USCORE) ], s48_cv_dlsym_adds_uscore=no))
AC_MSG_RESULT($s48_cv_dlsym_adds_uscore)
fi
1995-10-13 23:34:21 -04:00
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_NLIST,[
AC_MSG_CHECKING(for n_name)
AC_CACHE_VAL(s48_cv_nlist,[
AC_TRY_COMPILE([#include <nlist.h>],
[struct nlist name_list;
name_list.n_name = "foo";],
s48_cv_nlist=yes,
s48_cv_nlist=no)])
AC_MSG_RESULT($s48_cv_nlist)
if test $s48_cv_nlist = yes; then
AC_DEFINE(NLIST_HAS_N_NAME)
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48__CNT,[
AC_MSG_CHECKING(for _cnt)
AC_CACHE_VAL(s48_cv__cnt,[
AC_TRY_COMPILE([#include <stdio.h>],
[return stdin->_cnt;],
s48_cv__cnt=yes,
s48_cv__cnt=no)])
AC_MSG_RESULT($s48_cv__cnt)
if test $s48_cv__cnt = yes; then
AC_DEFINE(FILE_HAS__CNT)
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_TZNAME,[
AC_MSG_CHECKING(for tzname)
AC_CACHE_VAL(scsh_cv_tzname,[
AC_TRY_COMPILE([#include <time.h>],
[return (int) tzname;],
scsh_cv_tzname=yes,
scsh_cv_tzname=no)])
AC_MSG_RESULT($scsh_cv_tzname)
if test $scsh_cv_tzname = yes; then
AC_DEFINE(HAVE_TZNAME)
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_GMTOFF,[
AC_MSG_CHECKING(for gmtoff)
AC_CACHE_VAL(scsh_cv_gmtoff,[
AC_TRY_COMPILE([#include <time.h>],
[struct tm time;
return time.tm_gmtoff;],
scsh_cv_gmtoff=yes,
scsh_cv_gmtoff=no)])
AC_MSG_RESULT($scsh_cv_gmtoff)
if test $scsh_cv_gmtoff = yes; then
AC_DEFINE(HAVE_GMTOFF)
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_ELF, [
AC_MSG_CHECKING(for ELF)
AC_CACHE_VAL(scsh_cv_elf,[
1995-10-13 23:34:21 -04:00
touch conftest.c
if ${CC} -v -o a.out conftest.c 2>&1 | grep -q __ELF__ ; then
scsh_cv_elf=yes
1995-10-13 23:34:21 -04:00
else
scsh_cv_elf=no
1995-10-13 23:34:21 -04:00
fi])
AC_MSG_RESULT($scsh_cv_elf)
if test $scsh_cv_elf = yes; then
1995-10-13 23:34:21 -04:00
LDFLAGS=-rdynamic
fi
rm -f conftest.c a.out
])
1995-11-03 23:28:27 -05:00
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_LINUX_STATIC_DEBUG, [
case "$host" in
*-*-linux* )
AC_MSG_CHECKING(for broken Linux that needs -static with -g)
AC_CACHE_VAL(scsh_cv_linux_static_debug,[
AC_TRY_LINK([],
[],
1995-11-04 00:15:07 -05:00
scsh_cv_linux_static_debug=no,
scsh_cv_linux_static_debug=yes)])
1995-11-03 23:28:27 -05:00
AC_MSG_RESULT($scsh_cv_linux_static_debug)
if test $scsh_cv_linux_static_debug = yes; then
LDFLAGS="-static ${LDFLAGS}"
fi
;;
esac
])
1995-10-13 23:34:21 -04:00
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_CONST_SYS_ERRLIST,[
AC_MSG_CHECKING(for const sys_errlist)
AC_CACHE_VAL(scsh_cv_const_sys_errlist,[
AC_TRY_COMPILE([#include <errno.h>
#include <unistd.h>],
[const extern char *sys_errlist[];],
scsh_cv_const_sys_errlist=yes,
scsh_cv_const_sys_errlist=no)])
AC_MSG_RESULT($scsh_cv_const_sys_errlist)
if test $scsh_cv_const_sys_errlist = yes; then
AC_DEFINE(HAVE_CONST_SYS_ERRLIST)
fi
])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_INIT(scheme48vm.c)
AC_CONFIG_HEADER(sysdep.h)
AC_CANONICAL_HOST
AC_PROG_CC
1995-11-03 23:31:50 -05:00
AC_ISC_POSIX
1995-11-03 23:28:27 -05:00
SCSH_LINUX_STATIC_DEBUG
1995-10-13 23:34:21 -04:00
AC_PROG_INSTALL
1995-11-01 20:45:35 -05:00
AC_PROG_RANLIB
1995-10-13 23:34:21 -04:00
AC_C_CONST
AC_CYGWIN
AC_EXEEXT
1995-10-13 23:34:21 -04:00
1995-10-31 16:35:45 -05:00
AC_C_BIGENDIAN
1995-10-31 16:40:55 -05:00
if test $ac_cv_c_bigendian = no ; then
1995-10-31 16:35:45 -05:00
ENDIAN=little
else
ENDIAN=big
fi
1995-10-31 18:16:31 -05:00
AR=${AR-"ar cq"}
TMPDIR=${TMPDIR-"/usr/tmp"}
1995-10-13 23:34:21 -04:00
case "$host" in
## CX/UX
m88k-harris-cxux* )
dir=cxux
CC="cc -Xa"
CFLAGS="-O"
LDFLAGS="-O -Wl,-Bexport"
AC_DEFINE(HAVE_HARRIS)
;;
## DEC Ultrix
mips-dec-ultrix* )
dir=ultrix
if test ${CC} = cc; then
LDFLAGS=-N
fi
;;
## HP 9000 series 700 and 800, running HP/UX
hppa*-hp-hpux* )
dir=hpux
LDFLAGS="-Wl,-E"
1995-10-13 23:34:21 -04:00
if test ${CC} = cc; then
CFLAGS="-Ae -O +Obb1800"
AC_DEFINE(_HPUX_SOURCE)
AC_DEFINE(hpux)
fi
;;
## IBM AIX
rs6000-ibm-aix*|powerpc-ibm-aix* )
dir=aix
LDFLAGS="-O"
if test ${CC} = gcc; then
LDFLAGS_AIX="-Xlinker -bexport:exportlist.aix"
else
LDFLAGS_AIX="-bexport:exportlist.aix"
fi
CFLAGS="-O"
AIX_P="exportlist.aix"
;;
## Linux
*-*-linux* )
dir=linux
1995-11-02 19:38:31 -05:00
# gross, but needed for some older a.out systems for 0.4.x
LIBS=-lc
SCSH_ELF
1995-10-13 23:34:21 -04:00
;;
1995-11-04 15:55:34 -05:00
## NetBSD and FreeBSD ( and maybe 386BSD also)
2001-05-09 10:54:31 -04:00
*-*-*bsd*|*-*-darwin* )
1995-10-13 23:34:21 -04:00
dir=bsd
SCSH_ELF
1995-10-13 23:34:21 -04:00
;;
## NeXT
*-next-* )
dir=next
CC="$CC -posix"
AC_DEFINE(HAVE_SIGACTION)
;;
## SGI IRIX
mips-sgi-irix* )
dir=irix
S48_CFLAG_CKR
INSTALL='$(srcdir)/install-sh'
;;
## SunOS
sparc*-sun-sunos* )
dir=sunos
;;
## Solaris - Sparc and i386
*-*-solaris* )
1995-10-13 23:34:21 -04:00
dir=solaris
AC_DEFINE(HAVE_NLIST)
;;
2001-05-27 19:55:23 -04:00
## NT - cygwin
*-*-cygwin* )
dir=cygwin32
;;
1995-10-13 23:34:21 -04:00
## Generic Configuration
* )
dir=generic
echo "WARNING: "
echo "WARNING: Using generic configuration."
echo "WARNING: See doc/install.txt for more information."
echo "WARNING: "
;;
esac
rm -f $srcdir/scsh/machine
1995-10-13 23:34:21 -04:00
ln -s $srcdir/$dir $srcdir/scsh/machine
AC_CHECK_LIB(m, sqrt)
1995-10-13 23:34:21 -04:00
AC_CHECK_LIB(gen, pathfind)
AC_CHECK_LIB(nsl, gethostbyaddr)
AC_CHECK_LIB(socket, socket)
dnl Solaris 2.3 seems to need -lelf for nlist(). (tnx Bryan O'Sullivan)
AC_CHECK_LIB(elf, nlist)
AC_CHECK_LIB(ld, ldopen)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(dld, shl_findsym)
1995-10-13 23:34:21 -04:00
dnl AC_CHECK_LIB(mld, main)
AC_RETSIGTYPE
AC_HAVE_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h)
AC_HAVE_HEADERS(sys/un.h)
1995-11-01 17:56:22 -05:00
AC_HAVE_FUNCS(strerror)
1995-10-13 23:34:21 -04:00
AC_HAVE_FUNCS(dlopen gettimeofday ftime nlist select setitimer sigaction)
AC_HAVE_FUNCS(socket chroot)
S48_POSIX_LIBC
S48_CFLAG_O2
S48_USCORE
S48_NLIST
S48__CNT
SCSH_TZNAME
SCSH_GMTOFF
SCSH_CONST_SYS_ERRLIST
CFLAGS1=${CFLAGS}
if test "$CYGWIN" = yes; then
SCSHODBCLIBS=-lodbc32
SCSHODBCOBJS="\$(ODBCOBJS)"
fi
1995-10-13 23:34:21 -04:00
AC_SUBST(AIX_P)
1995-10-31 18:16:31 -05:00
AC_SUBST(AR)
AC_SUBST(CC)
1995-10-13 23:34:21 -04:00
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS1)
AC_SUBST(EXEEXT)
1995-10-31 16:35:45 -05:00
AC_SUBST(ENDIAN)
1995-10-13 23:34:21 -04:00
AC_SUBST(LDFLAGS)
AC_SUBST(LDFLAGS_AIX)
1995-11-02 19:03:37 -05:00
AC_SUBST(LIBS)
AC_SUBST(SCSHODBCLIBS)
AC_SUBST(SCSHODBCOBJS)
1995-10-31 18:16:31 -05:00
AC_SUBST(TMPDIR)
1995-10-13 23:34:21 -04:00
1995-10-31 18:16:31 -05:00
AC_OUTPUT(Makefile scsh/regexp/Makefile scsh/endian.scm scsh/static.scm)
chmod +x scsh/static.scm