1450eb7a07
2003-10-21 Andreas Tobler <a.tobler@schweiz.ch> * configure.in: AC_LINK_FILES(ffitarget.h). * configure: Regenerate. * Makefile.in: Likewise. * include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * fficonfig.h.in: Likewise. 2003-10-21 Paolo Bonzini <bonzini@gnu.org> Richard Henderson <rth@redhat.com> Avoid that ffi.h includes fficonfig.h. * Makefile.am (EXTRA_DIST): Include ffitarget.h files (TARGET_SRC_MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX. (TARGET_SRC_MIPS_SGI): Removed. (MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX. (MIPS_SGI): Removed. (CLEANFILES): Removed. (mostlyclean-am, clean-am, mostlyclean-sub, clean-sub): New targets. * acconfig.h: Removed. * configure.in: Compute sizeofs only for double and long double. Use them to define and subst HAVE_LONG_DOUBLE. Include comments into AC_DEFINE instead of using acconfig.h. Create include/ffitarget.h instead of include/fficonfig.h. Rename MIPS_GCC to MIPS_IRIX, drop MIPS_SGI since we are in gcc's tree. AC_DEFINE EH_FRAME_FLAGS. * include/Makefile.am (DISTCLEANFILES): New automake macro. (hack_DATA): Add ffitarget.h. * include/ffi.h.in: Remove all system specific definitions. Declare raw API even if it is not installed, why bother? Use limits.h instead of SIZEOF_* to define ffi_type_*. Do not define EH_FRAME_FLAGS, it is in fficonfig.h now. Include ffitarget.h instead of fficonfig.h. Remove ALIGN macro. (UINT_ARG, INT_ARG): Removed, use ffi_arg and ffi_sarg instead. * include/ffi_common.h (bool): Do not define. (ffi_assert): Accept failed assertion. (ffi_type_test): Return void and accept file/line. (FFI_ASSERT): Pass stringized failed assertion. (FFI_ASSERT_AT): New macro. (FFI_ASSERT_VALID_TYPE): New macro. (UINT8, SINT8, UINT16, SINT16, UINT32, SINT32, UINT64, SINT64): Define here with gcc's __attribute__ macro instead of in ffi.h (FLOAT32, ALIGN): Define here instead of in ffi.h * include/ffi-mips.h: Removed. Its content moved to src/mips/ffitarget.h after separating assembly and C sections. * src/alpha/ffi.c, src/alpha/ffi.c, src/java_raw_api.c src/prep_cif.c, src/raw_api.c, src/ia64/ffi.c, src/mips/ffi.c, src/mips/n32.S, src/mips/o32.S, src/mips/ffitarget.h, src/sparc/ffi.c, src/x86/ffi64.c: SIZEOF_ARG -> FFI_SIZEOF_ARG. * src/ia64/ffi.c: Include stdbool.h (provided by GCC 2.95+). * src/debug.c (ffi_assert): Accept stringized failed assertion. (ffi_type_test): Rewritten. * src/prep-cif.c (initialize_aggregate, ffi_prep_cif): Call FFI_ASSERT_VALID_TYPE. * src/alpha/ffitarget.h, src/arm/ffitarget.h, src/ia64/ffitarget.h, src/m68k/ffitarget.h, src/mips/ffitarget.h, src/powerpc/ffitarget.h, src/s390/ffitarget.h, src/sh/ffitarget.h, src/sh64/ffitarget.h, src/sparc/ffitarget.h, src/x86/ffitarget.h: New files. * src/alpha/osf.S, src/arm/sysv.S, src/ia64/unix.S, src/m68k/sysv.S, src/mips/n32.S, src/mips/o32.S, src/powerpc/aix.S, src/powerpc/darwin.S, src/powerpc/ffi_darwin.c, src/powerpc/linux64.S, src/powerpc/linux64_closure.S, src/powerpc/ppc_closure.S, src/powerpc/sysv.S, src/s390/sysv.S, src/sh/sysv.S, src/sh64/sysv.S, src/sparc/v8.S, src/sparc/v9.S, src/x86/sysv.S, src/x86/unix64.S, src/x86/win32.S: include fficonfig.h From-SVN: r72766
265 lines
8.5 KiB
Plaintext
265 lines
8.5 KiB
Plaintext
dnl Process this with autoconf to create configure
|
|
AC_INIT(fficonfig.h.in)
|
|
AM_CONFIG_HEADER(fficonfig.h)
|
|
|
|
# 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
|
|
|
|
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
|
|
libffi_basedir="${with_multisrctop}../"
|
|
else
|
|
libffi_basedir="${with_multisrctop}"
|
|
fi
|
|
else
|
|
libffi_basedir=
|
|
fi
|
|
AC_SUBST(libffi_basedir)
|
|
AC_CONFIG_AUX_DIR(${libffi_basedir}..)
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
target_alias=${target_alias-$host_alias}
|
|
|
|
AM_PROG_LIBTOOL
|
|
|
|
AM_INIT_AUTOMAKE(libffi,2.00-beta,no-define)
|
|
|
|
AC_EXEEXT
|
|
AM_MAINTAINER_MODE
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
dnl The -no-testsuite modules omit the test subdir.
|
|
AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
|
|
|
|
|
|
TARGETDIR="unknown"
|
|
case "$host" in
|
|
i*86-*-linux*) TARGET=X86; TARGETDIR=x86;;
|
|
i*86-*-solaris*) TARGET=X86; TARGETDIR=x86;;
|
|
i*86-*-beos*) TARGET=X86; TARGETDIR=x86;;
|
|
i*86-*-freebsd*) TARGET=X86; TARGETDIR=x86;;
|
|
i*86-*-netbsdelf*) TARGET=X86; TARGETDIR=x86;;
|
|
i*86-*-win32*) TARGET=X86_WIN32; TARGETDIR=x86;;
|
|
i*86-*-cygwin*) TARGET=X86_WIN32; TARGETDIR=x86;;
|
|
i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;;
|
|
sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;;
|
|
sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;;
|
|
sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;;
|
|
sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;;
|
|
alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;;
|
|
ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
|
|
m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;;
|
|
mips64*-*);;
|
|
mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS_IRIX; TARGETDIR=mips;;
|
|
mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;;
|
|
powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
|
|
powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
|
|
powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
|
|
powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
|
|
rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
|
|
arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;;
|
|
arm*-*-netbsdelf*) TARGET=ARM; TARGETDIR=arm;;
|
|
s390-*-linux-*) TARGET=S390; TARGETDIR=s390;;
|
|
s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;;
|
|
x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;;
|
|
sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;;
|
|
sh64-*-linux* | sh5*-*-linux*) TARGET=SH64; TARGETDIR=sh64;;
|
|
esac
|
|
|
|
AC_SUBST(AM_RUNTESTFLAGS)
|
|
|
|
if test $TARGETDIR = unknown; then
|
|
AC_ERROR("libffi has not been ported to $host.")
|
|
fi
|
|
|
|
AM_CONDITIONAL(MIPS_IRIX, test x$TARGET = xMIPS_IRIX)
|
|
AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
|
|
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
|
|
AM_CONDITIONAL(X86, test x$TARGET = xX86)
|
|
AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
|
|
AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
|
|
AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
|
|
AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
|
|
AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
|
|
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
|
|
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
|
|
AM_CONDITIONAL(ARM, test x$TARGET = xARM)
|
|
AM_CONDITIONAL(S390, test x$TARGET = xS390)
|
|
AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
|
|
AM_CONDITIONAL(SH, test x$TARGET = xSH)
|
|
AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
|
|
|
|
case x$TARGET in
|
|
xMIPS*) TARGET=MIPS ;;
|
|
*) ;;
|
|
esac
|
|
|
|
AC_HEADER_STDC
|
|
AC_CHECK_FUNCS(memcpy)
|
|
AC_FUNC_ALLOCA
|
|
|
|
AC_COMPILE_CHECK_SIZEOF(double)
|
|
AC_COMPILE_CHECK_SIZEOF(long double)
|
|
|
|
# Also AC_SUBST this variable for ffi.h.
|
|
HAVE_LONG_DOUBLE=0
|
|
if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
|
|
if test $ac_cv_sizeof_long_double != 0; then
|
|
HAVE_LONG_DOUBLE=1
|
|
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
|
|
fi
|
|
fi
|
|
AC_SUBST(HAVE_LONG_DOUBLE)
|
|
|
|
AC_C_BIGENDIAN_CROSS
|
|
|
|
if test x$TARGET = xSPARC; then
|
|
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
|
|
|
|
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
|
|
fi
|
|
|
|
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.])
|
|
AC_DEFINE(EH_FRAME_FLAGS, "a",
|
|
[Define to the flags needed for the .section .eh_frame directive.])
|
|
else
|
|
AC_DEFINE(EH_FRAME_FLAGS, "aw",
|
|
[Define to the flags needed for the .section .eh_frame directive.])
|
|
fi
|
|
|
|
AC_SUBST(TARGET)
|
|
AC_SUBST(TARGETDIR)
|
|
|
|
AC_SUBST(SHELL)
|
|
|
|
AC_ARG_ENABLE(debug,
|
|
[ --enable-debug debugging mode],
|
|
if test "$enable_debug" = "yes"; then
|
|
AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
|
|
fi)
|
|
|
|
AC_ARG_ENABLE(structs,
|
|
[ --disable-structs omit code for struct support],
|
|
if test "$enable_structs" = "no"; then
|
|
AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.])
|
|
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, 1, [Define this is you do not want support for the raw API.])
|
|
fi)
|
|
|
|
AC_ARG_ENABLE(purify-safety,
|
|
[ --enable-purify-safety purify-safe mode],
|
|
if test "$enable_purify_safety" = "yes"; then
|
|
AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.])
|
|
fi)
|
|
|
|
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
|
|
multi_os_directory=`$CC -print-multi-os-directory`
|
|
case $multi_os_directory in
|
|
.) ;; # Avoid trailing /.
|
|
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
|
|
esac
|
|
AC_SUBST(toolexecdir)
|
|
AC_SUBST(toolexeclibdir)
|
|
|
|
if test "${multilib}" = "yes"; then
|
|
multilib_arg="--enable-multilib"
|
|
else
|
|
multilib_arg=
|
|
fi
|
|
|
|
AC_OUTPUT(include/Makefile testsuite/Makefile include/ffi.h Makefile,
|
|
[
|
|
if test -n "$CONFIG_FILES"; then
|
|
LD="${ORIGINAL_LD_FOR_MULTILIBS}"
|
|
ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in
|
|
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"
|
|
ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
|
|
|
|
# Make target subdirectories if required.
|
|
test -d src || mkdir src
|
|
test -d src/${TARGETDIR} || mkdir src/${TARGETDIR}
|
|
test -d include || mkdir include
|
|
|
|
AC_LINK_FILES(src/$TARGETDIR/ffitarget.h, include/ffitarget.h)
|
|
)
|