Source: libpam-ssh
Version: 2.3+ds-9
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

libpam-ssh fails to cross build from source, because configure.ac uses 
AC_RUN_IFELSE without a cross compilation default in several occasions. 
These checks really cannot be run during cross compilation, so I'm 
proposing alternatives.

The first one is used to find the library. I propose degrading to 
AC_LINK_IFELSE for cross builds only. Native builds shall continue to 
use AC_RUN_IFELSE.

The second and third one verify that RSA works and that the openssl 
header version matches the shared library version respectively. These 
are sanity checks and I propose that we assume it success in cross 
compilation scenarios.

With these changes, libpam-ssh can be cross built and I'm attaching them 
as a patch for your convenience.

Helmut
--- libpam-ssh-2.3+ds.orig/configure.ac
+++ libpam-ssh-2.3+ds/configure.ac
@@ -120,7 +120,18 @@
 				found_crypto=1
 				break;
 			],[
-		],[])
+		        ],[
+				AC_LINK_IFELSE([AC_LANG_SOURCE([[
+#include <openssl/rand.h>
+int main(void)
+{
+	return(RAND_status() <= 0);
+}
+				]])],[
+					found_crypto=1
+					break;
+				],[])
+			])
 
 		if test ! -z "$found_crypto" ; then
 			break;
@@ -191,9 +202,12 @@
 	return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
 }
 	]])],[
-		rsa_works=1
+		rsa_works=yes
 		break;
-	],[],[])
+	],[],[
+		rsa_works=cross
+		break;
+	])
 done
 LIBS="$saved_LIBS"
 
@@ -206,7 +220,7 @@
 		RSA_MSG="no"
 	else
 		if test -z "$WANTS_RSAREF" ; then
-			AC_MSG_RESULT(yes)
+			AC_MSG_RESULT($rsa_works)
 			RSA_MSG="yes"
 		else
 			RSA_MSG="yes (using RSAref)"
@@ -235,7 +249,9 @@
 		AC_MSG_RESULT(no)
 		AC_MSG_ERROR(Your OpenSSL headers do not match your library)
 	
-],[])
+	],[
+		AC_MSG_RESULT(cross)
+	])
 
 # Check for OpenSSL with EVP_aes_*ctr
 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])

Reply via email to