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.
This commit is contained in:
Viktor Dukhovni
2016-05-07 07:02:09 +00:00
parent 9393d53538
commit 1017a594ef
5 changed files with 13 additions and 8 deletions

View File

@@ -99,18 +99,17 @@ if test "$with_openssl" != "no"; then
INCLUDE_openssl_crypto= INCLUDE_openssl_crypto=
LIB_openssl_crypto= LIB_openssl_crypto=
if test "$with_openssl_include" != ""; then if test "$with_openssl_include" != ""; then
INCLUDE_openssl_crypto="${with_openssl_include}" INCLUDE_openssl_crypto="-I${with_openssl_include}"
else else
INCLUDE_openssl_crypto="${with_openssl}/include" INCLUDE_openssl_crypto="-I${with_openssl}/include"
fi fi
if test "$with_openssl_lib" != ""; then if test "$with_openssl_lib" != ""; then
LIB_openssl_crypto="-L${with_openssl_lib}" LIB_openssl_crypto="-L${with_openssl_lib}"
elif test "${with_openssl}" != "/usr" -a -d "${with_openssl}/lib"; then 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 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}" LDFLAGS="${LIB_openssl_crypto} ${LDFLAGS}"
# XXX What about rpath? Yeah...
AC_CHECK_LIB([crypto], [OPENSSL_init], AC_CHECK_LIB([crypto], [OPENSSL_init],
[LIB_openssl_crypto="${LIB_openssl_crypto} -lcrypto"; openssl=yes], [openssl=no], []) [LIB_openssl_crypto="${LIB_openssl_crypto} -lcrypto"; openssl=yes], [openssl=no], [])
# These cases are just for static linking on older OSes, # 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], AC_CHECK_LIB([crypto], [OPENSSL_init],
[LIB_openssl_crypto="${LIB_openssl_crypto} -lcrypto -ldl -lnsl -lsocket"; openssl=yes], [openssl=no], [-ldl -lnsl -lsocket]) [LIB_openssl_crypto="${LIB_openssl_crypto} -lcrypto -ldl -lnsl -lsocket"; openssl=yes], [openssl=no], [-ldl -lnsl -lsocket])
fi fi
if test "$openssl" = "no"; then
INCLUDE_openssl_crypto=
LIB_openssl_crypto=
fi
CFLAGS="${saved_CFLAGS}" CFLAGS="${saved_CFLAGS}"
LDFLAGS="${saved_LDFLAGS}" LDFLAGS="${saved_LDFLAGS}"
fi fi

View File

@@ -2,7 +2,7 @@
include $(top_srcdir)/Makefile.am.common 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 lib_LTLIBRARIES = libkdc.la

View File

@@ -3,7 +3,7 @@
include $(top_srcdir)/Makefile.am.common include $(top_srcdir)/Makefile.am.common
if HAVE_HCRYPTO_W_OPENSSL if HAVE_HCRYPTO_W_OPENSSL
AM_CPPFLAGS += -I$(INCLUDE_openssl_crypto) AM_CPPFLAGS += $(INCLUDE_openssl_crypto)
endif endif
AM_CPPFLAGS += -I$(top_srcdir)/lib/hx509 \ AM_CPPFLAGS += -I$(top_srcdir)/lib/hx509 \

View File

@@ -1,5 +1,7 @@
include $(top_srcdir)/Makefile.am.common include $(top_srcdir)/Makefile.am.common
AM_CPPFLAGS += $(INCLUDE_openssl_crypto)
lib_LTLIBRARIES = libhx509.la lib_LTLIBRARIES = libhx509.la
libhx509_la_LDFLAGS = -version-info 5:0:0 libhx509_la_LDFLAGS = -version-info 5:0:0

View File

@@ -2,7 +2,7 @@
include $(top_srcdir)/Makefile.am.common 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 bin_PROGRAMS = verify_krb5_conf