Allow overriding the libiberty used for building the LTO plugin.

lto-plugin/
	* configure.ac (--with-libiberty): New configure option.
	* configure: Regenerate.
	* Makefile.am (libiberty, libiberty_noasan, libiberty_pic): New
	variables.
	(liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS)
	(liblto_plugin_la_DEPENDENCIES): Use them.
	* Makefile.in: Regenerate.

From-SVN: r211642
This commit is contained in:
Thomas Schwinge 2014-06-13 16:30:46 +02:00 committed by Thomas Schwinge
parent beb683ab93
commit 2a7a8388e2
5 changed files with 64 additions and 31 deletions

View File

@ -1,3 +1,13 @@
2014-06-13 Thomas Schwinge <thomas@codesourcery.com>
* configure.ac (--with-libiberty): New configure option.
* configure: Regenerate.
* Makefile.am (libiberty, libiberty_noasan, libiberty_pic): New
variables.
(liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS)
(liblto_plugin_la_DEPENDENCIES): Use them.
* Makefile.in: Regenerate.
2014-05-15 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR lto/60981

View File

@ -18,22 +18,25 @@ libexecsub_LTLIBRARIES = liblto_plugin.la
gcc_build_dir = ../$(host_subdir)/gcc
in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
# Can be removed when libiberty becomes a normal convenience library
Wc=-Wc,
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
liblto_plugin_la_SOURCES = lto-plugin.c
liblto_plugin_la_LIBADD = \
$(if $(wildcard ../libiberty/noasan/libiberty.a),$(Wc)../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,))
# Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
# Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS.
liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
$(lt_host_flags) -module -bindir $(libexecsubdir) \
$(if $(wildcard ../libiberty/noasan/libiberty.a),, \
$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a))
liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \
../libiberty/noasan/libiberty.a),../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,))
$(lt_host_flags) -module -bindir $(libexecsubdir)
# Can be simplified when libiberty becomes a normal convenience library.
libiberty = $(with_libiberty)/libiberty.a
libiberty_noasan = $(with_libiberty)/noasan/libiberty.a
libiberty_pic = $(with_libiberty)/pic/libiberty.a
Wc=-Wc,
liblto_plugin_la_LIBADD = \
$(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
$(if $(wildcard $(libiberty_pic)),$(Wc)$(libiberty_pic),))
liblto_plugin_la_LDFLAGS += \
$(if $(wildcard $(libiberty_noasan)),, \
$(if $(wildcard $(libiberty_pic)),,-Wc,$(libiberty)))
liblto_plugin_la_DEPENDENCIES = \
$(if $(wildcard $(libiberty_noasan)),$(libiberty_noasan), \
$(if $(wildcard $(libiberty_pic)),$(libiberty_pic),))
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(liblto_plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@

View File

@ -222,6 +222,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
with_libiberty = @with_libiberty@
ACLOCAL_AMFLAGS = -I .. -I ../config
AUTOMAKE_OPTIONS = no-dependencies
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
@ -233,25 +234,26 @@ AM_LIBTOOLFLAGS = --tag=disable-static
libexecsub_LTLIBRARIES = liblto_plugin.la
gcc_build_dir = ../$(host_subdir)/gcc
in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
# Can be removed when libiberty becomes a normal convenience library
Wc = -Wc,
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
liblto_plugin_la_SOURCES = lto-plugin.c
# Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS.
liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(lt_host_flags) -module \
-bindir $(libexecsubdir) $(if $(wildcard \
$(libiberty_noasan)),, $(if $(wildcard \
$(libiberty_pic)),,-Wc,$(libiberty)))
# Can be simplified when libiberty becomes a normal convenience library.
libiberty = $(with_libiberty)/libiberty.a
libiberty_noasan = $(with_libiberty)/noasan/libiberty.a
libiberty_pic = $(with_libiberty)/pic/libiberty.a
Wc = -Wc,
liblto_plugin_la_LIBADD = \
$(if $(wildcard ../libiberty/noasan/libiberty.a),$(Wc)../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,))
$(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
$(if $(wildcard $(libiberty_pic)),$(Wc)$(libiberty_pic),))
# Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
$(lt_host_flags) -module -bindir $(libexecsubdir) \
$(if $(wildcard ../libiberty/noasan/libiberty.a),, \
$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a))
liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \
../libiberty/noasan/libiberty.a),../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,))
liblto_plugin_la_DEPENDENCIES = \
$(if $(wildcard $(libiberty_noasan)),$(libiberty_noasan), \
$(if $(wildcard $(libiberty_pic)),$(libiberty_pic),))
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(liblto_plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@

17
lto-plugin/configure vendored
View File

@ -640,6 +640,7 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
with_libiberty
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@ -725,6 +726,7 @@ ac_user_opts='
enable_option_checking
with_build_libsubdir
enable_maintainer_mode
with_libiberty
enable_dependency_tracking
enable_largefile
enable_shared
@ -1378,6 +1380,8 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
--with-libiberty=PATH specify the directory where to find libiberty
[../libiberty]
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
@ -2889,6 +2893,15 @@ fi
MAINT=$MAINTAINER_MODE_TRUE
# Check whether --with-libiberty was given.
if test "${with_libiberty+set}" = set; then :
withval=$with_libiberty;
else
with_libiberty=../libiberty
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -10586,7 +10599,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10589 "configure"
#line 10602 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10692,7 +10705,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10695 "configure"
#line 10708 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@ -4,6 +4,11 @@ AC_CANONICAL_SYSTEM
GCC_TOPLEV_SUBDIRS
AM_INIT_AUTOMAKE([foreign no-dist])
AM_MAINTAINER_MODE
AC_ARG_WITH(libiberty,
[AS_HELP_STRING([--with-libiberty=PATH],
[specify the directory where to find libiberty [../libiberty]])],
[], with_libiberty=../libiberty)
AC_SUBST(with_libiberty)
AC_PROG_CC
AC_SYS_LARGEFILE
ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_lto_plugin_warn_cflags])