-shared_modules="yes"
-dnl Some first-stage sanity checks.
-if test "$shared_modules" = yes; then
-
- if test "$CYGWIN" = yes; then
- AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
- shared_modules="no"
- fi
-
- dnl TenDRA's cc is called tcc too.
- if test "$CC" = tcc -a "$TenDRA" = "no"; then
- AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
- shared_modules="no"
- fi
-fi
-
-dnl Second stage: check for functions and headers.
-if test "$shared_modules" = yes; then
- DYNLINK_C=dynlink.c
- AC_CHECK_HEADERS(dlfcn.h)
- AC_SEARCH_LIBS(shl_load, dld,
- [
- AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
- SUFFIX=".sl"
- MOD_TARGET=hpux_shared
- SEDOBJ="s/\.o/.sl/g"
- ],
- dnl !shl_load:
- [
- dnl standard dlopen
- AC_SEARCH_LIBS(dlopen, [dl c_r],
- [
- AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
- SUFFIX=".so"
- MOD_TARGET=shared_modules
- SEDOBJ="s/\.o/.so/g"
- if test "$AppleGCC" = yes; then
- AC_CHECK_HEADERS([mach-o/dyld.h])
- fi
- AC_CHECK_FUNC(dlsym, ,
- [
- AC_MSG_WARN([dlsym is not available, shared modules disabled])
- shared_modules=no
- ])
- AC_CHECK_FUNCS(dlfunc)
- ],
- [
- shared_modules=no
- ])
- ])
-fi
-
-AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
-
-dnl Third stage - wrangling the linker.
-if test "$shared_modules" = yes; then
- # The GNU linker requires the -export-dynamic option to make
- # all symbols visible in the dynamic symbol table.
- hold_ldflags=$LDFLAGS
- AC_MSG_CHECKING(for the ld -export-dynamic flag)
- LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
- AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
- LDFLAGS=$hold_ldflags
-
- if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
- found="no, IRIX ld uses -B,dynamic"
- LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
- fi
-
- if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
- found="no, AIX ld uses -G -brtl"
- LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
- fi
-
- AC_MSG_RESULT($found)
-
- if test "$found" = yes; then
- LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
- fi
-
- AC_MSG_CHECKING(for compiler option to produce PIC)
- dnl The order should be here to check for groups of compilers,
- dnl then for odd compilers, then if no PICFLAGS were set up,
- dnl check for GCC and set defaults, or else error. -jmallett
- if test "$SGS" = "yes"; then
- AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
- PICFLAGS="-KPIC -DPIC -G"
- fi
-
- if test "$AppleGCC" = "yes"; then
- AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
- PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
- fi
- dnl Please note, that on HPUX two different stages of module compilation occurs, since
- dnl while compiling modules, the compiler does not allow you to give arguments
- dnl to the linker. (I did not design this)
- dnl So we need -c in the first stage of module compilation.
- dnl In the second stage, we link the modules via ld -b.
- dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
- dnl -TimeMr14C
- if test "$HPUX" = "yes" -a "$CC" != gcc; then
- AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
- PICFLAGS="+z -r -q -n -c"
- AC_MSG_CHECKING([if +ESfic is required on this platform])
-
- if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(yes)
- PICFLAGS="$PICFLAGS +ESfic"
- fi
-
- LDFLAGS="${LDFLAGS} -Wl,-E"
- fi
- if test "$Tru" = yes -a "$CC" != gcc; then
- AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
- PICFLAGS="-shared -expect_unresolved '*' "
- LDFLAGS="-call_shared"
- fi
- if test -z "$PICFLAGS"; then
- if test "$ac_cv_c_compiler_gnu" = "yes"; then
- AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
- PICFLAGS="-fPIC -DPIC -shared"
- else
- AC_MSG_RESULT(no)
- shared_modules=no
- fi
- fi
-fi
-
-# rpath, for finding libratbox.so at run time