Change to config libbfd detection.
Include all used functions in test script, this is to catch unsatisfied dependency link errors. Try to compile with libiberty and then also with libintl if the initial test fails. Log the executed commands at level 2, for consistency with other config test compiles.
This commit is contained in:
93
config.lib
93
config.lib
@@ -1442,6 +1442,34 @@ make_compiler_cflags() {
|
||||
eval "$5=\"$features\""
|
||||
}
|
||||
|
||||
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
|
||||
#define PACKAGE 1
|
||||
#define PACKAGE_VERSION 1
|
||||
#include <bfd.h>
|
||||
#include <unistd.h>
|
||||
int main() {
|
||||
bfd_init();
|
||||
bfd *abfd = bfd_openr("test", "test");
|
||||
bfd_check_format(abfd, bfd_object);
|
||||
bfd_get_file_flags(abfd);
|
||||
bfd_map_over_sections(abfd, (void (*)(bfd*, asection*, void*)) 0, (void *) 0);
|
||||
asymbol *syms = 0;
|
||||
long symcount = bfd_read_minisymbols(abfd, false, (void**) &syms, (unsigned int *) 0);
|
||||
bfd_get_section_flags(abfd, (asection*) 0);
|
||||
bfd_get_section_vma(abfd, (asection*) 0);
|
||||
bfd_section_size(abfd, (asection*) 0);
|
||||
bfd_find_nearest_line(abfd, (asection*) 0, (asymbol **) 0, (bfd_vma) 0, (const char **) 0, (const char **) 0, (unsigned int *) 0);
|
||||
return (int) symcount;
|
||||
}
|
||||
EOL
|
||||
ret=$?
|
||||
rm -f tmp.config.bfd
|
||||
log 2 " exit code $ret"
|
||||
return $ret
|
||||
}
|
||||
|
||||
make_cflags_and_ldflags() {
|
||||
# General CFlags for BUILD
|
||||
CFLAGS_BUILD="$CFLAGS_BUILD"
|
||||
@@ -1567,6 +1595,7 @@ 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
|
||||
#include <dlfcn.h>
|
||||
int main() {
|
||||
@@ -1574,43 +1603,42 @@ make_cflags_and_ldflags() {
|
||||
return dladdr(0, &info);
|
||||
}
|
||||
EOL
|
||||
if [ $? -ne 0 ]; then
|
||||
ret=$?
|
||||
rm -f tmp.config.libdl
|
||||
log 2 " exit code $ret"
|
||||
if [ $ret -ne 0 ]; then
|
||||
log 1 "checking libdl... no"
|
||||
else
|
||||
log 1 "checking libdl... found"
|
||||
LIBS="$LIBS -ldl"
|
||||
CFLAGS="$CFLAGS -DWITH_DL"
|
||||
fi
|
||||
rm -f tmp.config.libdl
|
||||
|
||||
if [ "$with_libbfd" = "1" ]; then
|
||||
"$cc_host" $CFLAGS $LDFLAGS -o tmp.config.bfd -x c++ - -lbfd 2> /dev/null << EOL
|
||||
#define PACKAGE 1
|
||||
#define PACKAGE_VERSION 1
|
||||
#include <bfd.h>
|
||||
int main() {
|
||||
bfd_init();
|
||||
unsigned int size;
|
||||
asymbol *syms = 0;
|
||||
long symcount = bfd_read_minisymbols((bfd *) 0, false, (void**) &syms, &size);
|
||||
return 0;
|
||||
}
|
||||
EOL
|
||||
if [ $? -ne 0 ]; then
|
||||
log 1 "checking libbfd... no"
|
||||
if test_compile_libbfd "-lbfd -lz"; then
|
||||
LIBBFD_LIBS="-lbfd -lz"
|
||||
elif test_compile_libbfd "-lbfd -liberty -lz"; then
|
||||
LIBBFD_LIBS="-lbfd -liberty -lz"
|
||||
elif test_compile_libbfd "-lbfd -liberty -lintl -lz"; then
|
||||
LIBBFD_LIBS="-lbfd -liberty -lintl -lz"
|
||||
else
|
||||
LIBBFD_LIBS=
|
||||
fi
|
||||
if [ -n "$LIBBFD_LIBS" ]; then
|
||||
log 1 "checking libbfd... found"
|
||||
LIBS="$LIBS -lbfd"
|
||||
LIBS="$LIBS $LIBBFD_LIBS"
|
||||
CFLAGS="$CFLAGS -DWITH_BFD"
|
||||
if [ $enable_debug -lt 1 ] && [ "$with_bfd_extra_debug" = "1" ]; then
|
||||
CFLAGS="$CFLAGS -g1"
|
||||
fi
|
||||
else
|
||||
log 1 "checking libbfd... no"
|
||||
fi
|
||||
rm -f tmp.config.bfd
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$os" = "MINGW" ]; then
|
||||
log 2 "executing $cc_host $CFLAGS $LDFLAGS -o tmp.config.dbghelp -x c++ -"
|
||||
"$cc_host" $CFLAGS $LDFLAGS -o tmp.config.dbghelp -x c++ - 2> /dev/null << EOL
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
@@ -1622,43 +1650,34 @@ EOL
|
||||
return 0;
|
||||
}
|
||||
EOL
|
||||
if [ $? -ne 0 ]; then
|
||||
ret=$?
|
||||
rm -f tmp.config.dbghelp
|
||||
log 2 " exit code $ret"
|
||||
if [ $ret -ne 0 ]; then
|
||||
log 1 "checking dbghelp... no"
|
||||
else
|
||||
log 1 "checking dbghelp... found"
|
||||
CFLAGS="$CFLAGS -DWITH_DBGHELP"
|
||||
|
||||
if [ "$with_libbfd" = "1" ]; then
|
||||
"$cc_host" $CFLAGS $LDFLAGS -o tmp.config.bfd -x c++ - -lbfd -liberty -lintl 2> /dev/null << EOL
|
||||
#define PACKAGE 1
|
||||
#define PACKAGE_VERSION 1
|
||||
#include <bfd.h>
|
||||
int main() {
|
||||
bfd_init();
|
||||
unsigned int size;
|
||||
asymbol *syms = 0;
|
||||
long symcount = bfd_read_minisymbols((bfd *) 0, false, (void**) &syms, &size);
|
||||
return 0;
|
||||
}
|
||||
EOL
|
||||
test_compile_libbfd "-lbfd -liberty -lintl -lz"
|
||||
if [ $? -ne 0 ]; then
|
||||
log 1 "checking libbfd... no"
|
||||
else
|
||||
log 1 "checking libbfd... found"
|
||||
LIBS="$LIBS -lbfd -liberty -lintl"
|
||||
LIBS="$LIBS -lbfd -liberty -lintl -lz"
|
||||
CFLAGS="$CFLAGS -DWITH_BFD"
|
||||
|
||||
if [ $enable_debug -lt 1 ] && [ "$with_bfd_extra_debug" = "1" ]; then
|
||||
CFLAGS="$CFLAGS -g1"
|
||||
fi
|
||||
fi
|
||||
rm -f tmp.config.bfd
|
||||
fi
|
||||
fi
|
||||
rm -f tmp.config.dbghelp
|
||||
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
|
||||
#include <cxxabi.h>
|
||||
int main() {
|
||||
@@ -1667,13 +1686,15 @@ EOL
|
||||
return 0;
|
||||
}
|
||||
EOL
|
||||
if [ $? -ne 0 ]; then
|
||||
ret=$?
|
||||
rm -f tmp.config.demangle
|
||||
log 2 " exit code $ret"
|
||||
if [ $ret -ne 0 ]; then
|
||||
log 1 "checking abi::__cxa_demangle... no"
|
||||
else
|
||||
log 1 "checking abi::__cxa_demangle... found"
|
||||
CFLAGS="$CFLAGS -DWITH_DEMANGLE"
|
||||
fi
|
||||
rm -f tmp.config.demangle
|
||||
fi
|
||||
|
||||
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
|
||||
|
Reference in New Issue
Block a user