Browse code

configure.ac: fix polarssl autodetection

A missing , in the previous configure.ac patch caused the autodetection to
fail. While fixing that, I noticed I can simplify the check by using the
documented ${ac_cv_search_function} cache variable instead of the nested
AC_SEARCH_LIBS.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1453150181-21453-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11010
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Steffan Karger authored on 2016/01/19 05:49:40
Showing 1 changed files
... ...
@@ -832,30 +832,28 @@ elif test "${with_crypto_library}" = "polarssl"; then
832 832
 	AC_ARG_VAR([POLARSSL_CFLAGS], [C compiler flags for polarssl])
833 833
 	AC_ARG_VAR([POLARSSL_LIBS], [linker flags for polarssl])
834 834
 
835
+	saved_CFLAGS="${CFLAGS}"
836
+	saved_LIBS="${LIBS}"
837
+
835 838
 	if test -z "${POLARSSL_CFLAGS}" -a -z "${POLARSSL_LIBS}"; then
836 839
         # if the user did not explicitly specify flags, try to autodetect
837 840
 		AC_SEARCH_LIBS(
838 841
 			[ssl_init],
839
-			[mbedtls],
840
-			[POLARSSL_LIBS=-lmbedtls]
842
+			[mbedtls polarssl],
841 843
 			[
842
-				AC_SEARCH_LIBS(
843
-					[ssl_init],
844
-					[polarssl],
845
-					[POLARSSL_LIBS=-lpolarssl]
846
-					[],
847
-					[${PKCS11_HELPER_LIBS}]
848
-				)
844
+				if test "${ac_cv_search_ssl_init}" != "none required"; then
845
+					POLARSSL_LIBS=${ac_cv_search_ssl_init}
846
+				fi
849 847
 			],
848
+			[AC_MSG_ERROR([Could not find PolarSSL/mbed TLS.])],
850 849
 			[${PKCS11_HELPER_LIBS}]
851 850
 		)
852 851
 	fi
853 852
 
854
-	AC_MSG_CHECKING([polarssl version])
855
-	saved_CFLAGS="${CFLAGS}"
856
-	saved_LIBS="${LIBS}"
857 853
 	CFLAGS="${POLARSSL_CFLAGS} ${PKCS11_HELPER_CFLAGS} ${CFLAGS}"
858 854
 	LIBS="${POLARSSL_LIBS} ${PKCS11_HELPER_LIBS} ${LIBS}"
855
+
856
+	AC_MSG_CHECKING([polarssl version])
859 857
 	AC_COMPILE_IFELSE(
860 858
 		[AC_LANG_PROGRAM(
861 859
 			[[