4 # Edited to allow Configure command-line overrides by
7 # To build with distribution paths, use:
8 # ./Configure -des -Dopenbsd_distribution=defined
11 # OpenBSD has a better malloc than perl...
12 test "$usemymalloc" || usemymalloc='n'
15 case "$usemallocwrap" in
16 '') usemallocwrap='define' ;;
19 # Currently, vfork(2) is not a real win over fork(2).
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.
35 # Not all platforms support dynamic loading...
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.
41 ARCH=`arch | sed 's/^OpenBSD.//'`
42 case "${ARCH}-${osvers}" in
43 alpha-2.[0-8]|mips-2.[0-8]|powerpc-2.[0-7]|m88k-[2-4].*|m88k-5.[0-2]|hppa-3.[0-5]|vax-*)
44 test -z "$usedl" && usedl=$undef
47 test -z "$usedl" && usedl=$define
48 # We use -fPIC here because -fpic is *NOT* enough for some of the
49 # extensions like Tk on some OpenBSD platforms (ie: sparc)
50 cccdlflags="-DPIC -fPIC $cccdlflags"
52 [01].*|2.[0-7]|2.[0-7].*)
53 lddlflags="-Bshareable $lddlflags"
57 lddlflags="-shared -fPIC $lddlflags"
61 lddlflags="-shared -fPIC $lddlflags"
62 libswanted=`echo $libswanted | sed 's/ dl / /'`
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"
74 # Tweaks for various versions of OpenBSD
78 # OpenBSD 2.5 has broken odbm support
83 # OpenBSD doesn't need libcrypt but many folks keep a stub lib
84 # around for old NetBSD binaries.
85 libswanted=`echo $libswanted | sed 's/ crypt / /'`
87 # Configure can't figure this out non-interactively
90 # cc is gcc so we can do better than -O
91 # Allow a command-line override, such as -Doptimize=-g
92 case "${ARCH}-${osvers}" in
93 hppa-3.3|m88k-2.*|m88k-3.[0-3])
94 test "$optimize" || optimize='-O0'
97 test "$optimize" || optimize='-O1'
100 test "$optimize" || optimize='-O2'
104 # This script UU/usethreads.cbu will get 'called-back' by Configure
105 # after it has prompted the user for whether to use threads.
106 cat > UU/usethreads.cbu <<'EOCBU'
107 case "$usethreads" in
109 # any openbsd version dependencies with pthreads?
110 ccflags="-pthread $ccflags"
111 ldflags="-pthread $ldflags"
114 # Change from -lc to -lc_r
115 set `echo "X $libswanted " | sed 's/ c / c_r /'`
122 # Broken up to OpenBSD 3.6, fixed in OpenBSD 3.7
123 d_getservbyname_r=$undef ;;
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
130 case "$openbsd_distribution" in
133 # We put things in /usr, not /usr/local
136 sysman='/usr/share/man/man1'
139 # Local things, however, do go in /usr/local
140 siteprefix='/usr/local'
141 siteprefixexp='/usr/local'
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
148 libperl=`. ./shlib_version; echo libperl.so.${major}.${minor}`
153 # openbsd has a problem regarding newlocale()
154 # https://marc.info/?l=openbsd-bugs&m=155364568608759&w=2
155 # which is being fixed. In the meantime, forbid POSIX 2008 locales
156 #d_newlocale="$undef"
158 # libc on this platform always keeps these categories in the C locale
159 ccflags="$ccflags -DNO_LOCALE_NUMERIC -DNO_LOCALE_COLLATE -DNO_LOCALE_MONETARY -DNO_LOCALE_TIME -DNO_LOCALE_MESSAGES"
161 # And the only possible mismatched LC_CTYPE locale is C.UTF-8 (as only it and
162 # plain C are legal for this category). All other categories deal only in
163 # ASCII characters which are a subset of C.UTF-8.
164 ccflags="$ccflags -DLIBC_HANDLES_MISMATCHED_CTYPE"
166 # Seems that OpenBSD returns bogus values in _Thread_local variables in code in
167 # shared objects, so we need to disable it. See GH #19109