# Exported variables
_modld_list='EXTRAMODLDFLAGS MODLD MODLDFLAGS modules_build'

# EXTRADLLDFLAGS might refer to $LIBS
__LIBS=$LIBS
if test "$static" = n; then LIBS="$LIBS -L$libdir $LDDYN"; fi
case $osname in
cygwin|mingw) EXTRAMODLDFLAGS="-L$libdir $LDDYN -Wl,--enable-auto-import";;
*)      EXTRAMODLDFLAGS=`eval echo $EXTRADLLDFLAGS`;;
esac;
LIBS=$__LIBS

if test -n "$runpathprefix"; then
  runpth=`./ldflags "$LDneedsWl" $runpathprefix"$libdir"`
fi

case $osname in
darwin) MODLD=$CC;
        MODLDFLAGS="-bundle -undefined dynamic_lookup -L$libdir $LDDYN \$(CFLAGS) \$(DLCFLAGS)";;
*)      MODLD="$DLLD";
        MODLDFLAGS=`echo "$DLLDFLAGS" | \
   sed -e 's/,*-[^ \t-]*[ \t,=]*\\$(LIBPARI_SONAME)//' \
       -e 's/,--out-implib=\$(LIBPARI_SO)\$(_A)//'`;;
esac;

modules_build=`echo "$CC -c -o %s.o $CFLAGS $DLCFLAGS -I\"$includedir\" %s.c \
&& $MODLD -o %s.so $MODLDFLAGS %s.o $runpth $EXTRAMODLDFLAGS" | \
               sed -e 's!\$(CFLAGS)'"!$CFLAGS!g" \
                   -e 's!\$(DLCFLAGS)'"!$DLCFLAGS!g"`
