libffi
Bonzini
bonzini at gnu.org
Tue Jun 17 15:58:00 UTC 2003
Here is a first stab at libffi conversion.
The problem is that I know nil about multilibbing, and tested only on
non-multilibbed i686-pc-linux-gnu, so it might not work where ml's
are used.
There are a few hacks removed and a few added. In particular I'd like
to receive commentary on the MIPS SGI stuff (is it supported? is it
necessary? is there a better solution?) and on AC_CONFIG_AUX_DIRS usage.
Thanks in advance,
Paolo
2003-06-17 Paolo Bonzini <bonzini at gnu.org>
* libffi/Makefile.am (nodist_libffi_la_SOURCES,
nodist_libffi_convenience_la_SOURCES): put target-
specific source files here. Create them as symlinks
from the files in the target-specific subdirectory.
(VPATH, implicit rules): remove them
(AM_CCASFLAGS): set it to $(INCLUDES).
* libffi/configure.ac: update to Autoconf 2.5x. Split
the multilib codelets into several small parts for each
of AC_CONFIG_FILES and AC_CONFIG_HEADERS.
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 17 Jun 2003 15:46:06 -0000
@@ -1,6 +1,6 @@
## Process this with automake to create Makefile.in
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = 1.7 cygnus
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@
-
## ################################################################
##
@@ -80,102 +78,102 @@
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 \
+# Work around automake deficiency
+# ---
+# Automake does not recognize that only one of src/x86/ffi.c,
+# src/mips/ffi.c etc. can be compiled at each time, and barfs
+# that they all go to the same object file. So we move the
+# target files to the src directory through symbolic links.
+
+libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
src/raw_api.c src/java_raw_api.c
+
+libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
+
+$(nodist_libffi_la_SOURCES):
+ @for dest in $(nodist_libffi_la_SOURCES); do \
+ src=`cd $(srcdir)/src/$(TARGETDIR); pwd`/`echo $$dest | sed 's,.*/,,' `; \
+ echo $(LN_S) $$src $$dest; \
+ $(LN_S) $$src $$dest; \
+ done
+
+# It still complains about o32.s and o32.S, so let's do this.
+%_cpp.s: %.s
+ cp $< $@
+
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/ffi.c src/o32.S src/n32.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/o32.S src/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/ffi.c src/o32.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/o32.S
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/ffi.c src/o32_cpp.s src/n32_cpp.s
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/o32_cpp.s src/n32_cpp.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/ffi.c src/sysv.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/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/ffi.c src/win32.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/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/ffi.c src/v8.S src/v9.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/v8.S src/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/ffi.c src/osf.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/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/ffi.c src/unix.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/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/ffi.c src/sysv.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/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/ffi.c src/sysv.S src/ppc_closure.S src/linux64.S src/linux64_closure.S
+nodist_libffi_convenience_la_SOURCES = src/ffi.c src/sysv.S src/ppc_closure.S src/linux64.S src/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/ffi_darwin.c src/aix.S src/aix_closure.S
+nodist_libffi_convenience_la_SOURCES = src/ffi_darwin.c src/aix.S src/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/ffi_darwin.c src/darwin.S src/darwin_closure.S
+nodist_libffi_convenience_la_SOURCES = src/ffi_darwin.c src/darwin.S src/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/sysv.S src/ffi.c
+nodist_libffi_convenience_la_SOURCES = src/sysv.S src/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/sysv.S src/ffi.c
+nodist_libffi_convenience_la_SOURCES = src/sysv.S src/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/ffi64.c src/unix64.S src/ffi.c src/sysv.S
+nodist_libffi_convenience_la_SOURCES = src/ffi64.c src/unix64.S src/ffi.c src/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/sysv.S src/ffi.c
+nodist_libffi_convenience_la_SOURCES = src/sysv.S src/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/sysv.S src/ffi.c
+nodist_libffi_convenience_la_SOURCES = src/sysv.S src/ffi.c
endif
AM_CFLAGS = -fexceptions
@@ -183,26 +181,7 @@
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 $@ $<
+AM_CCASFLAGS = $(INCLUDES)
# Multilib support.
.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
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 17 Jun 2003 15:46:07 -0000
@@ -1,6 +1,6 @@
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
@@ -30,18 +30,25 @@
libffi_basedir=
fi
AC_SUBST(libffi_basedir)
-AC_CONFIG_AUX_DIR(${libffi_basedir}..)
-AC_CANONICAL_HOST
+if test a = b; then
+ # This is for automake
+ AC_CONFIG_AUX_DIR(..)
+else
+ # and this is for autoconf
+ AC_CONFIG_AUX_DIRS(${libffi_basedir}.. dnl
+ ${libffi_basedir}../.. dnl
+ ${libffi_basedir}../../..)
+fi
-AM_PROG_LIBTOOL
+AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(libffi,2.00-beta,no-define)
-AC_EXEEXT
AM_MAINTAINER_MODE
AC_PROG_CC
+AM_PROG_AS
AC_PROG_LIBTOOL
TARGETDIR="unknown"
@@ -109,16 +116,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 +184,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,13 +231,13 @@
multilib_arg=
fi
-AC_OUTPUT(include/Makefile include/ffi.h Makefile,
+AC_CONFIG_FILES(include/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}
@@ -238,6 +248,10 @@
CC="${CC}"
DEFS="$DEFS"
ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
+])
+
+AC_CONFIG_HEADERS(fficonfig.h,
+[
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
@@ -246,8 +260,12 @@
echo Moving fficonfig.h to include/fficonfig.h
cp fficonfig.h include/fficonfig.h
fi
-)
+])
-# Make target subdirectories if required.
+AC_CONFIG_COMMANDS(target-subdirs,
+[
+# Make target subdirectory if required.
test -d src || mkdir src
-test -d src/${TARGETDIR} || mkdir src/${TARGETDIR}
+])
+
+AC_OUTPUT
More information about the autoconf-conversion
mailing list