Various changes to stop VC++ choking under Win32.
[openssl.git] / util / mkdef.pl
index 61ac7be1e5390aef3c7b159626e11107346ab2e0..80384af325a31aaae5635f92b77e3457e30cc871 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/my/bin/perl -w
+#!/usr/local/bin/perl -w
 #
 # generate a .def file
 #
@@ -18,7 +18,15 @@ $W32=1;
 $NT=0;
 # Set this to make typesafe STACK definitions appear in DEF
 $safe_stack_def = 1;
-foreach (@ARGV)
+
+$options="";
+open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n";
+while(<IN>) {
+    $options=$1 if (/^OPTIONS=(.*)$/);
+}
+close(IN);
+
+foreach (@ARGV, split(/ /, $options))
        {
        $W32=1 if $_ eq "32";
        $W32=0 if $_ eq "16";
@@ -219,18 +227,29 @@ sub do_defs
                                $funcs{"sk_${1}_set"} = 1;
                                $funcs{"sk_${1}_zero"} = 1;
                                $funcs{"sk_${1}_push"} = 1;
-                               $funcs{"sk_${1}_pop"} = 1;
+                               $funcs{"sk_${1}_unshift"} = 1;
                                $funcs{"sk_${1}_find"} = 1;
                                $funcs{"sk_${1}_delete"} = 1;
                                $funcs{"sk_${1}_delete_ptr"} = 1;
+                               $funcs{"sk_${1}_insert"} = 1;
                                $funcs{"sk_${1}_set_cmp_func"} = 1;
                                $funcs{"sk_${1}_dup"} = 1;
                                $funcs{"sk_${1}_pop_free"} = 1;
                                $funcs{"sk_${1}_shift"} = 1;
+                               $funcs{"sk_${1}_pop"} = 1;
+                               $funcs{"sk_${1}_sort"} = 1;
                        } elsif ($safe_stack_def &&
                                /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
                                $funcs{"d2i_ASN1_SET_OF_${1}"} = 1;
                                $funcs{"i2d_ASN1_SET_OF_${1}"} = 1;
+                       } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ ||
+                                    /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ) {
+                               if($W32) {
+                                       $funcs{"PEM_read_${1}"} = 1;
+                                       $funcs{"PEM_write_${1}"} = 1;
+                               }
+                               $funcs{"PEM_read_bio_${1}"} = 1;
+                               $funcs{"PEM_write_bio_${1}"} = 1;
                        } elsif ( 
                                ($tag{'FreeBSD'} != 1) &&
                                ($tag{'CONST_STRICT'} != 1) &&