- Linking shared libraries needs slightly different options. - We were trying to detect mach_time.h but needed to detect mach/mach_time.h instead. While we're here, add a --disable-shared option to ./configure, which is different from --enable-static. --disable-shared does not build *new* share libraries, but doesn't pass -static to the linker (apparently there is no static linking posible on MacOS).
43 lines
928 B
Text
43 lines
928 B
Text
. ./redoconf.rc
|
|
rc_include rc/CC.rc
|
|
|
|
prog='
|
|
#include <stdlib.h>
|
|
void f() { atoi(""); }
|
|
'
|
|
|
|
try_unix_style() {
|
|
(
|
|
appendln CFLAGS "-fPIC"
|
|
appendln LDFLAGS "-shared"
|
|
appendln LDFLAGS "-Wl,-soname,x.so"
|
|
RCC_NO_MAIN=1 rc_compile cc link "$prog"
|
|
)
|
|
}
|
|
|
|
try_macos_style() {
|
|
(
|
|
appendln CFLAGS "-fPIC"
|
|
appendln LDFLAGS "-dynamiclib"
|
|
appendln LDFLAGS "-current_version"
|
|
appendln LDFLAGS "1.0"
|
|
RCC_NO_MAIN=1 rc_compile cc link "$prog"
|
|
)
|
|
}
|
|
|
|
if [ -n "$STATIC" ]; then
|
|
echo "--enable-static specified; not building shared libraries." >&2
|
|
rc_replaceln HAVE_SHLIB ""
|
|
elif [ -n "$NOSHARED" ]; then
|
|
echo "--disable-shared specified; not building shared libraries." >&2
|
|
rc_replaceln HAVE_SHLIB ""
|
|
elif try_unix_style; then
|
|
rc_replaceln HAVE_SHLIB UNIX
|
|
elif try_macos_style; then
|
|
rc_replaceln HAVE_SHLIB MACOS
|
|
else
|
|
echo "Not building shared libraries on this platform." >&2
|
|
rc_undo
|
|
rc_replaceln HAVE_SHLIB ""
|
|
fi
|
|
rc_save
|