+ }
+test -z "$with_shlib" && {
+echo $ac_n "checking for dld_init in -ldld""... $ac_c" 1>&6
+echo "configure:12036: checking for dld_init in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_init | sed 'y%./+-%__p_%'`
+
+xe_check_libs=" -ldld "
+cat > conftest.$ac_ext <<EOF
+#line 12041 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dld_init();
+
+int main() {
+dld_init()
+; return 0; }
+EOF
+if { (eval echo configure:12052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+xe_check_libs=""
+
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then
+ echo "$ac_t""yes" 1>&6
+ { test "$extra_verbose" = "yes" && cat << \EOF
+ Defining HAVE_DLD_INIT
+EOF
+cat >> confdefs.h <<\EOF
+#define HAVE_DLD_INIT 1
+EOF
+}
+ DLL_LIB=dld; with_shlib=yes
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ }
+if test "$with_shlib" = "yes"; then
+
+dll_ld=
+dll_ldflags=
+dll_cflags=
+dll_post=
+dll_ldo="-o"
+ld_dynamic_link_flags=
+xehost=$canonical
+xealias=$internal_configuration
+
+echo "checking how to build dynamic libraries for ${xehost}" 1>&6
+echo "configure:12091: checking how to build dynamic libraries for ${xehost}" >&5
+# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$xehost" in
+*-*-linux-gnu*) ;;
+*-*-linux*) xehost=`echo $xehost | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+xehost_cpu=`echo $xehost | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+xehost_vendor=`echo $xehost | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+xehost_os=`echo $xehost | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+case "$xehost_os" in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "${COLLECT_NAMES+set}" != set; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Now see if the compiler is really GCC.
+if test "$GCC" = "yes"; then
+ XEGCC=yes
+else
+ echo $ac_n "checking checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:12119: checking checking whether we are using GNU C" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 12121 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+ yes;
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ XEGCC=yes
+else
+ rm -rf conftest*
+ XEGCC=no
+fi
+rm -f conftest*
+
+ echo "$ac_t""${XEGCC}" 1>&6
+fi
+
+echo $ac_n "checking how to produce PIC code""... $ac_c" 1>&6
+echo "configure:12143: checking how to produce PIC code" >&5
+wl=
+
+can_build_shared=yes
+if test "$XEGCC" = yes; then
+ wl='-Wl,'
+
+ case "$xehost_os" in
+ aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
+ # PIC is the default for these OSes.
+ ;;
+
+ os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ dll_cflags='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ *)
+ dll_cflags='-fPIC'
+ ;;
+ esac
+else
+ # PORTME Check for PIC flags for the system compiler.
+ case "$xehost_os" in
+ hpux9* | hpux10*)
+ # Is there a better link_static_flag that works with the bundled CC?
+ wl='-Wl,'
+ dll_cflags='+Z'
+ ;;
+
+ irix5* | irix6*)
+ wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+
+ osf3* | osf4*)
+ # All OSF/1 code is PIC.
+ wl='-Wl,'
+ ;;
+
+ sco3.2v5*)
+ dll_cflags='-belf -Kpic'
+ wl='-Wl,'
+ ;;
+
+ unixware*)
+ dll_cflags="-KPIC"
+ wl="-Wl,"
+ ;;
+
+ sysv4*)
+ dll_cflags="-KPIC"
+ wl="-Wl,"
+ ;;
+
+ sysv5*)
+ dll_cflags="-KPIC"
+ wl="-Wl,"
+ ;;
+
+ solaris2*)
+ dll_cflags='-KPIC'
+ wl='-Wl,'
+ ;;
+
+ sunos4*)
+ dll_cflags='-PIC'
+ wl='-Qoption ld '
+ ;;
+
+ uts4*)
+ dll_cflags='-pic'
+ ;;
+
+ *)
+ can_build_shared=no
+ ;;
+ esac
+fi
+
+if test -n "$dll_cflags"; then
+ echo "$ac_t""${dll_cflags}" 1>&6
+
+ # Check to make sure the dll_cflags actually works.
+ echo $ac_n "checking if PIC flag ${dll_cflags} really works""... $ac_c" 1>&6
+echo "configure:12236: checking if PIC flag ${dll_cflags} really works" >&5
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $dll_cflags -DPIC"
+ cat > conftest.$ac_ext <<EOF
+#line 12240 "configure"
+#include "confdefs.h"
+
+int main() {
+int x=0;
+; return 0; }
+EOF
+if { (eval echo configure:12247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+
+ # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also
+ # reports no error. So, we need to grep stderr for (Bundled).
+ if grep '(Bundled)' config.log >/dev/null; then
+ echo "$ac_t""no" 1>&6
+ can_build_shared=no
+ dll_cflags=
+ else
+ echo "$ac_t""yes" 1>&6
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ can_build_shared=no
+ dll_cflags=
+fi
+rm -f conftest*
+ CFLAGS="$save_CFLAGS"
+else
+ echo "$ac_t""none" 1>&6
+fi
+
+if test "$can_build_shared" = "yes"; then
+cc_produces_so=no
+xldf=
+xcldf=
+echo $ac_n "checking if C compiler can produce shared libraries""... $ac_c" 1>&6
+echo "configure:12278: checking if C compiler can produce shared libraries" >&5
+if test "$XEGCC" = yes; then
+ xcldf="-shared"
+ xldf="-shared"
+else # Not using GCC
+ case "$xehost_os" in
+ aix3* | aix4*)
+ xldf="-bE:ELLSONAME.exp -H512 -T512 -bhalt:4 -bM:SRE -bnoentry -lc"
+ xcldf="${wl}-bE:ELLSONAME.exp ${wl}-H512 ${wl}-T512 ${wl}-bhalt:4 ${wl}-bM:SRE ${wl}-bnoentry ${wl}-lc"
+ ;;
+
+ freebsd2* | netbsd* | openbsd*)
+ xldf="-Bshareable"
+ xcldf="${wl}-Bshareable"
+ ;;
+
+ freebsd3*)
+ xcldf="-shared"
+ ;;