AC_REQUIRE([AC_CANONICAL_HOST])
# dolt, a replacement for libtool
# Josh Triplett <josh@freedesktop.org>
-AC_PATH_PROG(DOLT_BASH, bash)
+AC_PATH_PROG([DOLT_BASH], [bash])
AC_MSG_CHECKING([if dolt supports this host])
dolt_supported=yes
-if test x$DOLT_BASH = x; then
- dolt_supported=no
-fi
-if test x$GCC != xyes; then
- dolt_supported=no
-fi
-case $host in
-*-*-linux* \
-|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*)
- pic_options='-fPIC'
- ;;
-i?86-apple-darwin*)
- pic_options='-fno-common'
- ;;
-*)
- dolt_supported=no
- ;;
-esac
-if test x$dolt_supported = xno ; then
+AS_IF([test x$DOLT_BASH = x], [dolt_supported=no])
+AS_IF([test x$GCC != xyes], [dolt_supported=no])
+
+AS_CASE([$host],
+ [*-*-linux*|*-*-freebsd*], [pic_options='-fPIC'],
+ [*-apple-darwin*], [pic_options='-fno-common'],
+ [*mingw*|*nacl*], [pic_options='']
+ [*], [dolt_supported=no]
+)
+AS_IF([test x$dolt_supported = xno], [
AC_MSG_RESULT([no, falling back to libtool])
- LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
- LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
-else
+ LTCOMPILE='$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
+ LTCXXCOMPILE='$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
+ m4_pattern_allow([AM_V_lt])
+], [
AC_MSG_RESULT([yes, replacing libtool])
dnl Start writing out doltcompile.
args@<:@$objarg@:>@="$pic_object"
__DOLTCOMPILE__EOF__
cat <<__DOLTCOMPILE__EOF__ >>doltcompile
-"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
+ pic_options="$pic_options"
+ if test x\$passthrough = xtrue; then
+ pic_options=""
+ fi
+__DOLTCOMPILE__EOF__
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+"${args@<:@@@:>@}" $pic_options -DPIC || exit $?
__DOLTCOMPILE__EOF__
fi
tagok=false
for arg in "$[]@"; do
case "$arg" in
- --silent) : ;;
--mode=compile) modeok=true ;;
--tag=CC|--tag=CXX) tagok=true ;;
+ --tag=disable-static) tagok=true ;;
+ --tag=ASM|--tag=YASM) tagok=true; passthrough=true;;
+ --silent|--quiet) ;;
*) args@<:@${#args[@]}@:>@="$arg" ;;
esac
done
dnl Done writing out doltlibtool; substitute it for libtool.
chmod +x doltlibtool
LIBTOOL='$(top_builddir)/doltlibtool'
-fi
+
+DOLT_CLEANFILES="doltlibtool doltcompile"
+AC_SUBST(DOLT_CLEANFILES)
+])
AC_SUBST(LTCOMPILE)
AC_SUBST(LTCXXCOMPILE)
# end dolt