I think the enclosed patch takes care of your concerns. This version makes openssl_prefix prevail over pkg_config where there are differences. Other changes in this version:
* I've updated to CVS as of a few minutes ago. * I've made pkg_config test both for OpenSSL and also for its version; it will go with the default if the version is not >= 0.9.7 * I've commented to make the nesting of macros and shell code a bit clearer
I've tested default, --with-openssl-prefix, and the pkg-config versions, and everything seems to go through configure cleanly, and create reasonable looking Makefiles.
Getting everything to build right now is a bit of a problem, since make is dying in src/common/etc since some recent check-ins into that directory (I'm guessing that a file called src/common/etc/bp/bp.xml.in is required, but has not been checked into CVS yet). But as near as I can tell, as soon as build works without my changes, it will also work *with* my changes :-)
Tell me if there's anything else to change, but I'd guess that things will work the way you want now.
Cheers, Rob
Michael Bell wrote:
Rob Thorne wrote:
Michael Bell wrote:
Sorry but this is not really correct. Many people use old distributions with packaged OpenSSL 0.9.6 and manually compiled and installed OpenSSL 0.9.7 in /usr/local/ssl/. If you only test for the presence of an OpenSSL which was configured by pkg-config then you cannot build OpenCA because OpenCA requires OpenSSL 0.9.7. openssl-prefix must override pkg-config.
This is an easy change for me to make. It's important to point out, however, that openssl-prefix does not really do what you need it to do: it assumes that OpenSSL links in a very simple way. The reason we broke on RedHat was that specifying the prefix was not enough; the needed flags for a copy of OpenSSL that links Kerberos doesn't fit into your current script.
What you really want is to make it possible to specifiy the CFLAG and LIBS options for linking OpenSSL. This would also solve the general problem.
Ok, next try. What we need is a patch which implement the following order:
1. --with-openssl-prefix 2. PKG_CONFIG 3. nothing specified --> activation of -lssl etc.
If you think that this is correct can you involve this into your patch? I think you have only to replace
AC_MSG_WARN( [Unable to find headers for openssl])
with
openssl_cflags= openssl_libs=-lcrypto -lssl openssl_setup=yes
Do you think this would solve the problems?
The moving of the openssl references makes the makefiles nicer. So it is ok. Why do you want to run aclocal before autoconf at toplevel?
The call to aclocal is actually necessary. aclocal will make sure that any macro that the autotools know about will be correctly expanded. Try adding a new macro to the top level configure.in. You'll see that it is not expanded correctly unless you make that initial call to aclocal.
Accepted.
I wait for the new patch. If possible then please include the CHANGES for openssl_cflags and openssl_libs too. After this we should support all standard behaviours.
Michael
Index: Makefile.devel =================================================================== RCS file: /cvsroot/openca/openca-0.9/Makefile.devel,v retrieving revision 1.8 diff -r1.8 Makefile.devel 76a77 > aclocal ##Pick up any changed autoconf macros Index: configure.in =================================================================== RCS file: /cvsroot/openca/openca-0.9/configure.in,v retrieving revision 1.157 diff -r1.157 configure.in 75a76 > 76a78,82 > dnl If this is not specified, configure will try to use > dnl pkg-config if it is found, and openssl.pic is found > dnl on the user's system for openssl v. 0.9.7 or greater. > dnl If not specified and pkg-config information is not > dnl available, we try reasonable defaults. 401a408,470 > > ### Setup for OpenSSL build flags ### > dnl Now we like the version of openssl. Let's construct > dnl the build flags for using it. If we find pkg-config > dnl on the system and openssl uses it, we will take > dnl our settings from there. If not, we'll make > dnl our best guess from what we do know. > > dnl Defaults > openssl_cflags= > openssl_libs="-lcrypto -lssl" > > dnl Now see if the user specified openssl_prefix > if [[ x${openssl_prefix} != x ]]; then > openssl_cflags=[-I${openssl_prefix}/include] > openssl_libs=["-L${openssl_prefix}/lib -L${openssl_prefix} -lcrypto -lssl"] > openssl_setup=yes > AC_MSG_RESULT( [User specified --with-openssl-prefix]) > dnl Check if the developer has the pkg-config macros > dnl for the autotools on their system > ifdef([PKG_CHECK_MODULES], > [ > else dnl else of prefix... > dnl If so, we can check if the target system has > dnl (1) pkg-config support installed as well, and > dnl (2) has openssl 0.9.7 or greater installed > AC_CHECK_PROG( HAS_PKGCONF, pkg-config, yes, [] , $PATH) > if [[ x${HAS_PKGCONF} != x ]]; then > PKG_CHECK_MODULES( OPENSSL,openssl >= 0.9.7, [ > AC_MSG_RESULT( > [openssl 0.9.7 or greater found via pkgconfig] > ) > openssl_cflags=$OPENSSL_CFLAGS > openssl_libs=$OPENSSL_LIBS > openssl_setup=yes > fi > ], > [ > AC_MSG_RESULT( [good openssl not found via pkgconfig]) > ] > ) dnl End of PKG_CHECK macro > > ], > [ > ## Skipping pkg-config macros... > ] > )dnl End of check using pkg-config... > > fi dnl End of prefix block > > > if [[ x${openssl_setup} != xyes ]]; then > AC_MSG_RESULT( [Assuming reasonable defaults for openssl...]) > openssl_setup=yes > fi > > dnl Export our openssl build settings > AC_SUBST(openssl_cflags) > AC_SUBST(openssl_libs) > > ## End of OpenSSL build settings section ## > > Index: src/musclecard-engine/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/musclecard-engine/Makefile.am,v retrieving revision 1.1 diff -r1.1 Makefile.am 30a31,32 > openssl_libs = @openssl_libs@ > openssl_cflags = @openssl_cflags@ Index: src/musclecard-engine/src/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/musclecard-engine/src/Makefile.am,v retrieving revision 1.1 diff -r1.1 Makefile.am 7c7,9 < OPENSSL_PREFIX = @openssl_prefix@ --- > #OPENSSL_PREFIX = @openssl_prefix@ > OPENSSL_INCLUDE = @openssl_cflags@ > OPENSSL_LIBS = @openssl_libs@ 14,23d15 < < < if OPENSSL_PREFIX < OPENSSL_INCLUDE_LIBS = -L$(OPENSSL_PREFIX)/lib -L$(OPENSSL_PREFIX) < OPENSSL_INCLUDE = -I$(OPENSSL_PREFIX)/include < OPENSSL_LIBS = -lcrypto -lssl < else < OPENSSL_INCLUDE_LIBS = < OPENSSL_LIBS = -lcrypto -lssl < endif Index: src/ocspd/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/ocspd/Makefile.am,v retrieving revision 1.2 diff -r1.2 Makefile.am 30a31,32 > openssl_libs = @openssl_libs@ > openssl_cflags = @openssl_cflags@ Index: src/ocspd/configure.in =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/ocspd/configure.in,v retrieving revision 1.4 diff -r1.4 configure.in 126a127,187 > ### Setup for OpenSSL build flags ### > dnl Now we like the version of openssl. Let's construct > dnl the build flags for using it. If we find pkg-config > dnl on the system and openssl uses it, we will take > dnl our settings from there. If not, we'll make > dnl our best guess from what we do know. > > dnl Defaults > openssl_cflags= > openssl_libs="-lcrypto -lssl" > > dnl Now see if the user specified openssl_prefix > if [[ x${openssl_prefix} != x ]]; then > openssl_cflags=[-I${openssl_prefix}/include] > openssl_libs=["-L${openssl_prefix}/lib -L${openssl_prefix} -lcrypto -lssl"] > openssl_setup=yes > AC_MSG_RESULT( [User specified --with-openssl-prefix]) > dnl Check if the developer has the pkg-config macros > dnl for the autotools on their system > ifdef([PKG_CHECK_MODULES], > [ > else dnl else of prefix... > dnl If so, we can check if the target system has > dnl (1) pkg-config support installed as well, and > dnl (2) has openssl 0.9.7 or greater installed > AC_CHECK_PROG( HAS_PKGCONF, pkg-config, yes, [] , $PATH) > if [[ x${HAS_PKGCONF} != x ]]; then > PKG_CHECK_MODULES( OPENSSL,openssl >= 0.9.7, [ > AC_MSG_RESULT( > [openssl 0.9.7 or greater found via pkgconfig] > ) > openssl_cflags=$OPENSSL_CFLAGS > openssl_libs=$OPENSSL_LIBS > openssl_setup=yes > fi > ], > [ > AC_MSG_RESULT( [good openssl not found via pkgconfig]) > ] > ) dnl End of PKG_CHECK macro > > ], > [ > ## Skipping pkg-config macros... > ] > )dnl End of check using pkg-config... > > fi dnl End of prefix block > > > if [[ x${openssl_setup} != xyes ]]; then > AC_MSG_RESULT( [Assuming reasonable defaults for openssl...]) > openssl_setup=yes > fi > > dnl Export our openssl build settings > AC_SUBST(openssl_cflags) > AC_SUBST(openssl_libs) > > ## End of OpenSSL build settings section ## > Index: src/ocspd/src/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/ocspd/src/Makefile.am,v retrieving revision 1.5 diff -r1.5 Makefile.am 7a8,9 > OPENSSL_INCLUDE = @openssl_cflags@ > OPENSSL_LIBS = @openssl_libs@ 10,17d11 < if OPENSSL_PREFIX < OPENSSL_INCLUDE_LIBS = -L$(OPENSSL_PREFIX)/lib -L$(OPENSSL_PREFIX) < OPENSSL_INCLUDE = -I$(OPENSSL_PREFIX)/include < OPENSSL_LIBS = -lcrypto -lssl < else < OPENSSL_INCLUDE_LIBS = < OPENSSL_LIBS = -lcrypto -lssl < endif Index: src/openca-sv/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/openca-sv/Makefile.am,v retrieving revision 1.1 diff -r1.1 Makefile.am 30a31,33 > openssl_libs = @openssl_libs@ > openssl_cflags = @openssl_cflags@ > Index: src/openca-sv/configure.in =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/openca-sv/configure.in,v retrieving revision 1.3 diff -r1.3 configure.in 105a106 > dnl This section may no longer be necessary... 113a115,176 > > ### Setup for OpenSSL build flags ### > dnl Now we like the version of openssl. Let's construct > dnl the build flags for using it. If we find pkg-config > dnl on the system and openssl uses it, we will take > dnl our settings from there. If not, we'll make > dnl our best guess from what we do know. > > dnl Defaults > openssl_cflags= > openssl_libs="-lcrypto -lssl" > > dnl Now see if the user specified openssl_prefix > if [[ x${openssl_prefix} != x ]]; then > openssl_cflags=[-I${openssl_prefix}/include] > openssl_libs=["-L${openssl_prefix}/lib -L${openssl_prefix} -lcrypto -lssl"] > openssl_setup=yes > AC_MSG_RESULT( [User specified --with-openssl-prefix]) > dnl Check if the developer has the pkg-config macros > dnl for the autotools on their system > ifdef([PKG_CHECK_MODULES], > [ > else dnl else of prefix... > dnl If so, we can check if the target system has > dnl (1) pkg-config support installed as well, and > dnl (2) has openssl 0.9.7 or greater installed > AC_CHECK_PROG( HAS_PKGCONF, pkg-config, yes, [] , $PATH) > if [[ x${HAS_PKGCONF} != x ]]; then > PKG_CHECK_MODULES( OPENSSL,openssl >= 0.9.7, [ > AC_MSG_RESULT( > [openssl 0.9.7 or greater found via pkgconfig] > ) > openssl_cflags=$OPENSSL_CFLAGS > openssl_libs=$OPENSSL_LIBS > openssl_setup=yes > fi > ], > [ > AC_MSG_RESULT( [good openssl not found via pkgconfig]) > ] > ) dnl End of PKG_CHECK macro > > ], > [ > ## Skipping pkg-config macros... > ] > )dnl End of check using pkg-config... > > fi dnl End of prefix block > > > if [[ x${openssl_setup} != xyes ]]; then > AC_MSG_RESULT( [Assuming reasonable defaults for openssl...]) > openssl_setup=yes > fi > > dnl Export our openssl build settings > AC_SUBST(openssl_cflags) > AC_SUBST(openssl_libs) > > ## End of OpenSSL build settings section ## > Index: src/openca-sv/src/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/openca-sv/src/Makefile.am,v retrieving revision 1.5 diff -r1.5 Makefile.am 8,11c8,10 < if OPENSSL_PREFIX < OPENSSL_INCLUDE_LIBS = [EMAIL PROTECTED]@/lib [EMAIL PROTECTED]@ < OPENSSL_INCLUDES = [EMAIL PROTECTED]@/include < endif --- > OPENSSL_INCLUDE = @openssl_cflags@ > OPENSSL_LIBS = @openssl_libs@ > 42c41 < OPENSSL_LIBS = -lcrypto --- > #OPENSSL_LIBS = -lcrypto Index: src/scep/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/scep/Makefile.am,v retrieving revision 1.1 diff -r1.1 Makefile.am 30a31,32 > openssl_libs = @openssl_libs@ > openssl_cflags = @openssl_cflags@ Index: src/scep/src/Makefile.am =================================================================== RCS file: /cvsroot/openca/openca-0.9/src/scep/src/Makefile.am,v retrieving revision 1.11 diff -r1.11 Makefile.am 7a8,9 > OPENSSL_INCLUDE = @openssl_cflags@ > OPENSSL_LIBS = @openssl_libs@ 16,23d17 < if OPENSSL_PREFIX < OPENSSL_INCLUDE_LIBS = -L$(OPENSSL_PREFIX)/lib -L$(OPENSSL_PREFIX) < OPENSSL_INCLUDE = -I$(OPENSSL_PREFIX)/include < OPENSSL_LIBS = -lcrypto -lssl -ldl -ll < else < OPENSSL_INCLUDE_LIBS = < OPENSSL_LIBS = -lcrypto -lssl < endif