1999-08-08 15:27:18 +02:00
|
|
|
dnl Process this with autoconf to create configure
|
|
|
|
AC_INIT(fficonfig.h.in)
|
|
|
|
AM_CONFIG_HEADER(fficonfig.h)
|
|
|
|
|
2002-05-08 06:38:00 +02:00
|
|
|
# This works around the fact that libtool configuration may change LD
|
|
|
|
# for this particular configuration, but some shells, instead of
|
|
|
|
# keeping the changes in LD private, export them just because LD is
|
|
|
|
# exported.
|
|
|
|
ORIGINAL_LD_FOR_MULTILIBS=$LD
|
|
|
|
|
2000-03-03 17:58:42 +01:00
|
|
|
dnl Default to --enable-multilib
|
|
|
|
AC_ARG_ENABLE(multilib,
|
|
|
|
[ --enable-multilib build many library versions (default)],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) multilib=yes ;;
|
|
|
|
no) multilib=no ;;
|
|
|
|
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
|
|
|
|
esac], [multilib=yes])dnl
|
|
|
|
|
|
|
|
dnl We may get other options which we don't document:
|
|
|
|
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
|
|
|
|
|
|
|
|
if test "${srcdir}" = "."; then
|
|
|
|
if test "${with_target_subdir}" != "."; then
|
2003-02-01 12:16:19 +01:00
|
|
|
libffi_basedir="${with_multisrctop}../"
|
2000-03-03 17:58:42 +01:00
|
|
|
else
|
2003-01-31 20:35:22 +01:00
|
|
|
libffi_basedir="${with_multisrctop}"
|
2000-03-03 17:58:42 +01:00
|
|
|
fi
|
|
|
|
else
|
2003-01-31 20:35:22 +01:00
|
|
|
libffi_basedir=
|
2000-03-03 17:58:42 +01:00
|
|
|
fi
|
|
|
|
AC_SUBST(libffi_basedir)
|
2003-01-31 20:35:22 +01:00
|
|
|
AC_CONFIG_AUX_DIR(${libffi_basedir}..)
|
2000-03-03 17:58:42 +01:00
|
|
|
|
2003-09-04 16:47:05 +02:00
|
|
|
AC_CANONICAL_SYSTEM
|
|
|
|
target_alias=${target_alias-$host_alias}
|
1999-08-08 15:27:18 +02:00
|
|
|
|
2001-03-27 00:52:36 +02:00
|
|
|
AM_PROG_LIBTOOL
|
|
|
|
|
1999-09-02 01:16:34 +02:00
|
|
|
AM_INIT_AUTOMAKE(libffi,2.00-beta,no-define)
|
1999-08-08 15:27:18 +02:00
|
|
|
|
|
|
|
AC_EXEEXT
|
|
|
|
AM_MAINTAINER_MODE
|
|
|
|
|
|
|
|
AC_PROG_CC
|
2003-09-04 16:47:05 +02:00
|
|
|
|
1999-08-08 15:27:18 +02:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
|
2003-09-04 16:47:05 +02:00
|
|
|
dnl The -no-testsuite modules omit the test subdir.
|
|
|
|
AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
|
|
|
|
|
|
|
|
|
1999-08-08 15:27:18 +02:00
|
|
|
TARGETDIR="unknown"
|
|
|
|
case "$host" in
|
|
|
|
mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; TARGETDIR=mips;;
|
2000-04-17 04:22:22 +02:00
|
|
|
i*86-*-linux*) TARGET=X86; TARGETDIR=x86;;
|
2000-04-04 20:22:01 +02:00
|
|
|
i*86-*-solaris*) TARGET=X86; TARGETDIR=x86;;
|
1999-08-08 15:27:18 +02:00
|
|
|
i*86-*-beos*) TARGET=X86; TARGETDIR=x86;;
|
2000-08-24 03:01:57 +02:00
|
|
|
i*86-*-freebsd*) TARGET=X86; TARGETDIR=x86;;
|
2002-03-31 01:33:17 +01:00
|
|
|
i*86-*-netbsdelf*) TARGET=X86; TARGETDIR=x86;;
|
2001-03-27 04:39:16 +02:00
|
|
|
i*86-*-win32*) TARGET=X86_WIN32; TARGETDIR=x86;;
|
|
|
|
i*86-*-cygwin*) TARGET=X86_WIN32; TARGETDIR=x86;;
|
|
|
|
i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;;
|
1999-08-08 15:27:18 +02:00
|
|
|
sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;;
|
2001-06-25 22:04:56 +02:00
|
|
|
sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;;
|
2002-05-05 07:03:33 +02:00
|
|
|
sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;;
|
|
|
|
sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;;
|
2002-04-07 06:19:31 +02:00
|
|
|
alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;;
|
2000-02-25 20:13:44 +01:00
|
|
|
ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
|
1999-08-08 15:27:18 +02:00
|
|
|
m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
|
2002-07-18 19:55:28 +02:00
|
|
|
mips64*-*);;
|
|
|
|
mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
|
2003-04-18 14:32:36 +02:00
|
|
|
powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
|
1999-08-08 15:27:18 +02:00
|
|
|
powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
|
2001-10-09 07:32:16 +02:00
|
|
|
powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
|
2002-01-17 17:04:21 +01:00
|
|
|
powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
|
|
|
|
rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
|
2000-05-04 16:33:15 +02:00
|
|
|
arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
|
2003-04-16 20:25:33 +02:00
|
|
|
arm*-*-netbsdelf*) TARGET=ARM; TARGETDIR=arm;;
|
2002-04-29 06:14:44 +02:00
|
|
|
s390-*-linux-*) TARGET=S390; TARGETDIR=s390;;
|
2002-09-30 13:59:42 +02:00
|
|
|
s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
|
2002-07-19 01:08:31 +02:00
|
|
|
x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
|
2002-07-19 17:30:58 +02:00
|
|
|
sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
2003-06-13 04:23:26 +02:00
|
|
|
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
|
1999-08-08 15:27:18 +02:00
|
|
|
esac
|
|
|
|
|
2003-09-04 16:47:05 +02:00
|
|
|
AC_SUBST(AM_RUNTESTFLAGS)
|
|
|
|
|
1999-08-08 15:27:18 +02:00
|
|
|
if test $TARGETDIR = unknown; then
|
|
|
|
AC_ERROR("libffi has not been ported to $host.")
|
|
|
|
fi
|
|
|
|
|
|
|
|
AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
|
|
|
|
AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
|
2002-07-18 19:55:28 +02:00
|
|
|
AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
|
1999-08-08 15:27:18 +02:00
|
|
|
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
|
|
|
|
AM_CONDITIONAL(X86, test x$TARGET = xX86)
|
2001-03-27 04:39:16 +02:00
|
|
|
AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
|
1999-08-08 15:27:18 +02:00
|
|
|
AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
|
2000-02-25 20:13:44 +01:00
|
|
|
AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
|
1999-08-08 15:27:18 +02:00
|
|
|
AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
|
|
|
|
AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
|
2002-01-17 17:04:21 +01:00
|
|
|
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
|
2001-10-09 07:32:16 +02:00
|
|
|
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
|
1999-08-08 15:27:18 +02:00
|
|
|
AM_CONDITIONAL(ARM, test x$TARGET = xARM)
|
2002-04-29 06:14:44 +02:00
|
|
|
AM_CONDITIONAL(S390, test x$TARGET = xS390)
|
2002-07-19 01:08:31 +02:00
|
|
|
AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
|
2002-07-19 03:08:43 +02:00
|
|
|
AM_CONDITIONAL(SH, test x$TARGET = xSH)
|
2003-06-13 04:23:26 +02:00
|
|
|
AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
|
1999-08-08 15:27:18 +02:00
|
|
|
|
2002-07-18 19:55:28 +02:00
|
|
|
if test x$TARGET = xMIPS_LINUX; then
|
|
|
|
TARGET=MIPS
|
|
|
|
fi
|
|
|
|
|
1999-08-08 15:27:18 +02:00
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_CHECK_FUNCS(memcpy)
|
|
|
|
AC_FUNC_ALLOCA
|
|
|
|
|
|
|
|
dnl AC_CHECK_SIZEOF(char)
|
2002-01-31 23:25:31 +01:00
|
|
|
AC_COMPILE_CHECK_SIZEOF(short)
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(int)
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(long)
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(long long)
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(float)
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(double)
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(long double)
|
|
|
|
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(void *)
|
|
|
|
AC_C_BIGENDIAN_CROSS
|
1999-08-08 15:27:18 +02:00
|
|
|
|
2002-04-29 07:48:05 +02:00
|
|
|
if test x$TARGET = xSPARC; then
|
2002-04-28 21:57:42 +02:00
|
|
|
AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
|
|
|
|
libffi_cv_as_sparc_ua_pcrel, [
|
|
|
|
save_CFLAGS="$CFLAGS"
|
|
|
|
save_LDFLAGS="$LDFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -fpic"
|
|
|
|
LDFLAGS="$LDFLAGS -shared"
|
|
|
|
AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],,
|
|
|
|
[libffi_cv_as_sparc_ua_pcrel=yes],
|
|
|
|
[libffi_cv_as_sparc_ua_pcrel=no])
|
|
|
|
CFLAGS="$save_CFLAGS"
|
|
|
|
LDFLAGS="$save_LDFLAGS"])
|
|
|
|
if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
|
|
|
|
[Define if your assembler and linker support unaligned PC relative relocs.])
|
|
|
|
fi
|
2003-05-08 22:41:24 +02:00
|
|
|
|
|
|
|
AC_CACHE_CHECK([assembler .register pseudo-op support],
|
|
|
|
libffi_cv_as_register_pseudo_op, [
|
|
|
|
libffi_cv_as_register_pseudo_op=unknown
|
|
|
|
# Check if we have .register
|
|
|
|
AC_TRY_COMPILE([asm (".register %g2, #scratch");],,
|
|
|
|
[libffi_cv_as_register_pseudo_op=yes],
|
|
|
|
[libffi_cv_as_register_pseudo_op=no])
|
|
|
|
])
|
|
|
|
if test "x$libffi_cv_as_register_pseudo_op" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
|
|
|
|
[Define if your assembler supports .register.])
|
|
|
|
fi
|
2002-04-28 21:57:42 +02:00
|
|
|
fi
|
|
|
|
|
2003-05-17 00:09:22 +02:00
|
|
|
AC_CACHE_CHECK([whether .eh_frame section should be read-only],
|
|
|
|
libffi_cv_ro_eh_frame, [
|
|
|
|
libffi_cv_ro_eh_frame=no
|
|
|
|
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
|
|
|
|
if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
|
|
|
|
if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
|
|
|
|
libffi_cv_ro_eh_frame=yes
|
|
|
|
elif grep '.section.*eh_frame.*#alloc' conftest.c \
|
|
|
|
| grep -v '#write' > /dev/null; then
|
|
|
|
libffi_cv_ro_eh_frame=yes
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm -f conftest.*
|
|
|
|
])
|
|
|
|
if test "x$libffi_cv_ro_eh_frame" = xyes; then
|
|
|
|
AC_DEFINE(HAVE_RO_EH_FRAME, 1,
|
|
|
|
[Define if .eh_frame sections should be read-only.])
|
|
|
|
fi
|
|
|
|
|
1999-08-08 15:27:18 +02:00
|
|
|
AC_SUBST(TARGET)
|
|
|
|
AC_SUBST(TARGETDIR)
|
|
|
|
|
|
|
|
AC_SUBST(SHELL)
|
|
|
|
|
2001-06-01 06:09:21 +02:00
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
[ --enable-debug debugging mode],
|
|
|
|
if test "$enable_debug" = "yes"; then
|
|
|
|
AC_DEFINE(FFI_DEBUG)
|
|
|
|
fi)
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(structs,
|
|
|
|
[ --disable-structs omit code for struct support],
|
|
|
|
if test "$enable_structs" = "no"; then
|
|
|
|
AC_DEFINE(FFI_NO_STRUCTS)
|
|
|
|
fi)
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(raw-api,
|
|
|
|
[ --disable-raw-api make the raw api unavailable],
|
|
|
|
if test "$enable_raw_api" = "no"; then
|
|
|
|
AC_DEFINE(FFI_NO_RAW_API)
|
|
|
|
fi)
|
1999-08-08 15:27:18 +02:00
|
|
|
|
|
|
|
AC_ARG_ENABLE(purify-safety,
|
2001-06-01 06:09:21 +02:00
|
|
|
[ --enable-purify-safety purify-safe mode],
|
|
|
|
if test "$enable_purify_safety" = "yes"; then
|
|
|
|
AC_DEFINE(USING_PURIFY)
|
|
|
|
fi)
|
1999-08-10 07:29:27 +02:00
|
|
|
|
2003-01-28 02:48:33 +01:00
|
|
|
if test -n "$with_cross_host" &&
|
|
|
|
test x"$with_cross_host" != x"no"; then
|
|
|
|
toolexecdir='$(exec_prefix)/$(target_alias)'
|
|
|
|
toolexeclibdir='$(toolexecdir)/lib'
|
|
|
|
else
|
|
|
|
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
|
|
|
|
toolexeclibdir='$(libdir)'
|
|
|
|
fi
|
2003-03-12 22:34:31 +01:00
|
|
|
multi_os_directory=`$CC -print-multi-os-directory`
|
|
|
|
case $multi_os_directory in
|
|
|
|
.) ;; # Avoid trailing /.
|
|
|
|
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
|
|
|
|
esac
|
2003-01-28 02:48:33 +01:00
|
|
|
AC_SUBST(toolexecdir)
|
|
|
|
AC_SUBST(toolexeclibdir)
|
1999-08-08 15:27:18 +02:00
|
|
|
|
2000-03-03 17:58:42 +01:00
|
|
|
if test "${multilib}" = "yes"; then
|
|
|
|
multilib_arg="--enable-multilib"
|
|
|
|
else
|
|
|
|
multilib_arg=
|
|
|
|
fi
|
|
|
|
|
2003-09-04 16:47:05 +02:00
|
|
|
AC_OUTPUT(include/Makefile testsuite/Makefile include/ffi.h Makefile,
|
2000-03-03 17:58:42 +01:00
|
|
|
[
|
|
|
|
if test -n "$CONFIG_FILES"; then
|
2002-05-08 06:38:00 +02:00
|
|
|
LD="${ORIGINAL_LD_FOR_MULTILIBS}"
|
2003-02-01 12:16:19 +01:00
|
|
|
ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in
|
2000-03-03 17:58:42 +01:00
|
|
|
fi
|
|
|
|
],
|
|
|
|
srcdir=${srcdir}
|
|
|
|
host=${host}
|
|
|
|
target=${target}
|
|
|
|
with_multisubdir=${with_multisubdir}
|
|
|
|
ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
|
|
|
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
|
|
|
libffi_basedir=${libffi_basedir}
|
|
|
|
CC="${CC}"
|
|
|
|
DEFS="$DEFS"
|
2003-02-20 10:08:45 +01:00
|
|
|
ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
|
1999-08-08 15:27:18 +02:00
|
|
|
test ! -d include && mkdir include
|
|
|
|
test ! -f include/fficonfig.h && cp fficonfig.h include/fficonfig.h
|
|
|
|
if cmp -s fficonfig.h include/fficonfig.h 2>/dev/null; then
|
|
|
|
echo fficonfig.h unchanged
|
|
|
|
else
|
|
|
|
echo Moving fficonfig.h to include/fficonfig.h
|
|
|
|
cp fficonfig.h include/fficonfig.h
|
|
|
|
fi
|
|
|
|
)
|
2001-03-27 00:52:36 +02:00
|
|
|
|
|
|
|
# Make target subdirectories if required.
|
2001-03-29 02:03:27 +02:00
|
|
|
test -d src || mkdir src
|
|
|
|
test -d src/${TARGETDIR} || mkdir src/${TARGETDIR}
|