From 42a55f9500726068a43e98698760887fa43e4e11 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 23 Dec 2015 00:45:37 +0000 Subject: [PATCH] config: Use --static as necessary when autodetecting libs: libdl, libbfd and dependecies, and cpp symbol demangler support. --- config.lib | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/config.lib b/config.lib index e545891540..f01d5cdf84 100644 --- a/config.lib +++ b/config.lib @@ -1450,8 +1450,8 @@ make_compiler_cflags() { } test_compile_libbfd() { - log 2 "executing $cc_host $CFLAGS $LDFLAGS -o tmp.config.bfd -x c++ - $1" - "$cc_host" $CFLAGS $LDFLAGS -o tmp.config.bfd -x c++ - $1 2> /dev/null << EOL + log 2 "executing $cc_host $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.bfd -x c++ - $1" + "$cc_host" $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.bfd -x c++ - $1 2> /dev/null << EOL #define PACKAGE 1 #define PACKAGE_VERSION 1 #include @@ -1503,6 +1503,12 @@ make_cflags_and_ldflags() { CFLAGS="$CFLAGS -D$os" CFLAGS_BUILD="$CFLAGS_BUILD -D$os" + if [ "$enable_static" != "0" ]; then + STATIC_FLAGS="--static" + else + STATIC_FLAGS="" + fi + if [ "$enable_debug" = "0" ]; then # No debug, add default stuff OBJS_SUBDIR="release" @@ -1602,8 +1608,8 @@ make_cflags_and_ldflags() { LIBS="$LIBS -lpthread" fi if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then - log 2 "executing $cc_host $CFLAGS $LDFLAGS -o tmp.config.libdl -x c++ - -ldl" - "$cc_host" $CFLAGS $LDFLAGS -o tmp.config.libdl -x c++ - -ldl 2> /dev/null << EOL + log 2 "executing $cc_host $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.libdl -x c++ - -ldl" + "$cc_host" $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.libdl -x c++ - -ldl 2> /dev/null << EOL #include int main() { Dl_info info; @@ -1684,8 +1690,8 @@ EOL fi if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then - log 2 "executing $cc_host $CFLAGS $LDFLAGS -o tmp.config.demangle -x c++ - -lstdc++" - "$cc_host" $CFLAGS $LDFLAGS -o tmp.config.demangle -x c++ - -lstdc++ 2> /dev/null << EOL + log 2 "executing $cc_host $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.demangle -x c++ - -lstdc++" + "$cc_host" $CFLAGS $LDFLAGS $STATIC_FLAGS -o tmp.config.demangle -x c++ - -lstdc++ 2> /dev/null << EOL #include int main() { int status = -1;