xref: /netbsd-src/crypto/external/bsd/openssl/dist/Configurations/platform/Unix.pm (revision b0d1725196a7921d003d2c66a14f186abda4176b)
1*b0d17251Schristospackage platform::Unix;
2*b0d17251Schristos
3*b0d17251Schristosuse strict;
4*b0d17251Schristosuse warnings;
5*b0d17251Schristosuse Carp;
6*b0d17251Schristos
7*b0d17251Schristosuse vars qw(@ISA);
8*b0d17251Schristos
9*b0d17251Schristosrequire platform::BASE;
10*b0d17251Schristos@ISA = qw(platform::BASE);
11*b0d17251Schristos
12*b0d17251Schristos# Assume someone set @INC right before loading this module
13*b0d17251Schristosuse configdata;
14*b0d17251Schristos
15*b0d17251Schristossub binext              { $target{exe_extension} || '' }
16*b0d17251Schristossub dsoext              { $target{dso_extension} || platform->shlibextsimple()
17*b0d17251Schristos                              || '.so' }
18*b0d17251Schristos# Because these are also used in scripts and not just Makefile, we must
19*b0d17251Schristos# convert $(SHLIB_VERSION_NUMBER) to the actual number.
20*b0d17251Schristossub shlibext            { (my $x = $target{shared_extension}
21*b0d17251Schristos                               || '.so.$(SHLIB_VERSION_NUMBER)')
22*b0d17251Schristos                              =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
23*b0d17251Schristos                                  |.$config{shlib_version}|x;
24*b0d17251Schristos                          $x; }
25*b0d17251Schristossub libext              { $target{lib_extension} || '.a' }
26*b0d17251Schristossub defext              { $target{def_extension} || '.ld' }
27*b0d17251Schristossub objext              { $target{obj_extension} || '.o' }
28*b0d17251Schristossub depext              { $target{obj_extension} || '.d' }
29*b0d17251Schristos
30*b0d17251Schristos# Other extra that aren't defined in platform::BASE
31*b0d17251Schristossub shlibextsimple      { (my $x = $target{shared_extension} || '.so')
32*b0d17251Schristos                              =~ s|\.\$\(SHLIB_VERSION_NUMBER\)||;
33*b0d17251Schristos                          $x; }
34*b0d17251Schristossub shlibvariant        { $target{shlib_variant} || "" }
35*b0d17251Schristossub makedepcmd          { $disabled{makedepend} ? undef : $config{makedepcmd} }
36*b0d17251Schristos
37*b0d17251Schristos# No conversion of assembler extension on Unix
38*b0d17251Schristossub asm {
39*b0d17251Schristos    return $_[1];
40*b0d17251Schristos}
41*b0d17251Schristos
42*b0d17251Schristos# At some point, we might decide that static libraries are called something
43*b0d17251Schristos# other than the default...
44*b0d17251Schristossub staticname {
45*b0d17251Schristos    # Non-installed libraries are *always* static, and their names remain
46*b0d17251Schristos    # the same, except for the mandatory extension
47*b0d17251Schristos    my $in_libname = platform::BASE->staticname($_[1]);
48*b0d17251Schristos    return $in_libname
49*b0d17251Schristos        if $unified_info{attributes}->{libraries}->{$_[1]}->{noinst};
50*b0d17251Schristos
51*b0d17251Schristos    # We currently return the same name anyway...  but we might choose to
52*b0d17251Schristos    # append '_static' or '_a' some time in the future.
53*b0d17251Schristos    return platform::BASE->staticname($_[1]);
54*b0d17251Schristos}
55*b0d17251Schristos
56*b0d17251Schristossub sharedname {
57*b0d17251Schristos    return platform::BASE::__concat(platform::BASE->sharedname($_[1]),
58*b0d17251Schristos                                    ($_[0]->shlibvariant() // ''));
59*b0d17251Schristos}
60*b0d17251Schristos
61*b0d17251Schristossub sharedname_simple {
62*b0d17251Schristos    return platform::BASE::__isshared($_[1]) ? $_[1] : undef;
63*b0d17251Schristos}
64*b0d17251Schristos
65*b0d17251Schristossub sharedlib_simple {
66*b0d17251Schristos    # This function returns the simplified shared library name (no version
67*b0d17251Schristos    # or variant in the shared library file name) if the simple variants of
68*b0d17251Schristos    # the base name or the suffix differ from the full variants of the same.
69*b0d17251Schristos
70*b0d17251Schristos    # Note: if $_[1] isn't a shared library name, then $_[0]->sharedname()
71*b0d17251Schristos    # and $_[0]->sharedname_simple() will return undef.  This needs being
72*b0d17251Schristos    # accounted for.
73*b0d17251Schristos    my $name = $_[0]->sharedname($_[1]);
74*b0d17251Schristos    my $simplename = $_[0]->sharedname_simple($_[1]);
75*b0d17251Schristos    my $ext = $_[0]->shlibext();
76*b0d17251Schristos    my $simpleext = $_[0]->shlibextsimple();
77*b0d17251Schristos
78*b0d17251Schristos    return undef unless defined $simplename && defined $name;
79*b0d17251Schristos    return undef if ($name eq $simplename && $ext eq $simpleext);
80*b0d17251Schristos    return platform::BASE::__concat($simplename, $simpleext);
81*b0d17251Schristos}
82*b0d17251Schristos
83*b0d17251Schristossub sharedlib_import {
84*b0d17251Schristos    return undef;
85*b0d17251Schristos}
86*b0d17251Schristos
87*b0d17251Schristos1;
88