libffi definitive

Bonzini bonzini at gnu.org
Wed Jun 25 14:06:16 UTC 2003


Ok, here it is.  This should be definitive, workarounds for Automake
bugs can be removed later.

Paolo

-------------- next part --------------
Index: gcc/libffi/Makefile.am
===================================================================
RCS file: /cvsroot/gcc/gcc/libffi/Makefile.am,v
retrieving revision 1.27
diff -u -r1.27 Makefile.am
--- gcc/libffi/Makefile.am	13 Jun 2003 02:23:26 -0000	1.27
+++ gcc/libffi/Makefile.am	25 Jun 2003 08:22:55 -0000
@@ -1,6 +1,6 @@
 ## Process this with automake to create Makefile.in
 
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = 1.7 cygnus subdir-objects
 
 SUBDIRS = include
 
@@ -22,8 +22,6 @@
 		src/sh/ffi.c src/sh/sysv.S \
 		src/sh64/ffi.c src/sh64/sysv.S
 
-VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
-
 ## ################################################################
 
 ##
@@ -70,7 +68,7 @@
 
 MAKEOVERRIDES=
 
-# Multilib support variables.
+# Multilib support variables working around Automake bug.
 MULTISRCTOP =
 MULTIBUILDTOP =
 MULTIDIRS =
@@ -80,154 +78,76 @@
 
 toolexeclib_LTLIBRARIES = libffi.la
 noinst_LTLIBRARIES = libffi_convenience.la
-
 noinst_PROGRAMS = ffitest
 
-ffitest_OBJECTS = ffitest.lo
+ffitest_SOURCES = src/ffitest.c
 ffitest_LDADD = libffi.la
 ffitest_LDFLAGS = -shared-libgcc
 
-TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
-TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S
-TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s
-TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S
-TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S
-TARGET_SRC_SPARC = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
-TARGET_SRC_ALPHA = src/alpha/ffi.c src/alpha/osf.S
-TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S
-TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S
-TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
-TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
-TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
-TARGET_SRC_ARM =  src/arm/sysv.S src/arm/ffi.c
-TARGET_SRC_S390 =  src/s390/sysv.S src/s390/ffi.c
-TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
-TARGET_SRC_SH =  src/sh/sysv.S src/sh/ffi.c
-TARGET_SRC_SH64 =  src/sh64/sysv.S src/sh64/ffi.c
-
-##libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c $(TARGET_SRC_ at TARGET@)
-## Work around automake deficiency
-libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \
+libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
 		src/raw_api.c src/java_raw_api.c
+
+
+nodist_libffi_la_SOURCES =
+
 if MIPS_GCC
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC)
+nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S
 endif
 if MIPS_LINUX
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX)
-endif
-if MIPS_SGI
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI)
+nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S
 endif
 if X86
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86)
+nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S
 endif
 if X86_WIN32
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32)
+nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.S
 endif
 if SPARC
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SPARC)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SPARC)
+nodist_libffi_la_SOURCES += src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
 endif
 if ALPHA
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ALPHA)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ALPHA)
+nodist_libffi_la_SOURCES += src/alpha/ffi.c src/alpha/osf.S
 endif
 if IA64
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_IA64)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_IA64)
+nodist_libffi_la_SOURCES += src/ia64/ffi.c src/ia64/unix.S
 endif
 if M68K
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_M68K)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_M68K)
+nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S
 endif
 if POWERPC
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC)
+nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
 endif
 if POWERPC_AIX
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX)
+nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
 endif
 if POWERPC_DARWIN
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN)
+nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
 endif
 if ARM
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM)
+nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c
 endif
 if S390
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390)
+nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c
 endif
 if X86_64
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64)
+nodist_libffi_la_SOURCES += src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
 endif
 if SH
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH)
+nodist_libffi_la_SOURCES += src/sh/sysv.S src/sh/ffi.c
 endif
 if SH64
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH64)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH64)
+nodist_libffi_la_SOURCES += src/sh64/sysv.S src/sh64/ffi.c
 endif
 
+libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
+nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
+
 AM_CFLAGS = -fexceptions
 
 libffi_la_LDFLAGS = -release $(VERSION) 
 
 INCLUDES = -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
-
-# Override these rules so that object files get put in the correct 
-# subdirectories. 
-.c.o:
-	$(LTCOMPILE) -c -o $@ $<
-
-.s.o:
-	$(LTCOMPILE) -c -o $@ $<
-
-.S.o:
-	$(LTCOMPILE) -c -o $@ $<
-
-.c.lo:
-	$(LTCOMPILE) -c -o $@ $<
-
-.s.lo:
-	$(LTCOMPILE) -c -o $@ $<
-
-.S.lo:
-	$(LTCOMPILE) -c -o $@ $<
-
-# Multilib support.
-.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
-	maintainer-clean-multi
-
-all-recursive: all-multi
-install-recursive: install-multi
-mostlyclean-recursive: mostlyclean-multi
-clean-recursive: clean-multi
-distclean-recursive: distclean-multi
-maintainer-clean-recursive: maintainer-clean-multi
-
-all-multi:
-	: $(MAKE) ; exec $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
-install-multi:
-	$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
-mostlyclean-multi:
-	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
-clean-multi:
-	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
-distclean-multi:
-	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
-maintainer-clean-multi:
-	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
-
+AM_CCASFLAGS = $(INCLUDES)
 
 ## ################################################################
 
Index: gcc/libffi/acconfig.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libffi/acconfig.h,v
retrieving revision 1.2
diff -u -r1.2 acconfig.h
--- gcc/libffi/acconfig.h	1 Sep 1999 23:16:33 -0000	1.2
+++ gcc/libffi/acconfig.h	25 Jun 2003 08:22:57 -0000
@@ -1,12 +0,0 @@
-/* Define this if you want extra debugging */
-#undef FFI_DEBUG
-
-/* Define this if you are using Purify and want to suppress 
-   spurious messages. */
-#undef USING_PURIFY
-
-/* Define this is you do not want support for aggregate types.  */
-#undef FFI_NO_STRUCTS
-
-/* Define this is you do not want support for the raw API.  */
-#undef FFI_NO_RAW_API
Index: gcc/libffi/configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libffi/configure.in,v
retrieving revision 1.43
diff -u -r1.43 configure.in
--- gcc/libffi/configure.in	13 Jun 2003 02:23:26 -0000	1.43
+++ gcc/libffi/configure.in	25 Jun 2003 08:23:00 -0000
@@ -1,47 +1,31 @@
 dnl Process this with autoconf to create configure
 AC_INIT(fficonfig.h.in)
-AM_CONFIG_HEADER(fficonfig.h)
+AC_PREREQ(2.57)
 
 # 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
+# exported. (??? anyway it is Automake that should handle this)
+# 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
+AM_ENABLE_MULTILIB(Makefile, ..)
+if test a = b; then
+  # This is for automake
+  AC_CONFIG_AUX_DIR(..)
 else
-  libffi_basedir=
+  # and this is for autoconf
+  AC_CONFIG_AUX_DIRS(${multi_basedir})
 fi
-AC_SUBST(libffi_basedir)
-AC_CONFIG_AUX_DIR(${libffi_basedir}..)
 
 AC_CANONICAL_HOST
 
-AM_PROG_LIBTOOL
-
 AM_INIT_AUTOMAKE(libffi,2.00-beta,no-define)
 
-AC_EXEEXT
 AM_MAINTAINER_MODE
 
 AC_PROG_CC
+AM_PROG_AS
+AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 
 TARGETDIR="unknown"
@@ -81,9 +65,11 @@
 if test $TARGETDIR = unknown; then
   AC_ERROR("libffi has not been ported to $host.")
 fi
+if test ${TARGET}${ac_cv_prog_gcc} = MIPSno; then
+  AC_ERROR("libffi requires gcc on MIPS.")
+fi
 
 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
-AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
 AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
 AM_CONDITIONAL(X86, test x$TARGET = xX86)
@@ -109,16 +95,15 @@
 AC_FUNC_ALLOCA
 
 dnl AC_CHECK_SIZEOF(char)
-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
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_SIZEOF(float)
+AC_CHECK_SIZEOF(double)
+AC_CHECK_SIZEOF(long double)
+AC_CHECK_SIZEOF(void *)
+AC_C_BIGENDIAN
 
 if test x$TARGET = xSPARC; then
     AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
@@ -178,25 +163,29 @@
 AC_ARG_ENABLE(debug,
 [  --enable-debug          debugging mode],
   if test "$enable_debug" = "yes"; then
-    AC_DEFINE(FFI_DEBUG)
+    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)
+    AC_DEFINE(FFI_NO_STRUCTS, 1,
+      [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)
+    AC_DEFINE(FFI_NO_RAW_API, 1,
+      [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)
+    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" &&
@@ -221,33 +210,25 @@
   multilib_arg=
 fi
 
-AC_OUTPUT(include/Makefile include/ffi.h Makefile,
+AC_CONFIG_COMMANDS(target-subdirs,
+[ 
+# Make target subdirectory if required.
+test -d include || mkdir include
+test -d src || mkdir src
+test -d src/$TARGETDIR || mkdir src/$TARGETDIR
+], [
+TARGETDIR="$TARGETDIR"
+])
+
+AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile)
+AC_CONFIG_HEADERS(fficonfig.h,
 [
-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}"
-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 
+if test -f include/fficonfig.h && 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
-)
+])
 
-# Make target subdirectories if required.
-test -d src || mkdir src
-test -d src/${TARGETDIR} || mkdir src/${TARGETDIR}
+AC_OUTPUT


More information about the autoconf-conversion mailing list