# HG changeset patch # User Andre McCurdy # Date 1474053503 25200 # Node ID 96a282e7808564dd699ecc6ba999398e1ac58ace # Parent 2535ea9d0a6fb85566699a8b1fe7c86c66aeee92 Fix libtomcrypt/libtommath linking order To prevent build failures when using system libtom libraries and linking with --as-needed, LIBTOM_LIBS should be in the order -ltomcrypt -ltommath, not the other way around, ie libs should be prepended to LIBTOM_LIBS as they are found, not appended. Signed-off-by: Andre McCurdy diff -r 2535ea9d0a6f -r 96a282e78085 configure.ac --- a/configure.ac Thu Sep 15 21:43:57 2016 +0800 +++ b/configure.ac Fri Sep 16 12:18:23 2016 -0700 @@ -388,16 +388,16 @@ AC_MSG_NOTICE(Forcing bundled libtom*) else BUNDLED_LIBTOM=0 - AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", + AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="-ltommath $LIBTOM_LIBS", [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] ) - AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", + AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="-ltomcrypt $LIBTOM_LIBS", [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] ) fi ], [ BUNDLED_LIBTOM=0 - AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", BUNDLED_LIBTOM=1) - AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", BUNDLED_LIBTOM=1) + AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="-ltommath $LIBTOM_LIBS", BUNDLED_LIBTOM=1) + AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="-ltomcrypt $LIBTOM_LIBS", BUNDLED_LIBTOM=1) ] )