{
$withargs{"krb5-".$1}=$2;
}
+ elsif (/^--with-zlib-lib=(.*)$/)
+ {
+ $withargs{"zlib-lib"}=$1;
+ }
+ elsif (/^--with-zlib-include=(.*)$/)
+ {
+ $withargs{"zlib-include"}="-I$1";
+ }
else
{
print STDERR $usage;
s/^PERL=.*/PERL= $perl/;
s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
+ s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
+ s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
*/
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h>
-
-# define Z_CALLCONV _stdcall
-# ifndef ZLIB_SHARED
-# define ZLIB_SHARED
-# endif
-#else
-# define Z_CALLCONV
#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */
#ifdef ZLIB_SHARED
#include <openssl/dso.h>
-/* Prototypes for built in stubs */
-static int stub_compress(Bytef *dest,uLongf *destLen,
- const Bytef *source, uLong sourceLen);
-static int stub_inflateEnd(z_streamp strm);
-static int stub_inflate(z_streamp strm, int flush);
-static int stub_inflateInit_(z_streamp strm, const char * version,
- int stream_size);
-
/* Function pointers */
-typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen,
+typedef int (*compress_ft)(Bytef *dest,uLongf *destLen,
const Bytef *source, uLong sourceLen);
-typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm);
-typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush);
-typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm,
+typedef int (*inflateEnd_ft)(z_streamp strm);
+typedef int (*inflate_ft)(z_streamp strm, int flush);
+typedef int (*inflateInit__ft)(z_streamp strm,
const char * version, int stream_size);
static compress_ft p_compress=NULL;
static inflateEnd_ft p_inflateEnd=NULL;
static int zlib_loaded = 0; /* only attempt to init func pts once */
static DSO *zlib_dso = NULL;
-#define compress stub_compress
-#define inflateEnd stub_inflateEnd
-#define inflate stub_inflate
-#define inflateInit_ stub_inflateInit_
+#define compress p_compress
+#define inflateEnd p_inflateEnd
+#define inflate p_inflate
+#define inflateInit_ p_inflateInit_
#endif /* ZLIB_SHARED */
static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
{
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
- if (!zlib_dso)
- {
- zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0);
- if (zlib_dso)
- {
- /* Clear the errors from the first failed
- DSO_load() */
- ERR_clear_error();
- }
- }
#else
zlib_dso = DSO_load(NULL, "z", NULL, 0);
#endif
p_inflateInit_
= (inflateInit__ft) DSO_bind_func(zlib_dso,
"inflateInit_");
- zlib_loaded++;
+
+ if (p_compress && p_inflateEnd && p_inflate
+ && p_inflateInit_)
+ zlib_loaded++;
}
}
#endif
+#ifdef ZLIB_SHARED
+ if (zlib_loaded)
+#endif
#if defined(ZLIB) || defined(ZLIB_SHARED)
- meth = &zlib_method;
+ meth = &zlib_method;
#endif
return(meth);
}
-#ifdef ZLIB_SHARED
-/* Stubs for each function to be dynamicly loaded */
-static int
-stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen)
- {
- if (p_compress)
- return(p_compress(dest,destLen,source,sourceLen));
- else
- return(Z_MEM_ERROR);
- }
-
-static int
-stub_inflateEnd(z_streamp strm)
- {
- if ( p_inflateEnd )
- return(p_inflateEnd(strm));
- else
- return(Z_MEM_ERROR);
- }
-
-static int
-stub_inflate(z_streamp strm, int flush)
- {
- if ( p_inflate )
- return(p_inflate(strm,flush));
- else
- return(Z_MEM_ERROR);
- }
-
-static int
-stub_inflateInit_(z_streamp strm, const char * version, int stream_size)
- {
- if ( p_inflateInit_ )
- return(p_inflateInit_(strm,version,stream_size));
- else
- return(Z_MEM_ERROR);
- }
-
-#endif /* ZLIB_SHARED */
$ssl_version="";
$banner="\t\@echo Building OpenSSL";
+local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
+local $zlib_lib = "";
+
open(IN,"<Makefile") || die "unable to open Makefile!\n";
while(<IN>) {
$ssl_version=$1 if (/^VERSION=(.*)$/);
$cflags.=" -DOPENSSL_FIPS" if $fips;
#$cflags.=" -DRSAref" if $rsaref ne "";
+$cflags.= " -DZLIB" if $zlib_opt;
+$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
+
## if ($unix)
## { $cflags="$c_flags" if ($c_flags ne ""); }
##else
$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
+
%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
"CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
if ($key eq "KRB5_INCLUDES")
{ $cflags .= " $val";}
+ if ($key eq "ZLIB_INCLUDE")
+ { $cflags .= " $val" if $val ne "";}
+
+ if ($key eq "LIBZLIB")
+ { $zlib_lib = "$val" if $val ne "";}
+
if ($key eq "LIBKRB5")
- { $ex_libs .= " $val";}
+ { $ex_libs .= " $val" if $val ne "";}
if ($key eq "TEST")
{ $test.=&var_add($dir,$val); }
!INCLUDE <\$(WCECOMPAT)/wcedefs.mak>
EOF
+ $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
}
$defs.= <<"EOF";
elsif (/^shlib$/) { $shlib=1; }
elsif (/^dll$/) { $shlib=1; }
elsif (/^shared$/) { } # We just need to ignore it for now...
- elsif (/^zlib$/) { $xcflags = "-DZLIB $xcflags"; }
- elsif (/^zlib-dynamic$/){ $xcflags = "-DZLIB_SHARED -DZLIB $xcflags"; }
+ elsif (/^zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
+ elsif (/^zlib-dynamic$/){ $zlib_opt = 2; }
elsif (/^--with-krb5-flavor=(.*)$/)
{
my $krb5_flavor = $1;