From 2a7a8388e2e4b7caf08cdd67f1bcebbc49ac3133 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 13 Jun 2014 16:30:46 +0200 Subject: [PATCH] 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 --- lto-plugin/ChangeLog | 10 ++++++++++ lto-plugin/Makefile.am | 31 +++++++++++++++++-------------- lto-plugin/Makefile.in | 32 +++++++++++++++++--------------- lto-plugin/configure | 17 +++++++++++++++-- lto-plugin/configure.ac | 5 +++++ 5 files changed, 64 insertions(+), 31 deletions(-) diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index 332067e..1b640bd 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,13 @@ +2014-06-13 Thomas Schwinge + + * 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 PR lto/60981 diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am index bbb92f9..f3fb89b 100644 --- a/lto-plugin/Makefile.am +++ b/lto-plugin/Makefile.am @@ -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 $@ diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in index 6e2fcc6..0a259e4 100644 --- a/lto-plugin/Makefile.in +++ b/lto-plugin/Makefile.in @@ -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,)) - -# 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)) + $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ + $(if $(wildcard $(libiberty_pic)),$(Wc)$(libiberty_pic),)) -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 $@ diff --git a/lto-plugin/configure b/lto-plugin/configure index a579b99..6c36dfb 100755 --- a/lto-plugin/configure +++ b/lto-plugin/configure @@ -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 diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac index a5f1774d..6a5ae8a 100644 --- a/lto-plugin/configure.ac +++ b/lto-plugin/configure.ac @@ -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]) -- 2.7.4