diff mbox

PR other/55291: Add support for GCC multilib run-time libraries to libsanitizer

Message ID 20121113164655.GA9969@gmail.com
State New
Headers show

Commit Message

H.J. Lu Nov. 13, 2012, 4:46 p.m. UTC
On Tue, Nov 13, 2012 at 08:34:56AM -0800, H.J. Lu wrote:
> Hi,
> 
> This patch adds support for GCC multilib run-time libraries to
> libsanitizer. I have to delete install-sh.  Otherwise ac_aux_dir will
> be wrong:
> 
> ac_aux_dir=
> for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
>   for ac_t in install-sh install.sh shtool; do
>     if test -f "$ac_dir/$ac_t"; then
>       ac_aux_dir=$ac_dir
>       ac_install_sh="$ac_aux_dir/$ac_t -c"
>       break 2
>     fi
> 
> Tested with GCC autoconf/automake on Linux/x86-64.  OK to install?
> 

Here is a smaller patch without removing install-sh.  Instead, it
sets AC_CONFIG_AUX_DIR to "..".  OK to install?

Thanks.


H.J.
---

	PR other/55291
	* acinclude.m4: New file.
	* Makefile.am (ACLOCAL_AMFLAGS): New.
	* configure.ac (AC_PREREQ): Set to 2.64.
	(AC_CONFIG_AUX_DIR): Set to "..".
	(--enable-version-specific-runtime-libs): New option.
	(AC_CANONICAL_SYSTEM): New.
	(AM_ENABLE_MULTILIB): Moved right after AM_INIT_AUTOMAKE.
	(toolexecdir): Support multilib.
	(toolexeclibdir): Likewise.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* asan/Makefile.in: Likewise.
	* interception/Makefile.in: Likewise.
	* sanitizer_common/Makefile.in: Likewise.
---
 libsanitizer/Makefile.am   |  2 ++
 libsanitizer/acinclude.m4  | 10 ++++++++
 libsanitizer/configure.ac  | 63 ++++++++++++++++++++++++++++++++++++++--------

Comments

Jakub Jelinek Nov. 13, 2012, 4:56 p.m. UTC | #1
On Tue, Nov 13, 2012 at 08:46:55AM -0800, H.J. Lu wrote:
> On Tue, Nov 13, 2012 at 08:34:56AM -0800, H.J. Lu wrote:
> > This patch adds support for GCC multilib run-time libraries to
> > libsanitizer. I have to delete install-sh.  Otherwise ac_aux_dir will
> > be wrong:
> > 
> > ac_aux_dir=
> > for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
> >   for ac_t in install-sh install.sh shtool; do
> >     if test -f "$ac_dir/$ac_t"; then
> >       ac_aux_dir=$ac_dir
> >       ac_install_sh="$ac_aux_dir/$ac_t -c"
> >       break 2
> >     fi
> > 
> > Tested with GCC autoconf/automake on Linux/x86-64.  OK to install?
> > 
> 
> Here is a smaller patch without removing install-sh.  Instead, it
> sets AC_CONFIG_AUX_DIR to "..".  OK to install?

I believe libsanitizer/install-sh wasn't imported from LLVM, and
if it is not needed in the GCC tree, it IMHO should be just removed.
Similarly libsanitizer/missing, maybe libsanitizer/depcomp (the former
one isn't present in any other lib*/ in gcc, the latter only in boehm-gc,
so I'd guess non-essential).  Ditto ltmain.sh, config.sub, config.guess.

libsanitizer/ChangeLog.asan should probably be just libsanitizer/ChangeLog.

In any case, I'd prefer if configury maintainers could review that.

	Jakub
H.J. Lu Nov. 13, 2012, 5:03 p.m. UTC | #2
On Tue, Nov 13, 2012 at 8:56 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Nov 13, 2012 at 08:46:55AM -0800, H.J. Lu wrote:
>> On Tue, Nov 13, 2012 at 08:34:56AM -0800, H.J. Lu wrote:
>> > This patch adds support for GCC multilib run-time libraries to
>> > libsanitizer. I have to delete install-sh.  Otherwise ac_aux_dir will
>> > be wrong:
>> >
>> > ac_aux_dir=
>> > for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
>> >   for ac_t in install-sh install.sh shtool; do
>> >     if test -f "$ac_dir/$ac_t"; then
>> >       ac_aux_dir=$ac_dir
>> >       ac_install_sh="$ac_aux_dir/$ac_t -c"
>> >       break 2
>> >     fi
>> >
>> > Tested with GCC autoconf/automake on Linux/x86-64.  OK to install?
>> >
>>
>> Here is a smaller patch without removing install-sh.  Instead, it
>> sets AC_CONFIG_AUX_DIR to "..".  OK to install?
>
> I believe libsanitizer/install-sh wasn't imported from LLVM, and
> if it is not needed in the GCC tree, it IMHO should be just removed.
> Similarly libsanitizer/missing, maybe libsanitizer/depcomp (the former
> one isn't present in any other lib*/ in gcc, the latter only in boehm-gc,
> so I'd guess non-essential).  Ditto ltmain.sh, config.sub, config.guess.

That is true.  Those files aren't used in GCC tree.

> libsanitizer/ChangeLog.asan should probably be just libsanitizer/ChangeLog.
>
> In any case, I'd prefer if configury maintainers could review that.

Sure.

Thanks.
Paolo Bonzini Nov. 13, 2012, 10:30 p.m. UTC | #3
Il 13/11/2012 18:03, H.J. Lu ha scritto:
>> > libsanitizer/ChangeLog.asan should probably be just libsanitizer/ChangeLog.
>> >
>> > In any case, I'd prefer if configury maintainers could review that.
> Sure.

Let's first remove the files that are duplicated between the toplevel
and libsanitizer/.  This is preapproved after a successful bootstrap,
but please remember to rerun autoconf/automake in the libsanitizer/
directory.

Then, IIUC, H.J.'s first patch can be applied; I'll try to review it
tomorrow, otherwise please ping me again 1-2 days after removing the
duplicated files.

Paolo
Paolo Bonzini Nov. 13, 2012, 11:03 p.m. UTC | #4
Il 13/11/2012 23:45, H.J. Lu ha scritto:
>> >
>> > Let's first remove the files that are duplicated between the toplevel
>> > and libsanitizer/.  This is preapproved after a successful bootstrap,
>> > but please remember to rerun autoconf/automake in the libsanitizer/
>> > directory.
> We can't remove duplicated files without fixing configure.ac
> first.

What has to be fixed about it?  Anything except AC_PREREQ/AC_CONFIG_AUX_DIR?

I really would prefer to do it in the order I mentioned above.

Paolo
H.J. Lu Nov. 13, 2012, 11:16 p.m. UTC | #5
On Tue, Nov 13, 2012 at 3:03 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> Il 13/11/2012 23:45, H.J. Lu ha scritto:
>>> >
>>> > Let's first remove the files that are duplicated between the toplevel
>>> > and libsanitizer/.  This is preapproved after a successful bootstrap,
>>> > but please remember to rerun autoconf/automake in the libsanitizer/
>>> > directory.
>> We can't remove duplicated files without fixing configure.ac
>> first.
>
> What has to be fixed about it?  Anything except AC_PREREQ/AC_CONFIG_AUX_DIR?
>
> I really would prefer to do it in the order I mentioned above.

We also need

[hjl@gnu-tools-1 libsanitizer]$ cat acinclude.m4
dnl ----------------------------------------------------------------------
dnl This whole bit snagged from libgfortran.

sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
dnl add a definition of LIBTOOL to Makefile.in.
ifelse(,,,[AC_SUBST(LIBTOOL)
AC_DEFUN([AM_PROG_LIBTOOL])
])
[hjl@gnu-tools-1 libsanitizer]$

Otherwise, autoconf won't work.
Paolo Bonzini Nov. 13, 2012, 11:19 p.m. UTC | #6
Il 14/11/2012 00:16, H.J. Lu ha scritto:
>> > What has to be fixed about it?  Anything except AC_PREREQ/AC_CONFIG_AUX_DIR?
>> >
>> > I really would prefer to do it in the order I mentioned above.
> We also need
> 
> [hjl@gnu-tools-1 libsanitizer]$ cat acinclude.m4
> dnl ----------------------------------------------------------------------
> dnl This whole bit snagged from libgfortran.
> 
> sinclude(../libtool.m4)
> dnl The lines below arrange for aclocal not to bring an installed
> dnl libtool.m4 into aclocal.m4, while still arranging for automake to
> dnl add a definition of LIBTOOL to Makefile.in.
> ifelse(,,,[AC_SUBST(LIBTOOL)
> AC_DEFUN([AM_PROG_LIBTOOL])
> ])
> [hjl@gnu-tools-1 libsanitizer]$
> 
> Otherwise, autoconf won't work.

Sure, that's fine to include too.

Paolo
diff mbox

Patch

diff --git a/libsanitizer/Makefile.am b/libsanitizer/Makefile.am
index b28eb32..91e3434 100644
--- a/libsanitizer/Makefile.am
+++ b/libsanitizer/Makefile.am
@@ -1,3 +1,5 @@ 
+ACLOCAL_AMFLAGS = -I .. -I ../config
+
 SUBDIRS = interception sanitizer_common asan 
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
diff --git a/libsanitizer/acinclude.m4 b/libsanitizer/acinclude.m4
new file mode 100644
index 0000000..7be603e
--- /dev/null
+++ b/libsanitizer/acinclude.m4
@@ -0,0 +1,10 @@ 
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libgfortran.
+
+sinclude(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring an installed
+dnl libtool.m4 into aclocal.m4, while still arranging for automake to
+dnl add a definition of LIBTOOL to Makefile.in.
+ifelse(,,,[AC_SUBST(LIBTOOL)
+AC_DEFUN([AC_LIBTOOL_DLOPEN])
+])
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 3f186c2..6129536 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -1,11 +1,61 @@ 
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_PREREQ([2.68])
+AC_PREREQ([2.64])
 AC_INIT(package-unused, version-unused, libsanitizer)
 AC_CONFIG_SRCDIR([include/sanitizer/common_interface_defs.h])
-AC_CONFIG_AUX_DIR(.)
+AC_CONFIG_AUX_DIR(..)
+
+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)
+
+# Do not delete or change the following two lines.  For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+AC_CANONICAL_SYSTEM
+
+target_alias=${target_alias-$host_alias}
+AC_SUBST(target_alias)
+
 AM_INIT_AUTOMAKE(foreign)
+AM_ENABLE_MULTILIB(, ..)
+
+# 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)
 
 # Checks for programs.
 AC_PROG_CC
@@ -18,15 +68,6 @@  AM_PROG_LIBTOOL
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
 
-#AM_ENABLE_MULTILIB(, ..)
-target_alias=${target_alias-$host_alias}
-AC_SUBST(target_alias)
-
-toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-toolexeclibdir='$(libdir)'
-AC_SUBST(toolexecdir)
-AC_SUBST(toolexeclibdir)
-
 AC_CONFIG_FILES([Makefile])
 
 AC_CONFIG_FILES(AC_FOREACH([DIR], [interception sanitizer_common asan], [DIR/Makefile ]),