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@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# 18# Not all platforms support dynamic loading... 19# For the case of "$openbsd_distribution", the hints file 20# needs to know whether we are using dynamic loading so that 21# it can set the libperl name appropriately. 22# Allow command line overrides. 23# 24#ARCH=`arch | sed 's/^OpenBSD.//'` 25ARCH=`arch | sed 's/^Bitrig.//'` 26case "${ARCH}-${osvers}" in 27*) 28 test -z "$usedl" && usedl=$define 29 # We use -fPIC here because -fpic is *NOT* enough for some of the 30 # extensions like Tk on some OpenBSD platforms (ie: sparc) 31 cccdlflags="-DPIC -fPIC $cccdlflags" 32 case "$osvers" in 33 *) # from 3.1 onwards 34 ld=${cc:-cc} 35 lddlflags="-shared -fPIC $lddlflags" 36 libswanted=`echo $libswanted | sed 's/ dl / /'` 37 ;; 38 esac 39 40 # We need to force ld to export symbols on ELF platforms. 41 # Without this, dlopen() is crippled. 42 ELF=`${cc:-cc} -dM -E - </dev/null | grep __ELF__` 43 test -n "$ELF" && ldflags="-Wl,-E $ldflags" 44 ;; 45esac 46 47# malloc wrap causes problems on m68k 48if [ X"$usemallocwrap" = X"" ]; then 49 case "${ARCH}" in 50 *) usemallocwrap="define" ;; 51 esac 52fi 53 54# OpenBSD doesn't need libcrypt but many folks keep a stub lib 55# around for old NetBSD binaries. 56libswanted=`echo $libswanted | sed 's/ crypt / /'` 57 58# Configure can't figure this out non-interactively 59d_suidsafe=$define 60 61# cc is gcc so we can do better than -O 62# Allow a command-line override, such as -Doptimize=-g 63case "${ARCH}-${osvers}" in 64*) 65 test "$optimize" || optimize='-O2' 66 ;; 67esac 68 69# This script UU/usethreads.cbu will get 'called-back' by Configure 70# after it has prompted the user for whether to use threads. 71cat > UU/usethreads.cbu <<'EOCBU' 72case "$usethreads" in 73$define|true|[yY]*) 74 # any openbsd version dependencies with pthreads? 75 ccflags="-pthread $ccflags" 76 ldflags="-pthread $ldflags" 77esac 78EOCBU 79 80# When building in the OpenBSD tree we use different paths 81# This is only part of the story, the rest comes from config.over 82case "$openbsd_distribution" in 83''|$undef|false) ;; 84*) 85 # We put things in /usr, not /usr/local 86 prefix='/usr' 87 prefixexp='/usr' 88 sysman='/usr/share/man/man1' 89 libpth='/usr/lib' 90 glibpth='/usr/lib' 91 # Local things, however, do go in /usr/local 92 siteprefix='/usr/local' 93 siteprefixexp='/usr/local' 94 # Ports installs non-std libs in /usr/local/lib so look there too 95 locincpth='/usr/local/include' 96 loclibpth='/usr/local/lib' 97 # Link perl with shared libperl 98 if [ "$usedl" = "$define" -a -r $src/shlib_version ]; then 99 useshrplib=true 100 libperl=`. $src/shlib_version; echo libperl.so.${major}.${minor}` 101 fi 102 ;; 103esac 104 105# end 106