[Patch] Improve diags for "OpenSSL headers match library"configure test

Darren Tucker dtucker at zip.com.au
Sat Jul 27 15:38:47 EST 2002


Tim Rice wrote:
> I think I remember the autoconf docs recomending against using printf()
> in tests. Look at the test in the --with-default-path section for
> how you might do it differently.

I did a quick search of the autoconf docs and the only thing I was able
to find was
http://www.gnu.org/manual/autoconf/html_node/Guidelines.html which says
"Test programs should not write anything to the standard output." There
doesn't seem to be a prohibition on stderr.

Interestingly, it also says "Test programs should exit, not return, from
main, because on some systems (old Suns, at least) the argument to
return in main is ignored." There are 5 instances of return() instead of
exit(), including this OpenSSL test.

I also looked at the --with-default-path handling. It seems to be that
way because the output needs to be used later by configure. Failing the
OpenSSL check is fatal, and the object here is to capture some data for
later diagnosis. Writing to stderr is logged, so I don't think the added
complexity is needed.

With all that in mind, what about this patch? It only writes to stderr
and the output only appears in config.log.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG Fingerprint D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /cvs/openssh/configure.ac,v
retrieving revision 1.84
diff -u -r1.84 configure.ac
--- configure.ac	23 Jul 2002 00:00:06 -0000	1.84
+++ configure.ac	27 Jul 2002 05:36:15 -0000
@@ -769,9 +769,13 @@
 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
 AC_TRY_RUN(
 	[
+#include <stdio.h>
 #include <string.h>
 #include <openssl/opensslv.h>
-int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
+int main(void) {
+	fprintf(stderr,"OpenSSL library %x headers %x\n", SSLeay(), OPENSSL_VERSION_NUMBER);
+	exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); 
+}
 	],
 	[
 		AC_MSG_RESULT(yes)


More information about the openssh-unix-dev mailing list