From 1017a594ef126f1247b5515b80f7a5ef9db0ce67 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Sat, 7 May 2016 07:02:09 +0000 Subject: [PATCH] Use OpenSSL include path as needed For consistency make "-I" part of the macro value set by autoconf. For now, don't attempt to handle OpenSSL rpath in cf/crypto.m4. That's much easier by just setting LDFLAGS when running configure. Otherwise too many Makefiles to edit and libtool and automake do their best to undo the rpath. --- cf/crypto.m4 | 13 ++++++++----- kdc/Makefile.am | 2 +- lib/hcrypto/Makefile.am | 2 +- lib/hx509/Makefile.am | 2 ++ lib/krb5/Makefile.am | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cf/crypto.m4 b/cf/crypto.m4 index c6f72561e..b8b011dd1 100644 --- a/cf/crypto.m4 +++ b/cf/crypto.m4 @@ -99,18 +99,17 @@ if test "$with_openssl" != "no"; then INCLUDE_openssl_crypto= LIB_openssl_crypto= if test "$with_openssl_include" != ""; then - INCLUDE_openssl_crypto="${with_openssl_include}" + INCLUDE_openssl_crypto="-I${with_openssl_include}" else - INCLUDE_openssl_crypto="${with_openssl}/include" + INCLUDE_openssl_crypto="-I${with_openssl}/include" fi if test "$with_openssl_lib" != ""; then LIB_openssl_crypto="-L${with_openssl_lib}" elif test "${with_openssl}" != "/usr" -a -d "${with_openssl}/lib"; then - LIB_openssl_crypto="-L${with_openssl}/lib -Wl,-R,${with_openssl}/lib" + LIB_openssl_crypto="-L${with_openssl}/lib" fi - CFLAGS="-DHAVE_HCRYPTO_W_OPENSSL -I${INCLUDE_openssl_crypto} ${CFLAGS}" + CFLAGS="-DHAVE_HCRYPTO_W_OPENSSL ${INCLUDE_openssl_crypto} ${CFLAGS}" LDFLAGS="${LIB_openssl_crypto} ${LDFLAGS}" - # XXX What about rpath? Yeah... AC_CHECK_LIB([crypto], [OPENSSL_init], [LIB_openssl_crypto="${LIB_openssl_crypto} -lcrypto"; openssl=yes], [openssl=no], []) # These cases are just for static linking on older OSes, @@ -127,6 +126,10 @@ if test "$with_openssl" != "no"; then AC_CHECK_LIB([crypto], [OPENSSL_init], [LIB_openssl_crypto="${LIB_openssl_crypto} -lcrypto -ldl -lnsl -lsocket"; openssl=yes], [openssl=no], [-ldl -lnsl -lsocket]) fi + if test "$openssl" = "no"; then + INCLUDE_openssl_crypto= + LIB_openssl_crypto= + fi CFLAGS="${saved_CFLAGS}" LDFLAGS="${saved_LDFLAGS}" fi diff --git a/kdc/Makefile.am b/kdc/Makefile.am index ade443ffb..e2a7b14d6 100644 --- a/kdc/Makefile.am +++ b/kdc/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.am.common -AM_CPPFLAGS += $(INCLUDE_libintl) -I$(srcdir)/../lib/krb5 +AM_CPPFLAGS += $(INCLUDE_libintl) $(INCLUDE_openssl_crypto) -I$(srcdir)/../lib/krb5 lib_LTLIBRARIES = libkdc.la diff --git a/lib/hcrypto/Makefile.am b/lib/hcrypto/Makefile.am index 6ef5cf9a4..05df273a0 100644 --- a/lib/hcrypto/Makefile.am +++ b/lib/hcrypto/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.am.common if HAVE_HCRYPTO_W_OPENSSL -AM_CPPFLAGS += -I$(INCLUDE_openssl_crypto) +AM_CPPFLAGS += $(INCLUDE_openssl_crypto) endif AM_CPPFLAGS += -I$(top_srcdir)/lib/hx509 \ diff --git a/lib/hx509/Makefile.am b/lib/hx509/Makefile.am index 24c21eaf6..d1a00bd49 100644 --- a/lib/hx509/Makefile.am +++ b/lib/hx509/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/Makefile.am.common +AM_CPPFLAGS += $(INCLUDE_openssl_crypto) + lib_LTLIBRARIES = libhx509.la libhx509_la_LDFLAGS = -version-info 5:0:0 diff --git a/lib/krb5/Makefile.am b/lib/krb5/Makefile.am index 57ee89a74..c462d9372 100644 --- a/lib/krb5/Makefile.am +++ b/lib/krb5/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.am.common -AM_CPPFLAGS += -I../com_err -I$(srcdir)/../com_err $(INCLUDE_sqlite3) $(INCLUDE_libintl) +AM_CPPFLAGS += -I../com_err -I$(srcdir)/../com_err $(INCLUDE_sqlite3) $(INCLUDE_libintl) $(INCLUDE_openssl_crypto) bin_PROGRAMS = verify_krb5_conf