dl-fldigi/scripts/mkhamlibstatic.sh

43 wiersze
1.3 KiB
Bash
Czysty Zwykły widok Historia

2008-08-22 18:30:15 +00:00
#!/bin/sh
2008-08-30 03:02:24 +00:00
# This script must be run by make
2008-08-22 18:30:15 +00:00
2008-08-30 03:02:24 +00:00
set -e
2008-08-22 18:30:15 +00:00
if test "x$PKG_CONFIG" != "x"; then
hamlib_dir="$($PKG_CONFIG --variable=libdir hamlib)"
if test "x$hamlib_dir" = "x"; then
2008-08-30 03:02:24 +00:00
echo "E: Could not determine hamlib \$libdir" >&2
2008-08-22 18:30:15 +00:00
exit 1
fi
else
hamlib_dir="${HAMLIB_LIBS#*-L}"
hamlib_dir="${HAMLIB_LIBS%% *}"
if test "x$hamlib_dir" = "x"; then
hamlib_dir=/usr/lib
fi
fi
2008-09-05 19:02:47 +00:00
hamlib_libs="$hamlib_dir/hamlib-*.a"
2008-08-22 18:30:15 +00:00
case "$target_os" in
2008-08-30 03:02:24 +00:00
*linux*)
2008-09-05 19:02:47 +00:00
AM_LDFLAGS="$AM_LDFLAGS -Wl,--export-dynamic -Wl,--whole-archive $hamlib_libs -Wl,--no-whole-archive"
2008-08-30 03:02:24 +00:00
;;
*darwin*)
# Apple's ld isn't quite up to this task: there is no way to specify -all_load for
# only a subset of the libraries that we must link with. For this reason we resort
# to using the "dangerous" -m flag, which turns "multiply defined symbol" errors
# into warnings. This will probably not work for ppc64 and x86_64 universal binaries.
2008-09-05 19:02:47 +00:00
AM_LDFLAGS="$AM_LDFLAGS -Wl,-all_load -Wl,-m $hamlib_libs"
2008-08-30 03:02:24 +00:00
;;
*cygwin*)
2008-09-05 19:02:47 +00:00
AM_LDFLAGS="$AM_LDFLAGS -Wl,--export-all-symbols -Wl,--whole-archive $hamlib_libs -Wl,--no-whole-archive"
2008-08-30 03:02:24 +00:00
;;
*)
echo "E: This script does not support $target_os" >&2
exit 1
2008-08-22 18:30:15 +00:00
;;
esac
2008-08-30 03:02:24 +00:00
$CXX -o ${1}${EXEEXT} $AM_CXXFLAGS $CXXFLAGS $AM_LDFLAGS $LDFLAGS $fldigi_OBJECTS $fldigi_LDADD