This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] patch libffi autoconversion


andreas tobler wrote:

Sorry for the non unified diff.

Here the correct one.

Andreas
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libffi/configure.in,v
retrieving revision 1.48
diff -u -r1.48 configure.in
--- configure.in	15 Jan 2004 03:41:46 -0000	1.48
+++ configure.in	3 Mar 2004 03:37:44 -0000
@@ -1,58 +1,47 @@
 dnl Process this with autoconf to create configure
-AC_PREREQ(2.13)
-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
+
+AC_PREREQ(2.59)
+
+AC_INIT([libffi], [3.5], [http://gcc.gnu.org/bugzilla/])
+AC_CONFIG_HEADERS([fficonfig.h])
+
+AM_ENABLE_MULTILIB(, ..)
+if test a = b; then
+   # This is for automake
+   AC_CONFIG_AUX_DIR([..])
 else
-  libffi_basedir=
-fi
-AC_SUBST(libffi_basedir)
-AC_CONFIG_AUX_DIR(${libffi_basedir}..)
+   # and this is for autoconf
+   AC_CONFIG_AUX_DIRS(${multi_basedir})
+ fi
 
 AC_CANONICAL_SYSTEM
 target_alias=${target_alias-$host_alias}
 
-AM_PROG_LIBTOOL
-
-AM_INIT_AUTOMAKE(libffi,2.00-beta,no-define)
+AM_INIT_AUTOMAKE
 
-AC_EXEEXT
-AM_MAINTAINER_MODE
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
 
+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])
+
+AC_SUBST(CFLAGS)
 
+AM_PROG_AS
+AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 
+AM_MAINTAINER_MODE
+
 AC_FUNC_MMAP_BLACKLIST
 
 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;;
@@ -90,7 +79,7 @@
 AC_SUBST(AM_RUNTESTFLAGS)
 
 if test $TARGETDIR = unknown; then
-  AC_ERROR("libffi has not been ported to $host.")
+  AC_MSG_ERROR(["libffi has not been ported to $host."])
 fi
 
 AM_CONDITIONAL(MIPS_IRIX, test x$TARGET = xMIPS_IRIX)
@@ -156,12 +145,12 @@
        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])
+		       [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.])
+	       [Define if your assembler supports .register.])
     fi
 fi
 
@@ -251,28 +240,14 @@
   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.
+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}
-test -d include || mkdir include
+test -d src/$TARGETDIR || mkdir src/$TARGETDIR
+], [TARGETDIR="$TARGETDIR"])
+
+AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
+
+AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile)
 
-AC_LINK_FILES(src/$TARGETDIR/ffitarget.h, include/ffitarget.h)
-)
+AC_OUTPUT
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libffi/Makefile.am,v
retrieving revision 1.30
diff -u -r1.30 Makefile.am
--- Makefile.am	21 Oct 2003 19:01:53 -0000	1.30
+++ Makefile.am	3 Mar 2004 03:37:44 -0000
@@ -1,6 +1,6 @@
 ## Process this with automake to create Makefile.in
 
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = foreign no-dependencies subdir-objects
 
 SUBDIRS = include testsuite
 
@@ -24,9 +24,6 @@
 	src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \
 	src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h
 
-
-VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@
-
 ## ################################################################
 
 ##
@@ -74,7 +71,7 @@
 
 MAKEOVERRIDES=
 
-# Multilib support variables.
+# Multilib support variables working around Automake bug.
 MULTISRCTOP =
 MULTIBUILDTOP =
 MULTIDIRS =
@@ -85,156 +82,67 @@
 toolexeclib_LTLIBRARIES = libffi.la
 noinst_LTLIBRARIES = libffi_convenience.la
 
+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 =
 
-TARGET_SRC_MIPS_IRIX = 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_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_@TARGET@)
-## Work around automake deficiency
-libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \
-		src/raw_api.c src/java_raw_api.c
 if MIPS_IRIX
-libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_IRIX)
-libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_IRIX)
+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)
+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 = -Wall -g -fexceptions
 
-libffi_la_LDFLAGS = -release $(VERSION) 
+libffi_la_LDFLAGS = -release $(VERSION)
 
 INCLUDES = -I. -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
-
-
-## ################################################################
-
-# Our hacked automake doesn't clean subdirectories properly.
-mostlyclean-am: mostlyclean-sub
-mostlyclean-sub:
-	-rm -f src/*.o src/*.lo
-	-rm -f src/@TARGETDIR@/*.o src/@TARGETDIR@/*.lo
-
-clean-am: clean-sub
-clean-sub:
-	-rm -rf src/.libs src/_libs
-	-rm -rf src/@TARGETDIR@/.libs src/@TARGETDIR@/_libs
-
-
+AM_CCASFLAGS = $(INCLUDES)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]