This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update podlators to CPAN version 4.10
[perl5.git] / hints / openbsd.sh
CommitLineData
43051805
GS
1# hints/openbsd.sh
2#
3# hints file for OpenBSD; Todd Miller <millert@openbsd.org>
4# Edited to allow Configure command-line overrides by
1973dd96 5# Andy Dougherty <doughera@lafayette.edu>
43051805 6#
c347f277 7# To build with distribution paths, use:
48827ca2 8# ./Configure -des -Dopenbsd_distribution=defined
c347f277 9#
43051805 10
9be9e8a7
AF
11# OpenBSD has a better malloc than perl...
12test "$usemymalloc" || usemymalloc='n'
43051805 13
da0b61dd
NC
14# malloc wrap works
15case "$usemallocwrap" in
16'') usemallocwrap='define' ;;
17esac
18
35356583
TM
19# Currently, vfork(2) is not a real win over fork(2).
20usevfork="$undef"
43051805 21
35356583
TM
22# In OpenBSD < 3.3, the setre?[ug]id() are emulated using the
23# _POSIX_SAVED_IDS functionality which does not have the same
24# semantics as 4.3BSD. Starting with OpenBSD 3.3, the original
25# semantics have been restored.
26case "$osvers" in
27[0-2].*|3.[0-2])
28 d_setregid=$undef
29 d_setreuid=$undef
30 d_setrgid=$undef
31 d_setruid=$undef
32esac
43051805
GS
33
34#
48827ca2 35# Not all platforms support dynamic loading...
e9c1fd70
AD
36# For the case of "$openbsd_distribution", the hints file
37# needs to know whether we are using dynamic loading so that
38# it can set the libperl name appropriately.
39# Allow command line overrides.
43051805 40#
5c75dbfa
JH
41ARCH=`arch | sed 's/^OpenBSD.//'`
42case "${ARCH}-${osvers}" in
2b573595 43alpha-2.[0-8]|mips-2.[0-8]|powerpc-2.[0-7]|m88k-[2-4].*|m88k-5.[0-2]|hppa-3.[0-5]|vax-*)
e9c1fd70 44 test -z "$usedl" && usedl=$undef
43051805
GS
45 ;;
46*)
e9c1fd70 47 test -z "$usedl" && usedl=$define
5c75dbfa 48 # We use -fPIC here because -fpic is *NOT* enough for some of the
43051805
GS
49 # extensions like Tk on some OpenBSD platforms (ie: sparc)
50 cccdlflags="-DPIC -fPIC $cccdlflags"
154d43cb
JH
51 case "$osvers" in
52 [01].*|2.[0-7]|2.[0-7].*)
53 lddlflags="-Bshareable $lddlflags"
54 ;;
5c75dbfa 55 2.[8-9]|3.0)
154d43cb 56 ld=${cc:-cc}
eb9cd59d 57 lddlflags="-shared -fPIC $lddlflags"
154d43cb 58 ;;
5c75dbfa
JH
59 *) # from 3.1 onwards
60 ld=${cc:-cc}
61 lddlflags="-shared -fPIC $lddlflags"
62 libswanted=`echo $libswanted | sed 's/ dl / /'`
63 ;;
154d43cb 64 esac
29b55857
JH
65
66 # We need to force ld to export symbols on ELF platforms.
67 # Without this, dlopen() is crippled.
68 ELF=`${cc:-cc} -dM -E - </dev/null | grep __ELF__`
69 test -n "$ELF" && ldflags="-Wl,-E $ldflags"
43051805
GS
70 ;;
71esac
72
1528c3db
TM
73#
74# Tweaks for various versions of OpenBSD
75#
76case "$osvers" in
772.5)
78 # OpenBSD 2.5 has broken odbm support
79 i_dbm=$undef
80 ;;
81esac
82
43051805
GS
83# OpenBSD doesn't need libcrypt but many folks keep a stub lib
84# around for old NetBSD binaries.
85libswanted=`echo $libswanted | sed 's/ crypt / /'`
86
43051805 87# Configure can't figure this out non-interactively
1528c3db 88d_suidsafe=$define
43051805
GS
89
90# cc is gcc so we can do better than -O
91# Allow a command-line override, such as -Doptimize=-g
2b573595
AF
92case "${ARCH}-${osvers}" in
93hppa-3.3|m88k-2.*|m88k-3.[0-3])
94 test "$optimize" || optimize='-O0'
1bd427d5 95 ;;
2b573595
AF
96m88k-3.4)
97 test "$optimize" || optimize='-O1'
35356583 98 ;;
1bd427d5
JH
99*)
100 test "$optimize" || optimize='-O2'
101 ;;
102esac
43051805 103
619ffc2b
JH
104# This script UU/usethreads.cbu will get 'called-back' by Configure
105# after it has prompted the user for whether to use threads.
106cat > UU/usethreads.cbu <<'EOCBU'
107case "$usethreads" in
108$define|true|[yY]*)
109 # any openbsd version dependencies with pthreads?
34163b21
JH
110 ccflags="-pthread $ccflags"
111 ldflags="-pthread $ldflags"
1ac0c030
AT
112 case "$osvers" in
113 [0-2].*|3.[0-2])
114 # Change from -lc to -lc_r
115 set `echo "X $libswanted " | sed 's/ c / c_r /'`
116 shift
117 libswanted="$*"
118 ;;
119 esac
36e43f01 120 case "$osvers" in
d767353b 121 [012].*|3.[0-6])
2b573595 122 # Broken up to OpenBSD 3.6, fixed in OpenBSD 3.7
36e43f01
JH
123 d_getservbyname_r=$undef ;;
124 esac
619ffc2b
JH
125esac
126EOCBU
127
c347f277
TM
128# When building in the OpenBSD tree we use different paths
129# This is only part of the story, the rest comes from config.over
130case "$openbsd_distribution" in
48827ca2 131''|$undef|false) ;;
c347f277
TM
132*)
133 # We put things in /usr, not /usr/local
134 prefix='/usr'
135 prefixexp='/usr'
136 sysman='/usr/share/man/man1'
c347f277 137 libpth='/usr/lib'
48827ca2 138 glibpth='/usr/lib'
eb9cd59d
TM
139 # Local things, however, do go in /usr/local
140 siteprefix='/usr/local'
141 siteprefixexp='/usr/local'
48827ca2
GS
142 # Ports installs non-std libs in /usr/local/lib so look there too
143 locincpth='/usr/local/include'
144 loclibpth='/usr/local/lib'
145 # Link perl with shared libperl
146 if [ "$usedl" = "$define" -a -r shlib_version ]; then
147 useshrplib=true
148 libperl=`. ./shlib_version; echo libperl.so.${major}.${minor}`
149 fi
c347f277
TM
150 ;;
151esac
152
43051805 153# end