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