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