OSDN Git Service

* configure.ac (gcc_cv_ld_eh_gc_sections): Redirect objdump errors
[pf3gnuchains/gcc-fork.git] / libffi / configure.ac
index 584a7d8..d4644a3 100644 (file)
@@ -1,22 +1,17 @@
 dnl Process this with autoconf to create configure
 
-AC_PREREQ(2.59)
+AC_PREREQ(2.64)
 
-AC_INIT([libffi], [2.1], [http://gcc.gnu.org/bugs.html])
+AC_INIT([libffi], [3.0.9], [http://gcc.gnu.org/bugs.html])
 AC_CONFIG_HEADERS([fficonfig.h])
 
 AM_ENABLE_MULTILIB(, ..)
-if test a = b; then
-   # This is for automake
-   AC_CONFIG_AUX_DIR([..])
-else
-   # and this is for autoconf
-   AC_CONFIG_AUX_DIRS(${multi_basedir})
- fi
 
 AC_CANONICAL_SYSTEM
 target_alias=${target_alias-$host_alias}
 
+. ${srcdir}/configure.host
+
 AM_INIT_AUTOMAKE
 
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
@@ -27,7 +22,7 @@ AM_INIT_AUTOMAKE
 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
 m4_define([_AC_ARG_VAR_PRECIOUS],[])
 AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
 
 AC_SUBST(CFLAGS)
 
@@ -37,6 +32,8 @@ AC_PROG_LIBTOOL
 
 AM_MAINTAINER_MODE
 
+AC_CHECK_HEADERS(sys/mman.h)
+AC_CHECK_FUNCS(mmap)
 AC_FUNC_MMAP_BLACKLIST
 
 dnl The -no-testsuite modules omit the test subdir.
@@ -44,86 +41,194 @@ 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;;
-hppa-*-linux* | parisc-*-linux*) TARGET=PA; TARGETDIR=pa;;
+  alpha*-*-*)
+       TARGET=ALPHA; TARGETDIR=alpha;
+       # Support 128-bit long double, changable via command-line switch.
+       HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
+       ;;
+
+  arm*-*-*)
+       TARGET=ARM; TARGETDIR=arm
+       ;;
+
+  amd64-*-freebsd* | amd64-*-openbsd*)
+       TARGET=X86_64; TARGETDIR=x86
+       ;;
+
+  avr32*-*-*)
+       TARGET=AVR32; TARGETDIR=avr32
+       ;;
+
+  cris-*-*)
+       TARGET=LIBFFI_CRIS; TARGETDIR=cris
+       ;;
+
+  frv-*-*)
+       TARGET=FRV; TARGETDIR=frv
+       ;;
+
+  hppa*-*-linux* | parisc*-*-linux*)
+       TARGET=PA_LINUX; TARGETDIR=pa
+       ;;
+  hppa*64-*-hpux*)
+       TARGET=PA64_HPUX; TARGETDIR=pa
+       ;;
+  hppa*-*-hpux*)
+       TARGET=PA_HPUX; TARGETDIR=pa
+       ;;
+
+  i?86-*-freebsd* | i?86-*-openbsd*)
+       TARGET=X86_FREEBSD; TARGETDIR=x86
+       ;;
+  i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*)
+       TARGET=X86_WIN32; TARGETDIR=x86
+       # All mingw/cygwin/win32 builds require this for sharedlib
+       AM_LTLDFLAGS="-no-undefined"
+       ;;
+  i?86-*-darwin*)
+       TARGET=X86_DARWIN; TARGETDIR=x86
+       ;;
+  i?86-*-solaris2.1[[0-9]]*)
+       TARGET=X86_64; TARGETDIR=x86
+       ;;
+  i?86-*-*)
+       TARGET=X86; TARGETDIR=x86
+       ;;
+
+  ia64*-*-*)
+       TARGET=IA64; TARGETDIR=ia64
+       ;;
+
+  m32r*-*-*)
+       TARGET=M32R; TARGETDIR=m32r
+       ;;
+
+  m68k-*-*)
+       TARGET=M68K; TARGETDIR=m68k
+       ;;
+
+  mips-sgi-irix5.* | mips-sgi-irix6.*)
+       TARGET=MIPS; TARGETDIR=mips
+       ;;
+  mips*-*-linux*)
+       # Support 128-bit long double for NewABI.
+       HAVE_LONG_DOUBLE='defined(__mips64)'
+       TARGET=MIPS; 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* | rs6000-*-aix*)
+       TARGET=POWERPC_AIX; TARGETDIR=powerpc
+       ;;
+  powerpc-*-freebsd*)
+       TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
+       ;;
+  powerpc*-*-rtems*)
+       TARGET=POWERPC; TARGETDIR=powerpc
+       ;;
+
+  s390-*-* | s390x-*-*)
+       TARGET=S390; TARGETDIR=s390
+       ;;
+
+  sh-*-* | sh[[34]]*-*-*)
+       TARGET=SH; TARGETDIR=sh
+       ;;
+  sh64-*-* | sh5*-*-*)
+       TARGET=SH64; TARGETDIR=sh64
+       ;;
+
+  sparc*-*-*)
+       TARGET=SPARC; TARGETDIR=sparc
+       ;;
+
+  x86_64-*-darwin*)
+       TARGET=X86_DARWIN; TARGETDIR=x86
+       ;;
+
+  x86_64-*-cygwin* | x86_64-*-mingw*)
+       TARGET=X86_WIN64; TARGETDIR=x86
+       ;;
+
+  x86_64-*-*)
+       TARGET=X86_64; TARGETDIR=x86
+       ;;
 esac
 
 AC_SUBST(AM_RUNTESTFLAGS)
+AC_SUBST(AM_LTLDFLAGS)
 
 if test $TARGETDIR = unknown; then
   AC_MSG_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(MIPS, test x$TARGET = xMIPS)
 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
 AM_CONDITIONAL(X86, test x$TARGET = xX86)
+AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
 AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
+AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
+AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
+AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
 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(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
+AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
+AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
+AM_CONDITIONAL(FRV, test x$TARGET = xFRV)
 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)
-AM_CONDITIONAL(PA, test x$TARGET = xPA)
-
-case x$TARGET in
-  xMIPS*) TARGET=MIPS ;;
-  *) ;;
-esac
+AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
+AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
+AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
 
 AC_HEADER_STDC
 AC_CHECK_FUNCS(memcpy)
 AC_FUNC_ALLOCA
 
-AC_COMPILE_CHECK_SIZEOF(double)
-AC_COMPILE_CHECK_SIZEOF(long double)
+AC_CHECK_SIZEOF(double)
+AC_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])
+if test -z "$HAVE_LONG_DOUBLE"; then
+  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
 fi
 AC_SUBST(HAVE_LONG_DOUBLE)
 
-AC_C_BIGENDIAN_CROSS
+AC_C_BIGENDIAN
+
+AC_CACHE_CHECK([assembler .cfi pseudo-op support],
+    libffi_cv_as_cfi_pseudo_op, [
+    libffi_cv_as_cfi_pseudo_op=unknown
+    AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
+                  [libffi_cv_as_cfi_pseudo_op=yes],
+                  [libffi_cv_as_cfi_pseudo_op=no])
+])
+if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then
+    AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1,
+             [Define if your assembler supports .cfi_* directives.])
+fi
 
 if test x$TARGET = xSPARC; then
     AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
@@ -156,6 +261,70 @@ if test x$TARGET = xSPARC; then
     fi
 fi
 
+if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
+    AC_CACHE_CHECK([assembler supports pc related relocs],
+       libffi_cv_as_x86_pcrel, [
+       libffi_cv_as_x86_pcrel=yes
+       echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
+       if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
+           libffi_cv_as_x86_pcrel=no
+       fi
+       ])
+    if test "x$libffi_cv_as_x86_pcrel" = xyes; then
+       AC_DEFINE(HAVE_AS_X86_PCREL, 1,
+                 [Define if your assembler supports PC relative relocs.])
+    fi
+
+    AC_CACHE_CHECK([assembler .ascii pseudo-op support],
+       libffi_cv_as_ascii_pseudo_op, [
+       libffi_cv_as_ascii_pseudo_op=unknown
+       # Check if we have .ascii
+       AC_TRY_COMPILE([asm (".ascii \"string\"");],,
+                      [libffi_cv_as_ascii_pseudo_op=yes],
+                      [libffi_cv_as_ascii_pseudo_op=no])
+    ])
+    if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then
+       AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1,
+              [Define if your assembler supports .ascii.])
+    fi
+
+    AC_CACHE_CHECK([assembler .string pseudo-op support],
+       libffi_cv_as_string_pseudo_op, [
+       libffi_cv_as_string_pseudo_op=unknown
+       # Check if we have .string
+       AC_TRY_COMPILE([asm (".string \"string\"");],,
+                      [libffi_cv_as_string_pseudo_op=yes],
+                      [libffi_cv_as_string_pseudo_op=no])
+    ])
+    if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
+       AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
+              [Define if your assembler supports .string.])
+    fi
+fi
+
+case "$target" in
+     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+       AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
+                 [Cannot use malloc on this target, so, we revert to
+                   alternative means])
+     ;;
+esac
+
+if test x$TARGET = xX86_64; then
+    AC_CACHE_CHECK([assembler supports unwind section type],
+       libffi_cv_as_x86_64_unwind_section_type, [
+       libffi_cv_as_x86_64_unwind_section_type=yes
+       echo '.section .eh_frame,"a",@unwind' > conftest.s
+       if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
+           libffi_cv_as_x86_64_unwind_section_type=no
+       fi
+       ])
+    if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
+       AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
+                 [Define if your assembler supports unwind section type.])
+    fi
+fi
+
 AC_CACHE_CHECK([whether .eh_frame section should be read-only],
     libffi_cv_ro_eh_frame, [
        libffi_cv_ro_eh_frame=no
@@ -180,6 +349,38 @@ else
              [Define to the flags needed for the .section .eh_frame directive.])
 fi
 
+AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
+    libffi_cv_hidden_visibility_attribute, [
+       echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
+       libffi_cv_hidden_visibility_attribute=no
+       if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
+           if grep '\.hidden.*foo' conftest.s >/dev/null; then
+               libffi_cv_hidden_visibility_attribute=yes
+           fi
+       fi
+       rm -f conftest.*
+    ])
+if test $libffi_cv_hidden_visibility_attribute = yes; then
+    AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
+             [Define if __attribute__((visibility("hidden"))) is supported.])
+fi
+
+AH_BOTTOM([
+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name) .hidden name
+#else
+#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
+#endif
+#else
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name)
+#else
+#define FFI_HIDDEN
+#endif
+#endif
+])
+
 AC_SUBST(TARGET)
 AC_SUBST(TARGETDIR)
 
@@ -225,17 +426,6 @@ esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
-#Figure out where generated headers like ffitarget.h get installed.
-changequote(,)dnl
-gcc_version_trigger=${srcdir}/../gcc/version.c
-gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
-gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
-tool_include_dir='$(libdir)/gcc/$(target_alias)/'${gcc_version}/include
-changequote([,])dnl
-AC_SUBST(tool_include_dir)
-AC_SUBST(gcc_version)
-
-
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
 else
@@ -250,6 +440,6 @@ test -d src/$TARGETDIR || mkdir src/$TARGETDIR
 
 AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
 
-AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile)
+AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile)
 
 AC_OUTPUT