From d16e3759a8be930844e94003ba1068b9ea0a7dd8 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 8 Jan 2002 09:19:55 +0000 Subject: [PATCH] Patches to make OpenSSL compilable on MacOS/X. Submitted by Pier Fumagalli --- Configure | 2 +- Makefile.org | 11 +++++++++++ apps/s_time.c | 2 +- apps/speed.c | 4 ++-- crypto/asn1/a_gentm.c | 2 +- crypto/asn1/a_time.c | 2 +- crypto/asn1/a_utctm.c | 4 ++-- crypto/des/fcrypt.c | 2 +- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Configure b/Configure index 73b88bb7f0..d405b560a0 100755 --- a/Configure +++ b/Configure @@ -478,7 +478,7 @@ my %table=( ##### MacOS X (a.k.a. Rhapsody or Darwin) setup "rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", -"darwin-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown)::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", +"darwin-ppc-cc","cc:-O3 -D_DARWIN -DB_ENDIAN::-D_REENTRANT::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ##### Sony NEWS-OS 4.x "newsos4-gcc","gcc:-O -DB_ENDIAN -DNEWS4::(unknown):-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::", diff --git a/Makefile.org b/Makefile.org index 009caefdd7..d615e2bcf5 100644 --- a/Makefile.org +++ b/Makefile.org @@ -271,6 +271,17 @@ DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \ [ -n "$$my_ld" ] && \ $$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1 +# For Darwin AKA Mac OS/X (dyld) +do_darwin-shared: + libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \ + ( set -x ; ${CC} --verbose -dynamiclib -o lib$$i${SHLIB_EXT} \ + lib$$i.a $$libs -all_load -current_version ${SHLIB_MAJOR}.${SHLIB_MINOR} \ + -compatibility_version ${SHLIB_MAJOR}.`echo ${SHLIB_MINOR} | cut -d. -f1` \ + -install_name ${INSTALLTOP}/lib/lib$$i${SHLIB_EXT} ) || exit 1; \ + libs="$$libs -l`basename $$i${SHLIB_EXT} .dylib`"; \ + echo "" ; \ + done + # This assumes that GNU utilities are *not* used do_alpha-osf1-shared: if ${DETECT_GNU_LD}; then \ diff --git a/apps/s_time.c b/apps/s_time.c index 39fd3b8b4d..d84fe11a3a 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -82,7 +82,7 @@ #include "wintext.h" #endif -#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) +#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) || defined (_DARWIN) #define TIMES #endif diff --git a/apps/speed.c b/apps/speed.c index 29004700fc..a5148d28da 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -84,10 +84,10 @@ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) # define USE_TOD -#elif !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) +#elif !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) || defined(_DARWIN) # define TIMES #endif -#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE) && !defined(__NetBSD__) +#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE) && !defined(__NetBSD__) && !defined(_DARWIN) # define TIMEB #endif diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index 314479a03d..b55f882b76 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -203,7 +203,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, if (s == NULL) return(NULL); -#if defined(THREADS) && !defined(WIN32) +#if defined(THREADS) && !defined(WIN32) && ! defined(_DARWIN) gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */ ts=&data; #else diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index 8c0ddee4ac..17475e0f49 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -113,7 +113,7 @@ ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, unsigned char **pp, long length) ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t) { struct tm *ts; -#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) +#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) && !defined(_DARWIN) struct tm data; gmtime_r(&t,&data); diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index d381c9e0d1..3ae7432cb2 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -203,7 +203,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) if (s == NULL) return(NULL); -#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) +#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) && !defined(_DARWIN) gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */ ts=&data; #else @@ -286,7 +286,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) t -= offset*60; /* FIXME: may overflow in extreme cases */ -#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) +#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) && !defined(_DARWIN) { struct tm data; gmtime_r(&t, &data); tm = &data; } #else tm = gmtime(&t); diff --git a/crypto/des/fcrypt.c b/crypto/des/fcrypt.c index 1d619316fd..ad31543fe3 100644 --- a/crypto/des/fcrypt.c +++ b/crypto/des/fcrypt.c @@ -61,7 +61,7 @@ static unsigned const char cov_2char[64]={ void fcrypt_body(DES_LONG *out,des_key_schedule ks, DES_LONG Eswap0, DES_LONG Eswap1); -#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) +#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(_DARWIN) char *crypt(const char *buf, const char *salt) { return(des_crypt(buf, salt));