Add missing funtions from non ANSI section of header files and add missing
[openssl.git] / util / pl / VC-16.pl
1 #!/usr/local/bin/perl
2 # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries
3 #
4
5 $ssl=   "ssleay16";
6 $crypto="libeay16";
7 $RSAref="RSAref16";
8
9 $o='\\';
10 $cp='copy';
11 $rm='del';
12
13 # C compiler stuff
14 $cc='cl';
15
16 $out_def="out16";
17 $tmp_def="tmp16";
18 $inc_def="inc16";
19
20 if ($debug)
21         {
22         $op="/Od /Zi /Zd";
23         $base_lflags="/CO";
24         }
25 else    {
26         $op="/G2 /f- /Ocgnotb2";
27         }
28 $base_lflags.=" /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000";
29 if ($win16) { $base_lflags.=" /PACKD:60000"; }
30
31 $cflags="/ALw /Gx- /Gt256 /Gf $op /W3 /WX -DL_ENDIAN /nologo";
32 # I add the stack opt
33 $lflags="$base_lflags /STACK:20000";
34
35 if ($win16)
36         {
37         $cflags.=" -DWINDOWS -DWIN16";
38         $app_cflag="/Gw /FPi87";
39         $lib_cflag="/Gw";
40         $lib_cflag.=" -D_WINDLL -D_DLL" if $shlib;
41         $lib_cflag.=" -DWIN16TTY" if !$shlib;
42         $lflags.=" /ALIGN:256";
43         $ex_libs.="oldnames llibcewq libw";
44         }
45 else
46         {
47         $no_sock=1;
48         $cflags.=" -DMSDOS";
49         $lflags.=" /EXEPACK";
50         $ex_libs.="oldnames.lib llibce.lib";
51         }
52
53 if ($shlib)
54         {
55         $mlflags="$base_lflags";
56         $libs="oldnames ldllcew libw";
57         $shlib_ex_obj="";
58 #       $no_asm=1;
59         $out_def="out16dll";
60         $tmp_def="tmp16dll";
61         }
62 else
63         { $mlflags=''; }
64
65 $app_ex_obj="setargv.obj";
66
67 $obj='.obj';
68 $ofile="/Fo";
69
70 # EXE linking stuff
71 $link="link";
72 $efile="";
73 $exep='.exe';
74 $ex_libs.=$no_sock?"":" winsock";
75
76 # static library stuff
77 $mklib='lib /PAGESIZE:1024';
78 $ranlib='';
79 $plib="";
80 $libp=".lib";
81 $shlibp=($shlib)?".dll":".lib";
82 $lfile='';
83
84 $asm='ml /Cp /c /Cx';
85 $afile='/Fo';
86
87 $bn_asm_obj='';
88 $bn_asm_src='';
89 $des_enc_obj='';
90 $des_enc_src='';
91 $bf_enc_obj='';
92 $bf_enc_src='';
93
94 if (!$no_asm)
95         {
96         if ($asmbits == 32)
97                 {
98                 $bn_asm_obj='crypto\bn\asm\x86w32.obj';
99                 $bn_asm_src='crypto\bn\asm\x86w32.asm';
100                 }
101         else
102                 {
103                 $bn_asm_obj='crypto\bn\asm\x86w16.obj';
104                 $bn_asm_src='crypto\bn\asm\x86w16.asm';
105                 }
106         }
107
108 sub do_lib_rule
109         {
110         local($objs,$target,$name,$shlib)=@_;
111         local($ret,$Name);
112
113         $taget =~ s/\//$o/g if $o ne '/';
114         ($Name=$name) =~ tr/a-z/A-Z/;
115
116 #       $target="\$(LIB_D)$o$target";
117         $ret.="$target: $objs\n";
118 #       $ret.="\t\$(RM) \$(O_$Name)\n";
119
120         # Due to a pathetic line length limit, I unwrap the args.
121         local($lib_names)="";
122         local($dll_names)="  \$(SHLIB_EX_OBJ) +\n";
123         ($obj)= ($objs =~ /\((.*)\)/);
124         foreach $_ (sort split(/\s+/,$Vars{$obj}))
125                 {
126                 $lib_names.="+$_ &\n";
127                 $dll_names.="  $_ +\n";
128                 }
129
130         if (!$shlib)
131                 {
132                 $ret.="\tdel $target\n";
133                 $ret.="\t\$(MKLIB) @<<\n$target\ny\n$lib_names\n\n<<\n";
134                 }
135         else
136                 {
137                 local($ex)=($target =~ /O_SSL/)?'$(L_CRYPTO)':"";
138                 $ex.=' winsock';
139                 $ret.="\t\$(LINK) \$(MLFLAGS) @<<\n";
140                 $ret.=$dll_names;
141                 $ret.="\n  $target\n\n  $ex $libs\nms$o${name}.def;\n<<\n";
142                 ($out_lib=$target) =~ s/O_/L_/;
143                 $ret.="\timplib /noignorecase /nowep $out_lib $target\n";
144                 }
145         $ret.="\n";
146         return($ret);
147         }
148
149 sub do_link_rule
150         {
151         local($target,$files,$dep_libs,$libs)=@_;
152         local($ret,$f,$_,@f);
153         
154         $file =~ s/\//$o/g if $o ne '/';
155         $n=&bname($targer);
156         $ret.="$target: $files $dep_libs\n";
157         $ret.="  \$(LINK) \$(LFLAGS) @<<\n";
158         
159         # Due to a pathetic line length limit, I have to unwrap the args.
160         if ($files =~ /\(([^)]*)\)$/)
161                 {
162                 @a=('$(APP_EX_OBJ)');
163                 push(@a,sort split(/\s+/,$Vars{$1}));
164                 for $_ (@a)
165                         { $ret.="  $_ +\n"; }
166                 }
167         else
168                 { $ret.="  \$(APP_EX_OBJ) $files"; }
169         $ret.="\n  $target\n\n  $libs\n\n<<\n\n";
170         return($ret);
171         }
172
173 1;