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