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
acx.m4
asmcfi.m4
ax_check_define.m4
ax_count_cpus.m4
ax_pthread.m4
bitfields.m4
bootstrap-O1.mk
bootstrap-O3.mk
bootstrap-Og.mk
bootstrap-asan.mk
bootstrap-cet.mk
bootstrap-debug-big.mk
bootstrap-debug-ckovw.mk
bootstrap-debug-lean.mk
bootstrap-debug-lib.mk
bootstrap-debug.mk
bootstrap-lto-lean.mk
bootstrap-lto-noplugin.mk
bootstrap-lto.mk
bootstrap-time.mk
bootstrap-ubsan.mk
cet.m4
codeset.m4
depstand.m4
dfp.m4
elf.m4
enable.m4
extensions.m4
futex.m4
gc++filt.m4
gcc-plugin.m4
gettext-sister.m4
gettext.m4
glibc21.m4
gthr.m4
gxx-include-dir.m4
hwcaps.m4
iconv.m4
intdiv0.m4
inttypes-pri.m4
inttypes.m4
inttypes_h.m4
isl.m4
largefile.m4
lcmessage.m4
ld-symbolic.m4
lead-dot.m4
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
lthostflags.m4
math.m4
mh-alpha-linux
mh-cygwin
mh-darwin
mh-djgpp
mh-mingw
mh-pa
mh-pa-hpux10
mh-ppc-aix
mmap.m4
mt-alphaieee
mt-android
mt-d30v
mt-gnu
mt-mips-elfoabi
mt-mips-gnu
mt-mips16-compat
mt-nios2-elf
mt-ospace
mt-sde
mt-spu
multi.m4
nls.m4
no-executables.m4
override.m4
picflag.m4
plugins.m4
po.m4
proginstall.m4
progtest.m4
sjlj.m4
stdint.m4
stdint_h.m4
target-posix
tcl.m4
tls.m4
toolexeclibdir.m4 Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
uintmax_t.m4
ulonglong.m4
unwind_ipinfo.m4
warnings.m4
weakref.m4
zlib.m4