diff --git a/libc3/configure b/libc3/configure
index a42c417..0c4bc44 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -34,11 +34,11 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$LO_SOURCES")"
CPPFLAGS="${CPPFLAGS:=}"
ENV_CFLAGS="${CFLAGS:=}"
DEFAULT_CFLAGS="-O2 -pipe"
-LDFLAGS="${LDFLAGS:-}"
+LDFLAGS="--shared ${LDFLAGS:-}"
if [ "x$CC" != "xtcc" ]; then
LDFLAGS="-Wl,--allow-shlib-undefined ${LDFLAGS}"
fi
-LIBS="${LIBS} -lm -pthread"
+LIBS="${LIBS} -lm -pthread -rpath ${PREFIX}/lib"
# Common config for all targets
CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
@@ -107,19 +107,19 @@ echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "$LIB: $LIBTOMMATH $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} --rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "$LIB_ASAN: $LIBTOMMATH_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} --rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "$LIB_COV: $LIBTOMMATH_COV $OBJECTS_COV" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} --rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "$LIB_DEBUG: $LIBTOMMATH_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} --rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
for SRC in $SOURCES; do
echo >> ${CONFIG_MK}
diff --git a/libtommath b/libtommath
index 5e945ed..0fc5789 160000
--- a/libtommath
+++ b/libtommath
@@ -1 +1 @@
-Subproject commit 5e945ed8ddf9ef5b706529f37716c288297a6851
+Subproject commit 0fc578923d33e4838934acf7924581f7f6fec1cf
diff --git a/test/configure b/test/configure
index db2b3c8..c2addd4 100755
--- a/test/configure
+++ b/test/configure
@@ -79,7 +79,7 @@ if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
-LIBC3=../libc3/.libs/libc3.so
+LIBC3=../libc3/libc3.la
LIBS="$LIBC3 $LIBS"
echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}