| 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... |
| 12 | test "$usemymalloc" || usemymalloc='n' |
| 13 | |
| 14 | # Currently, vfork(2) is not a real win over fork(2) but this will |
| 15 | # change starting with OpenBSD 2.7. |
| 16 | usevfork='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. |
| 21 | d_setregid=$undef |
| 22 | d_setreuid=$undef |
| 23 | d_setrgid=$undef |
| 24 | d_setruid=$undef |
| 25 | |
| 26 | # |
| 27 | # Not all platforms support dynamic loading... |
| 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. |
| 32 | # |
| 33 | ARCH=`arch|sed 's/^OpenBSD.//'` |
| 34 | case "${ARCH}-${osvers}" in |
| 35 | alpha-*|mips-*|vax-*|powerpc-2.[0-7]|m88k-*) |
| 36 | test -z "$usedl" && usedl=$undef |
| 37 | ;; |
| 38 | *) |
| 39 | test -z "$usedl" && usedl=$define |
| 40 | # we use -fPIC here because -fpic is *NOT* enough for some of the |
| 41 | # extensions like Tk on some OpenBSD platforms (ie: sparc) |
| 42 | cccdlflags="-DPIC -fPIC $cccdlflags" |
| 43 | case "$osvers" in |
| 44 | [01].*|2.[0-7]|2.[0-7].*) |
| 45 | lddlflags="-Bshareable $lddlflags" |
| 46 | ;; |
| 47 | *) # from 2.8 onwards |
| 48 | ld=${cc:-cc} |
| 49 | lddlflags="-shared -fPIC $lddlflags" |
| 50 | ;; |
| 51 | esac |
| 52 | ;; |
| 53 | esac |
| 54 | |
| 55 | # |
| 56 | # Tweaks for various versions of OpenBSD |
| 57 | # |
| 58 | case "$osvers" in |
| 59 | 2.5) |
| 60 | # OpenBSD 2.5 has broken odbm support |
| 61 | i_dbm=$undef |
| 62 | ;; |
| 63 | esac |
| 64 | |
| 65 | # OpenBSD doesn't need libcrypt but many folks keep a stub lib |
| 66 | # around for old NetBSD binaries. |
| 67 | libswanted=`echo $libswanted | sed 's/ crypt / /'` |
| 68 | |
| 69 | # Configure can't figure this out non-interactively |
| 70 | d_suidsafe=$define |
| 71 | |
| 72 | # cc is gcc so we can do better than -O |
| 73 | # Allow a command-line override, such as -Doptimize=-g |
| 74 | case "$ARCH" in |
| 75 | m88k) |
| 76 | optimize='-O0' |
| 77 | ;; |
| 78 | *) |
| 79 | test "$optimize" || optimize='-O2' |
| 80 | ;; |
| 81 | esac |
| 82 | |
| 83 | # This script UU/usethreads.cbu will get 'called-back' by Configure |
| 84 | # after it has prompted the user for whether to use threads. |
| 85 | cat > UU/usethreads.cbu <<'EOCBU' |
| 86 | case "$usethreads" in |
| 87 | $define|true|[yY]*) |
| 88 | # any openbsd version dependencies with pthreads? |
| 89 | ccflags="-pthread $ccflags" |
| 90 | ldflags="-pthread $ldflags" |
| 91 | libswanted="$libswanted pthread" |
| 92 | # This is strange. |
| 93 | usevfork="$undef" |
| 94 | esac |
| 95 | EOCBU |
| 96 | |
| 97 | # When building in the OpenBSD tree we use different paths |
| 98 | # This is only part of the story, the rest comes from config.over |
| 99 | case "$openbsd_distribution" in |
| 100 | ''|$undef|false) ;; |
| 101 | *) |
| 102 | # We put things in /usr, not /usr/local |
| 103 | prefix='/usr' |
| 104 | prefixexp='/usr' |
| 105 | sysman='/usr/share/man/man1' |
| 106 | libpth='/usr/lib' |
| 107 | glibpth='/usr/lib' |
| 108 | # Local things, however, do go in /usr/local |
| 109 | siteprefix='/usr/local' |
| 110 | siteprefixexp='/usr/local' |
| 111 | # Ports installs non-std libs in /usr/local/lib so look there too |
| 112 | locincpth='/usr/local/include' |
| 113 | loclibpth='/usr/local/lib' |
| 114 | # Link perl with shared libperl |
| 115 | if [ "$usedl" = "$define" -a -r shlib_version ]; then |
| 116 | useshrplib=true |
| 117 | libperl=`. ./shlib_version; echo libperl.so.${major}.${minor}` |
| 118 | fi |
| 119 | ;; |
| 120 | esac |
| 121 | |
| 122 | # end |