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: libmudflap: Handle multilibs


Andreas Jaeger <aj@suse.de> writes:

> This patch adds multi-lib support to libmudflap.
>
> Tested on Linux/AMD64 with bootstrap of C++,C,Fortran.

This one adds --enable-version-specific-runtime-libs and handles
installation correctly.  Tested with and without
--enable-version-specific-runtime-libs together with my other patches
on Linux/AMD64.

Ok to commit?

Andreas

2004-05-29  Andreas Jaeger  <aj@suse.de>

	libmudflap:
	* configure.in: Handle multilibs, support
	--enable-version-specific-runtime-libs.
	* Makefile.am (lib_LTLIBRARIES): Rename to ...
        (toolexeclib_LTLIBRARIES): this for multilib support.
	* Makefile.in: Regenerated.
	* configure: Regenerated.
	* aclocal.m4: Regenerated.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/configure.in,v
retrieving revision 1.2
diff -u -p -r1.2 configure.in
--- configure.in	13 May 2004 06:41:03 -0000	1.2
+++ configure.in	30 May 2004 21:18:18 -0000
@@ -11,17 +11,40 @@ AC_SUBST(PACKAGE)
 libtool_VERSION=1:0:0
 AC_SUBST(libtool_VERSION)
 
-dnl AM_ENABLE_MULTILIB
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+AC_ARG_ENABLE(version-specific-runtime-libs,
+[  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
+[case "$enableval" in
+ yes) version_specific_libs=yes ;;
+ no)  version_specific_libs=no ;;
+ *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+ esac],
+[version_specific_libs=no])
+AC_MSG_RESULT($version_specific_libs)
+
 AM_MAINTAINER_MODE
 AC_EXEEXT
 
+AM_ENABLE_MULTILIB(, ..)
+
 target_alias=${target_alias-$target}
 AC_SUBST(target_alias)
 
 AM_CONFIG_HEADER(config.h)
 
 AC_LANG_C
+# 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)
+
 if test "x$GCC" != "xyes"; then
   AC_MSG_ERROR([libmudflap must be built with GCC])
 fi
@@ -95,6 +118,42 @@ AM_CONDITIONAL(LIBMUDFLAPTH, [test "x$ac
 
 AC_CHECK_LIB(dl, dlsym)
 
+# Process the option "--enable-version-specific-runtime-libs"
+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/'`
+AC_SUBST(gcc_version)
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${version_specific_libs} in
+  yes)
+    # Need the gcc compiler version to know where to install libraries
+    # and header files if --enable-version-specific-runtime-libs option
+    # is selected.
+    toolexecdir='$(libdir)/gcc/$(target_alias)'
+    toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
+    ;;
+  no)
+    if test -n "$with_cross_host" &&
+       test x"$with_cross_host" != x"no"; then
+      # Install a library built with a cross compiler in tooldir, not libdir.
+      toolexecdir='$(exec_prefix)/$(target_alias)'
+      toolexeclibdir='$(toolexecdir)/lib'
+    else
+      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
+    ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
 if test "x$enable_shared" = "xyes" && test "x$ac_have_pthread_h" != ""; then
   # NB: don't check for -lpthread here, because then it would be
   # added to LIBS.  For the thread-unaware libmudflap.la, we don't
@@ -131,7 +190,12 @@ EOF
     LIBS="$oldLIBS"
   fi
 fi
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_VERSION, $pthread_create_version, [pthread_create symbol version])   

 
+if test ${multilib} = yes; then
+  multilib_arg="--enable-multilib"
+else
+  multilib_arg=
+fi
 
 AC_OUTPUT([Makefile testsuite/Makefile mf-runtime.h])
============================================================
Index: libmudflap/Makefile.am
--- libmudflap/Makefile.am	21 May 2004 20:33:58 -0000	1.3
+++ libmudflap/Makefile.am	30 May 2004 11:44:54 -0000
@@ -16,7 +16,7 @@ else
 libmudflapth =
 endif
 
-lib_LTLIBRARIES = libmudflap.la $(libmudflapth)
+toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth)
 include_HEADERS = mf-runtime.h
 
 libmudflap_la_SOURCES = \

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


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