Skip to content

Commit c19aa70

Browse files
committed
Fix contrib/pgcrypto to autoconfigure for OpenSSL when --with-openssl
is used in the toplevel configure. Per Marko Kreen.
1 parent d22a372 commit c19aa70

File tree

4 files changed

+34
-57
lines changed

4 files changed

+34
-57
lines changed

configure

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ ac_includes_default="\
314314
# include <unistd.h>
315315
#endif"
316316

317-
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configure_args build build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC CC_FOR_BUILD TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam with_bonjour with_openssl EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS'
317+
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configure_args build build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC CC_FOR_BUILD TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam with_bonjour with_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS'
318318
ac_subst_files=''
319319

320320
# Initialize some variables set by options.
@@ -3906,6 +3906,7 @@ else
39063906
fi;
39073907

39083908

3909+
39093910
#
39103911
# Elf
39113912
#
@@ -22916,6 +22917,7 @@ s,@krb_srvtab@,$krb_srvtab,;t t
2291622917
s,@with_pam@,$with_pam,;t t
2291722918
s,@with_bonjour@,$with_bonjour,;t t
2291822919
s,@with_openssl@,$with_openssl,;t t
22920+
s,@with_zlib@,$with_zlib,;t t
2291922921
s,@EGREP@,$EGREP,;t t
2292022922
s,@ELF_SYS@,$ELF_SYS,;t t
2292122923
s,@LDFLAGS_SL@,$LDFLAGS_SL,;t t

configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.415 2005/07/03 18:54:26 petere Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.416 2005/07/05 23:13:57 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -500,6 +500,7 @@ fi
500500
#
501501
PGAC_ARG_BOOL(with, zlib, yes,
502502
[ --without-zlib do not use Zlib])
503+
AC_SUBST(with_zlib)
503504

504505
#
505506
# Elf

contrib/pgcrypto/Makefile

Lines changed: 26 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,36 @@
11
#
2-
# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.14 2005/03/21 05:24:51 neilc Exp $
2+
# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.15 2005/07/05 23:13:57 tgl Exp $
33
#
44

5-
# either 'builtin', 'openssl'
6-
cryptolib = builtin
5+
# if you don't have OpenSSL, you can use libc random() or /dev/urandom
6+
INT_CFLAGS = -DRAND_SILLY
7+
#INT_CFLAGS = -DRAND_DEV=\"/dev/urandom\"
78

8-
# either 'builtin', 'system'
9-
cryptsrc = builtin
9+
INT_SRCS = md5.c sha1.c internal.c blf.c rijndael.c
1010

11-
# Random source, preferred order:
12-
# 'dev' - read from random device
13-
#
14-
# 'openssl' - use openssl PRNG.
15-
# Note that currently pgcrypto does not do any
16-
# entropy feeding to it
17-
# This works ofcouse only with cryptolib = openssl
18-
#
19-
# 'silly' - use libc random() - very weak
20-
random = silly
21-
random_dev = \"/dev/urandom\"
11+
OSSL_CFLAGS = -DRAND_OPENSSL
12+
OSSL_SRCS = openssl.c
13+
OSSL_TESTS = des 3des cast5
2214

23-
##########################
24-
25-
ifeq ($(cryptolib), builtin)
26-
CRYPTO_CFLAGS =
27-
CRYPTO_LDFLAGS =
28-
SRCS = md5.c sha1.c internal.c blf.c rijndael.c
29-
EXTRA_TESTS =
30-
endif
15+
CF_SRCS = $(if $(subst no,,$(with_openssl)), $(OSSL_SRCS), $(INT_SRCS))
16+
CF_TESTS = $(if $(subst no,,$(with_openssl)), $(OSSL_TESTS))
17+
CF_CFLAGS = $(if $(subst no,,$(with_openssl)), $(OSSL_CFLAGS), $(INT_CFLAGS))
3118

32-
ifeq ($(cryptolib), openssl)
33-
CRYPTO_CFLAGS = -I/usr/include/openssl
34-
CRYPTO_LDFLAGS = -lcrypto
35-
SRCS = openssl.c
36-
EXTRA_TESTS = des 3des cast5
37-
endif
19+
PG_CPPFLAGS := $(CF_CFLAGS) -I$(srcdir) $(PG_CPPFLAGS)
3820

39-
ifeq ($(cryptsrc), builtin)
40-
SRCS += crypt-blowfish.c crypt-des.c crypt-md5.c
41-
else
42-
CRYPTO_CFLAGS += -DPX_SYSTEM_CRYPT
43-
endif
44-
45-
ifeq ($(random), dev)
46-
CRYPTO_CFLAGS += -DRAND_DEV=$(random_dev)
47-
endif
48-
ifeq ($(random), openssl)
49-
CRYPTO_CFLAGS += -DRAND_OPENSSL
50-
endif
51-
ifeq ($(random), silly)
52-
CRYPTO_CFLAGS += -DRAND_SILLY
53-
endif
54-
55-
SRCS += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \
56-
crypt-gensalt.c random.c
21+
SRCS = pgcrypto.c px.c px-hmac.c px-crypt.c misc.c random.c \
22+
crypt-gensalt.c crypt-blowfish.c crypt-des.c \
23+
crypt-md5.c $(CF_SRCS)
5724

5825
MODULE_big = pgcrypto
5926
OBJS = $(SRCS:.c=.o)
6027
DOCS = README.pgcrypto
6128
DATA_built = pgcrypto.sql
6229
EXTRA_CLEAN = gen-rtab
6330

64-
PG_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(srcdir)
65-
SHLIB_LINK = $(CRYPTO_LDFLAGS)
66-
6731
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
68-
$(EXTRA_TESTS) \
69-
crypt-des crypt-md5 crypt-blowfish crypt-xdes
32+
$(CF_TESTS) \
33+
crypt-des crypt-md5 crypt-blowfish crypt-xdes
7034

7135

7236
ifdef USE_PGXS
@@ -79,6 +43,14 @@ include $(top_builddir)/src/Makefile.global
7943
include $(top_srcdir)/contrib/contrib-global.mk
8044
endif
8145

46+
# Add libraries that pgcrypto depends (or might depend) on into the
47+
# shared library link. (The order in which you list them here doesn't
48+
# matter.)
49+
SHLIB_LINK += $(filter -lcrypt -ldes -lcrypto -lssl, $(LIBS))
50+
ifeq ($(PORTNAME), win32)
51+
SHLIB_LINK += $(filter -leay32 -lssleay32, $(LIBS))
52+
endif
53+
8254
# to make ws2_32.lib the last library (must occur after definition of PORTNAME)
8355
ifeq ($(PORTNAME),win32)
8456
SHLIB_LINK += -lwsock32 -lws2_32
@@ -87,6 +59,6 @@ endif
8759

8860
rijndael.o: rijndael.tbl
8961

90-
rijndael.tbl:
62+
rijndael.tbl: rijndael.c
9163
$(CC) $(CPPFLAGS) $(CFLAGS) -DPRINT_TABS rijndael.c -o gen-rtab
9264
./gen-rtab > rijndael.tbl

src/Makefile.global.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.215 2005/07/03 18:54:28 petere Exp $
2+
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.216 2005/07/05 23:13:57 tgl Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -128,6 +128,8 @@ pgxsdir = $(pkglibdir)/pgxs
128128
with_perl = @with_perl@
129129
with_python = @with_python@
130130
with_tcl = @with_tcl@
131+
with_openssl = @with_openssl@
132+
with_zlib = @with_zlib@
131133
enable_shared = @enable_shared@
132134
enable_rpath = @enable_rpath@
133135
enable_nls = @enable_nls@

0 commit comments

Comments
 (0)