diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-08-30 14:31:19 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-10-20 05:35:52 -0700 |
commit | 5be7b66998127286fada45e4f23bd8a2056d553e (patch) | |
tree | 701ca9676299ab51e64df31f8ddfc67bf5a7514e /libffi/configure.ac | |
parent | 92456a4e5658e138e2cea79e390e3306b07685b0 (diff) | |
download | gcc-5be7b66998127286fada45e4f23bd8a2056d553e.zip gcc-5be7b66998127286fada45e4f23bd8a2056d553e.tar.gz gcc-5be7b66998127286fada45e4f23bd8a2056d553e.tar.bz2 |
libffi: Integrate build with GCC
1. Integrate with GCC build.
2. Disable static trampolines by default.
3. Support multilib.
* Makefile.am (AUTOMAKE_OPTIONS): Add info-in-builddir.
(ACLOCAL_AMFLAGS): Set to -I .. -I ../config.
(SUBDIRS): Don't add doc.
(TEXINFO_TEX): New.
(MAKEINFOFLAGS): Likewise.
(info_TEXINFOS): Likewise.
(STAMP_GENINSRC): Likewise.
(STAMP_BUILD_INFO): Likewise.
(all-local): Likewise.
(stamp-geninsrc): Likewise.
(doc/libffi.info): Likewise.
(stamp-build-info:): Likewise.
(CLEANFILES): Likewise.
(MAINTAINERCLEANFILES): Likewise.
(AM_MAKEFLAGS): Likewise.
(all-recursive): Likewise.
(install-recursive): Likewise.
(mostlyclean-recursive): Likewise.
(clean-recursive): Likewise.
(distclean-recursive): Likewise.
(maintainer-clean-recursive): Likewise.
(LTLDFLAGS): Replace libtool-ldflags with ../libtool-ldflags.
(AM_CFLAGS): Add -g -fexceptions.
(libffi.map-sun): Replace make_sunver.pl with
../contrib/make_sunver.pl.
(dist-hook): Removed.
Include $(top_srcdir)/../multilib.am.
* configure.ac: Add AM_ENABLE_MULTILIB.
Remove the frv*-elf check.
(AX_ENABLE_BUILDDIR): Removed.
(AM_INIT_AUTOMAKE): Add [no-dist].
Add --enable-generated-files-in-srcdir.
(C_CONFIG_MACRO_DIR): Removed.
(AX_COMPILER_VENDOR): Likewise.
(AX_CC_MAXOPT): Likewise.
(AX_CFLAGS_WARN_ALL): Likewise.
Remove the GCC check.
(SYMBOL_UNDERSCORE): Removed.
(AX_CHECK_COMPILE_FLAG): Likewise.
Remove --disable-docs.
(ACX_CHECK_PROG_VER): Check makeinfo.
(BUILD_DOCS): Updated.
(exec-static-tramp): Don't enable use of static exec trampolines
by default.
Remove --disable-multi-os-directory.
(GCC_WITH_TOOLEXECLIBDIR): New.
Support cross host.
Support --enable-multilib.
* include/Makefile.am (nodist_include_HEADERS): Removed.
(gcc_version): New.
(toollibffidir): Likewise.
(toollibffi_HEADERS): Likewise.
* Makefile.in: Regenerate.
(GCC_BASE_VER): New.
(AC_CONFIG_FILES): Remove doc/Makefile.
(AC_CONFIG_LINKS): New.
* aclocal.m4: Likewise.
* configure: Likewise.
* fficonfig.h.in: Likewise.
* mdate-sh: Likewise.
* include/Makefile.in: Likewise.
* man/Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.
Diffstat (limited to 'libffi/configure.ac')
-rw-r--r-- | libffi/configure.ac | 130 |
1 files changed, 63 insertions, 67 deletions
diff --git a/libffi/configure.ac b/libffi/configure.ac index 70f6d2c..bff5a1e 100644 --- a/libffi/configure.ac +++ b/libffi/configure.ac @@ -5,18 +5,30 @@ AC_PREREQ(2.68) AC_INIT([libffi], [3.4.2], [http://github.com/libffi/libffi/issues]) AC_CONFIG_HEADERS([fficonfig.h]) +AM_ENABLE_MULTILIB(, ..) + AC_CANONICAL_SYSTEM target_alias=${target_alias-$host_alias} -case "${host}" in - frv*-elf) - LDFLAGS=`echo $LDFLAGS | sed "s/\-B[^ ]*libgloss\/frv\///"`\ -B`pwd`/../libgloss/frv/ - ;; -esac - -AX_ENABLE_BUILDDIR - -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([no-dist]) + +# We would like our source tree to be readonly. However when releases or +# pre-releases are generated, the flex/bison generated files as well as the +# various formats of manuals need to be included along with the rest of the +# sources. Therefore we have --enable-generated-files-in-srcdir to do +# just that. +AC_MSG_CHECKING(generated-files-in-srcdir) +AC_ARG_ENABLE(generated-files-in-srcdir, +AS_HELP_STRING([--enable-generated-files-in-srcdir], + [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]), +[case "$enableval" in + yes) enable_generated_files_in_srcdir=yes ;; + no) enable_generated_files_in_srcdir=no ;; + *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; + esac], +[enable_generated_files_in_srcdir=no]) +AC_MSG_RESULT($enable_generated_files_in_srcdir) +AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes) # The same as in boehm-gc and libstdc++. Have to borrow it from there. # We must force CC to /not/ be precious variables; otherwise @@ -39,25 +51,12 @@ AC_SUBST(CFLAGS) AM_PROG_AS AM_PROG_CC_C_O AC_PROG_LIBTOOL -AC_CONFIG_MACRO_DIR([m4]) AC_CHECK_TOOL(READELF, readelf) # Test for 64-bit build. AC_CHECK_SIZEOF([size_t]) -AX_COMPILER_VENDOR -AX_CC_MAXOPT -# The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro -# compiler. -if test "$ax_cv_c_compiler_vendor" != "sun"; then - AX_CFLAGS_WARN_ALL -fi - -if test "x$GCC" = "xyes"; then - CFLAGS="$CFLAGS -fexceptions" -fi - cat > local.exp <<EOF set CC_FOR_TARGET "$CC" set CXX_FOR_TARGET "$CXX" @@ -212,11 +211,6 @@ AC_ARG_ENABLE(pax_emutramp, [Define this if you want to enable pax emulated trampolines]) fi) -LT_SYS_SYMBOL_USCORE -if test "x$sys_symbol_underscore" = xyes; then - AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.]) -fi - FFI_EXEC_TRAMPOLINE_TABLE=0 case "$target" in *arm*-apple-* | aarch64-apple-*) @@ -266,13 +260,11 @@ EOF fi if test "x$GCC" = "xyes"; then - AX_CHECK_COMPILE_FLAG(-fno-lto, libffi_cv_no_lto=-fno-lto) - AC_CACHE_CHECK([whether .eh_frame section should be read-only], libffi_cv_ro_eh_frame, [ libffi_cv_ro_eh_frame=yes echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -c -fpic -fexceptions $libffi_cv_no_lto -o conftest.o conftest.c > /dev/null 2>&1; then + if $CC $CFLAGS -c -fpic -fexceptions -fno-lto -o conftest.o conftest.c > /dev/null 2>&1; then if $READELF -WS conftest.o | grep -q -n 'eh_frame .* WA'; then libffi_cv_ro_eh_frame=no fi @@ -306,12 +298,12 @@ if test "x$GCC" = "xyes"; then fi fi -AC_ARG_ENABLE(docs, - AC_HELP_STRING([--disable-docs], - [Disable building of docs (default: no)]), - [enable_docs=no], - [enable_docs=yes]) -AM_CONDITIONAL(BUILD_DOCS, [test x$enable_docs = xyes]) +# See if makeinfo has been installed and is modern enough +# that we can use it. +ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version], + [GNU texinfo.* \([0-9][0-9.]*\)], + [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) +AM_CONDITIONAL(BUILD_DOCS, test $gcc_cv_prog_makeinfo_modern = "yes") AH_BOTTOM([ #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE @@ -367,9 +359,9 @@ AC_ARG_ENABLE(raw-api, fi) AC_ARG_ENABLE(exec-static-tramp, -[ --disable-exec-static-tramp disable use of static exec trampolines (enabled by default)]) +[ --enable-exec-static-tramp enable use of static exec trampolines]) -if test "$enable_exec_static_tramp" != no; then +if test "$enable_exec_static_tramp" = yes; then case "$target" in *-cygwin*) ;; @@ -386,47 +378,51 @@ AC_ARG_ENABLE(purify-safety, AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) fi) -AC_ARG_ENABLE(multi-os-directory, -[ --disable-multi-os-directory - disable use of gcc --print-multi-os-directory to change the library installation directory]) - -# These variables are only ever used when we cross-build to X86_WIN32. -# And we only support this with GCC, so... -if test "x$GCC" = "xyes"; then - 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 - if test x"$enable_multi_os_directory" != x"no"; then - multi_os_directory=`$CC $CFLAGS -print-multi-os-directory` - case $multi_os_directory in - .) ;; # Avoid trailing /. - ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; - esac - fi - AC_SUBST(toolexecdir) +GCC_WITH_TOOLEXECLIBDIR + +if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + case ${with_toolexeclibdir} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_toolexeclibdir} + ;; + esac else - toolexeclibdir='${libdir}' + 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 + # Check linker support. LIBFFI_ENABLE_SYMVERS +# Determine what GCC version number to use in filesystem paths. +GCC_BASE_VER + AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(src, [ test -d src || mkdir src test -d src/$TARGETDIR || mkdir src/$TARGETDIR ], [TARGETDIR="$TARGETDIR"]) -AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile doc/Makefile libffi.pc) +AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) -AC_OUTPUT +AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) -# Copy this file instead of using AC_CONFIG_LINK in order to support -# compiling with MSVC, which won't understand cygwin style symlinks. -cp ${srcdir}/src/$TARGETDIR/ffitarget.h include/ffitarget.h +AC_OUTPUT |