diff --git a/apps/Makefile.am b/apps/Makefile.am index d756e10..0547876 100644 --- a/apps/Makefile.am +++ b/apps/Makefile.am @@ -90,18 +90,28 @@ EXTRA_DIST += openssl.cnf EXTRA_DIST += x509v3.cnf install-exec-hook: - @mkdir -p "$(DESTDIR)/$(OPENSSLDIR)" - @for i in cert.pem openssl.cnf x509v3.cnf; do \ - if [ ! -f "$(DESTDIR)/$(OPENSSLDIR)/$i" ]; then \ - $(INSTALL) -m 644 "$(srcdir)/$$i" "$(DESTDIR)/$(OPENSSLDIR)/$$i"; \ + @if [ "@OPENSSLDIR@x" != "x" ]; then \ + OPENSSLDIR="$(DESTDIR)/@OPENSSLDIR@"; \ + else \ + OPENSSLDIR="$(DESTDIR)/$(sysconfdir)/ssl"; \ + fi; \ + mkdir -p "$$OPENSSLDIR/certs"; \ + for i in cert.pem openssl.cnf x509v3.cnf; do \ + if [ ! -f "$$OPENSSLDIR/$i" ]; then \ + $(INSTALL) -m 644 "$(srcdir)/$$i" "$$OPENSSLDIR/$$i"; \ else \ - echo " $(DESTDIR)/$(OPENSSLDIR)/$$i already exists, install will not overwrite"; \ + echo " $$OPENSSLDIR/$$i already exists, install will not overwrite"; \ fi \ done uninstall-local: - @for i in cert.pem openssl.cnf x509v3.cnf; do \ - if cmp -s "$(DESTDIR)/$(OPENSSLDIR)/$$i" "$(srcdir)/$$i"; then \ - rm -f "$(DESTDIR)/$(OPENSSLDIR)/$$i"; \ + @if [ "@OPENSSLDIR@x" != "x" ]; then \ + OPENSSLDIR="$(DESTDIR)/@OPENSSLDIR@"; \ + else \ + OPENSSLDIR="$(DESTDIR)/$(sysconfdir)/ssl"; \ + fi; \ + for i in cert.pem openssl.cnf x509v3.cnf; do \ + if cmp -s "$$OPENSSLDIR/$$i" "$(srcdir)/$$i"; then \ + rm -f "$$OPENSSLDIR/$$i"; \ fi \ done diff --git a/configure.ac b/configure.ac index 4f6fb38..43ef0cd 100644 --- a/configure.ac +++ b/configure.ac @@ -57,11 +57,10 @@ AC_CHECK_HEADERS([err.h]) AC_ARG_WITH([openssldir], AS_HELP_STRING([--with-openssldir], [Set the default openssl directory]), - OPENSSLDIR="$withval", - OPENSSLDIR="$sysconfdir/ssl" + OPENSSLDIR="$withval" + AC_SUBST(OPENSSLDIR) ) -AC_SUBST(OPENSSLDIR) -AC_DEFINE_UNQUOTED(OPENSSLDIR, "$OPENSSLDIR") +AM_CONDITIONAL([OPENSSLDIR_DEFINED], [test x$with_openssldir != x]) AC_ARG_ENABLE([extratests], AS_HELP_STRING([--enable-extratests], [Enable extra tests that may be unreliable on some platforms])) diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 4fba77b..f8c7108 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am @@ -20,6 +20,12 @@ libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM endif endif +if OPENSSLDIR_DEFINED +libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"@OPENSSLDIR@\" +else +libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"$(sysconfdir)/ssl\" +endif + noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la # compatibility functions that need to be built without optimizations