gcc/config
Andrew Burgess e7c26e04b2 gcc: Add new configure options to allow static libraries to be selected
The motivation behind this change is to make it easier for a user to
link against static libraries on a target where dynamic libraries are
the default library type (for example GNU/Linux).

Further, my motivation is really for linking libraries into GDB,
however, the binutils-gdb/config/ directory is a copy of gcc/config/
so changes for GDB need to be approved by the GCC project first.

After making this change in the gcc/config/ directory I've run
autoreconf on all of the configure scripts in the GCC tree and a
couple have been updated, so I'll use one of these to describe what my
change does.

Consider libcpp, this library links against libiconv.  Currently if
the user builds on a system with both static and dynamic libiconv
installed then autotools will pick up the dynamic libiconv by
default.  This is almost certainly the right thing to do.

However, if the user wants to link against static libiconv then things
are a little harder, they could remove the dynamic libiconv from their
system, but this is probably a bad idea (other things might depend on
that library), or the user can build their own version of libiconv,
install it into a unique prefix, and then configure gcc using the
--with-libiconv-prefix=DIR flag.  This works fine, but is somewhat
annoying, the static library available, I just can't get autotools to
use it.

My change then adds a new flag --with-libiconv-type=TYPE, where type
is either auto, static, or shared.  The default auto, ensures we keep
the existing behaviour unchanged.

If the user configures with --with-libiconv-type=static then the
configure script will ignore any dynamic libiconv it finds, and will
only look for a static libiconv, if no static libiconv is found then
the configure will continue as though there is no libiconv at all
available.

Similarly a user can specify --with-libiconv-type=shared and force the
use of shared libiconv, any static libiconv will be ignored.

As I've implemented this change within the AC_LIB_LINKFLAGS_BODY macro
then only libraries configured using the AC_LIB_LINKFLAGS or
AC_LIB_HAVE_LINKFLAGS macros will gain the new configure flag.

If this is accepted into GCC then there will be follow on patches for
binutils and GDB to regenerate some configure scripts in those
projects.

For GCC only two configure scripts needed updated after this commit,
libcpp and libstdc++-v3, both of which link against libiconv.

config/ChangeLog:

	* lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Add new
	--with-libXXX-type=... option.  Use this to guide the selection of
	either a shared library or a static library.

libcpp/ChangeLog:

	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.
2020-01-27 22:02:35 +00:00
..
ChangeLog gcc: Add new configure options to allow static libraries to be selected 2020-01-27 22:02:35 +00:00
acinclude.m4 config: sync with src 2008-07-30 14:57:07 +00:00
acx.m4 re PR jit/85384 (libgccjit does not work if --with-gcc-major-version is used) 2018-04-18 11:46:58 +02:00
asmcfi.m4 libitm: Configure for gas cfi pseudo ops. 2011-11-09 10:09:53 -08:00
ax_check_define.m4 re PR target/78478 (Compile Error for i386-rtems) 2017-01-19 22:00:53 +01:00
ax_count_cpus.m4 Generalize getconf _NPROCESSORS_ONLN 2019-05-30 09:06:48 +00:00
ax_pthread.m4 Add ax_pthread.m4 for use in binutils-gdb 2018-05-09 11:25:27 -04:00
bitfields.m4 Improve the test in bitfields.m4 2015-05-05 03:41:53 +00:00
bootstrap-O1.mk re PR target/37137 (unrecognized command line option "-minterlink-mips16") 2009-05-12 05:49:28 +00:00
bootstrap-O3.mk re PR target/37137 (unrecognized command line option "-minterlink-mips16") 2009-05-12 05:49:28 +00:00
bootstrap-Og.mk Add a build config for bootstrapping at -Og 2019-07-08 06:21:11 +00:00
bootstrap-asan.mk Add support for ASan odr_indicator. 2016-12-02 09:39:27 +02:00
bootstrap-cet.mk x86/CET: Add -fcf-protection to STAGE4_CFLAGS 2018-04-24 15:12:46 -07:00
bootstrap-debug-big.mk configure.ac (--with-build-config): New. 2009-09-03 05:55:57 +00:00
bootstrap-debug-ckovw.mk invoke.texi (-fvar-tracking-assignments): New. 2009-09-02 02:42:21 +00:00
bootstrap-debug-lean.mk Use compare-debug for bootstrap-debug-lean to ignore != DW_AT_producer 2017-11-15 03:11:37 +00:00
bootstrap-debug-lib.mk invoke.texi (-fvar-tracking-assignments): New. 2009-09-02 02:42:21 +00:00
bootstrap-debug.mk invoke.texi (-fvar-tracking-assignments): New. 2009-09-02 02:42:21 +00:00
bootstrap-lto-lean.mk Filter out LTO in config/bootstrap-lto-lean.mk. 2019-04-16 15:24:53 +00:00
bootstrap-lto-noplugin.mk re PR bootstrap/85571 (non-bootstrap-debug miscompare with trunk) 2018-05-08 08:50:33 +00:00
bootstrap-lto.mk re PR lto/85574 (LTO bootstapped binaries differ) 2019-05-02 13:58:47 +00:00
bootstrap-time.mk invoke.texi (-fvar-tracking-assignments): New. 2009-09-02 02:42:21 +00:00
bootstrap-ubsan.mk Improve boostrap-ubsan config (PR bootstrap/64914). 2018-05-10 10:15:42 +00:00
cet.m4 x86/CET: Build target libraries with -mshstk 2018-04-24 09:41:01 -07:00
codeset.m4
depstand.m4
dfp.m4 Add missing '|' as wrong patch was applied. 2018-07-05 14:28:01 -06:00
elf.m4 sync config/* from binutils 2016-12-08 09:46:03 +10:30
enable.m4
extensions.m4 extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Do not expand for Autoconf 2.62 or newer. 2009-07-30 19:41:13 +00:00
futex.m4 [ARM/FDPIC v6 02/24] [ARM] FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure scripts 2019-09-10 09:37:00 +02:00
gc++filt.m4 Missed in last commit. 2010-07-02 10:26:12 +00:00
gcc-plugin.m4 gcc-plugin.m4 (GCC_ENABLE_PLUGINS): Remove -q option passed to grep. 2018-02-06 08:30:53 +00:00
gettext-sister.m4
gettext.m4 re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
glibc21.m4
gthr.m4 Create GCN-specific gthreads 2019-06-25 11:41:29 +00:00
gxx-include-dir.m4
hwcaps.m4 Build libgo with -Wa,-nH if possible (PR go/78978) [non-libgo parts] 2017-01-06 14:33:47 +00:00
iconv.m4 iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS. 2018-11-07 15:41:21 -07:00
intdiv0.m4
inttypes-pri.m4
inttypes.m4
inttypes_h.m4
isl.m4 isl.m4: Remove support for ISL 0.14. 2017-02-13 08:54:02 +00:00
largefile.m4 largefile.m4 (ACX_LARGEFILE): Require AC_CANONICAL_HOST and AC_CANONICAL_TARGET. 2009-11-30 16:38:14 +00:00
lcmessage.m4
ld-symbolic.m4
lead-dot.m4 Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception. 2009-04-09 17:00:19 +02:00
lib-ld.m4
lib-link.m4 gcc: Add new configure options to allow static libraries to be selected 2020-01-27 22:02:35 +00:00
lib-prefix.m4
libstdc++-raw-cxx.m4 Remove "-I" from LIBSTDCXX_RAW_CXX_LDFLAGS 2013-01-07 10:23:42 -08:00
lthostflags.m4 re PR target/40125 (libgcc_s DLL installed in wrong directory in cross toolchain) 2010-12-06 00:50:04 +00:00
math.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
mh-alpha-linux Install back PR target/47230 fix (Revert the revert). 2015-03-27 18:08:44 +01:00
mh-cygwin Makefile.def: Add dependency from termcap to gdb. 2011-03-24 17:11:26 +00:00
mh-darwin re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.) 2015-04-10 06:43:52 +00:00
mh-djgpp
mh-mingw mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code. 2019-03-18 22:36:56 +00:00
mh-pa configure.ac: Add makefile fragments for hpux. 2008-07-30 12:17:17 +00:00
mh-pa-hpux10 configure.ac: Add makefile fragments for hpux. 2008-07-30 12:17:17 +00:00
mh-ppc-aix mh-ppc-aix (LDFLAGS): Quote $(CC). 2012-05-03 15:39:07 +00:00
mmap.m4 mmap.m4: Use *vms* instead of vms*. 2012-04-03 12:07:28 +00:00
mt-alphaieee mt-alphaieee (GOCFLAGS_FOR_TARGET): Add -mieee. 2011-07-06 19:48:43 +02:00
mt-android configure.ac (*-*-linux-android*): Set target_makefile_frag. 2017-06-03 08:23:22 +00:00
mt-d30v
mt-gnu re PR target/43538 (config/mt-gnu CXXFLAGS_FOR_TARGET) 2014-04-25 08:03:08 +00:00
mt-mips-elfoabi configure.ac (mips*-*-*linux*, [...]): Use mt-mips-gnu. 2008-08-09 19:08:15 +00:00
mt-mips-gnu configure.ac (mips*-*-*linux*, [...]): Use mt-mips-gnu. 2008-08-09 19:08:15 +00:00
mt-mips16-compat configure.ac (mips*-*-*linux*, [...]): Use mt-mips-gnu. 2008-08-09 19:08:15 +00:00
mt-nios2-elf configure.ac (target_makefile_frag): Set for nios2-*-elf*. 2014-05-14 19:20:59 -04:00
mt-ospace mt-ospace (CFLAGS_FOR_TARGET): Append -g -Os rather than overwriting. 2014-11-18 15:12:52 -07:00
mt-sde mt-sde: Change -mcode-xonly to -mcode-readable=pcrel. 2012-09-19 20:42:01 +00:00
mt-spu mt-spu (all-ld): Update for ld Makefile changes. 2008-08-03 13:07:55 +09:30
multi.m4 Add D front-end, libphobos library, and D2 testsuite. 2018-10-28 19:51:47 +00:00
nls.m4
no-executables.m4 extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Do not expand for Autoconf 2.62 or newer. 2009-07-30 19:41:13 +00:00
override.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
picflag.m4 Update configure deps, remove stray \xA0 in picflag.m4, regenerate 2017-01-04 18:59:34 +10:30
plugins.m4 Use dlsym to check if libdl is needed for plugin 2018-04-05 10:49:39 -07:00
po.m4 re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
proginstall.m4 configure.ac: m4_include config/proginstall.m4. 2008-03-16 08:19:08 +00:00
progtest.m4
sjlj.m4 sjlj.m4: New file. 2015-05-13 21:15:31 +00:00
stdint.m4 re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
stdint_h.m4
target-posix [PATCH 2/4] OpenMP 4.0 offloading to Intel MIC: liboffloadmic. 2014-11-13 14:03:17 +00:00
tcl.m4 re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
tls.m4 [ARM/FDPIC v6 02/24] [ARM] FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure scripts 2019-09-10 09:37:00 +02:00
toolexeclibdir.m4 Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
uintmax_t.m4
ulonglong.m4
unwind_ipinfo.m4 Index... 2008-12-21 14:27:18 -08:00
warnings.m4 * warnings.m4: Fix comment. 2015-05-27 16:40:38 -04:00
weakref.m4 Remove obsolete Tru64 UNIX V5.1B support 2012-03-12 15:35:56 +00:00
zlib.m4 This patch syncs zlib.m4 with binutils-gdb and uses AM_ZLIB from zlib.m4 2015-07-14 07:25:35 -07:00