| 1 | # hints/openbsd.sh
|
|---|
| 2 | #
|
|---|
| 3 | # hints file for OpenBSD; Todd Miller <[email protected]>
|
|---|
| 4 | # Edited to allow Configure command-line overrides by
|
|---|
| 5 | # Andy Dougherty <[email protected]>
|
|---|
| 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 | # malloc wrap works
|
|---|
| 15 | case "$usemallocwrap" in
|
|---|
| 16 | '') usemallocwrap='define' ;;
|
|---|
| 17 | esac
|
|---|
| 18 |
|
|---|
| 19 | # Currently, vfork(2) is not a real win over fork(2).
|
|---|
| 20 | usevfork="$undef"
|
|---|
| 21 |
|
|---|
| 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.
|
|---|
| 26 | case "$osvers" in
|
|---|
| 27 | [0-2].*|3.[0-2])
|
|---|
| 28 | d_setregid=$undef
|
|---|
| 29 | d_setreuid=$undef
|
|---|
| 30 | d_setrgid=$undef
|
|---|
| 31 | d_setruid=$undef
|
|---|
| 32 | esac
|
|---|
| 33 |
|
|---|
| 34 | #
|
|---|
| 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.
|
|---|
| 40 | #
|
|---|
| 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-*|hppa-*|vax-*)
|
|---|
| 44 | test -z "$usedl" && usedl=$undef
|
|---|
| 45 | ;;
|
|---|
| 46 | *)
|
|---|
| 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"
|
|---|
| 51 | case "$osvers" in
|
|---|
| 52 | [01].*|2.[0-7]|2.[0-7].*)
|
|---|
| 53 | lddlflags="-Bshareable $lddlflags"
|
|---|
| 54 | ;;
|
|---|
| 55 | 2.[8-9]|3.0)
|
|---|
| 56 | ld=${cc:-cc}
|
|---|
| 57 | lddlflags="-shared -fPIC $lddlflags"
|
|---|
| 58 | ;;
|
|---|
| 59 | *) # from 3.1 onwards
|
|---|
| 60 | ld=${cc:-cc}
|
|---|
| 61 | lddlflags="-shared -fPIC $lddlflags"
|
|---|
| 62 | libswanted=`echo $libswanted | sed 's/ dl / /'`
|
|---|
| 63 | ;;
|
|---|
| 64 | esac
|
|---|
| 65 |
|
|---|
| 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"
|
|---|
| 70 | ;;
|
|---|
| 71 | esac
|
|---|
| 72 |
|
|---|
| 73 | #
|
|---|
| 74 | # Tweaks for various versions of OpenBSD
|
|---|
| 75 | #
|
|---|
| 76 | case "$osvers" in
|
|---|
| 77 | 2.5)
|
|---|
| 78 | # OpenBSD 2.5 has broken odbm support
|
|---|
| 79 | i_dbm=$undef
|
|---|
| 80 | ;;
|
|---|
| 81 | esac
|
|---|
| 82 |
|
|---|
| 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 / /'`
|
|---|
| 86 |
|
|---|
| 87 | # Configure can't figure this out non-interactively
|
|---|
| 88 | d_suidsafe=$define
|
|---|
| 89 |
|
|---|
| 90 | # cc is gcc so we can do better than -O
|
|---|
| 91 | # Allow a command-line override, such as -Doptimize=-g
|
|---|
| 92 | case ${ARCH} in
|
|---|
| 93 | m88k)
|
|---|
| 94 | optimize='-O0'
|
|---|
| 95 | ;;
|
|---|
| 96 | hppa)
|
|---|
| 97 | optimize='-O0'
|
|---|
| 98 | ;;
|
|---|
| 99 | *)
|
|---|
| 100 | test "$optimize" || optimize='-O2'
|
|---|
| 101 | ;;
|
|---|
| 102 | esac
|
|---|
| 103 |
|
|---|
| 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
|
|---|
| 108 | $define|true|[yY]*)
|
|---|
| 109 | # any openbsd version dependencies with pthreads?
|
|---|
| 110 | ccflags="-pthread $ccflags"
|
|---|
| 111 | ldflags="-pthread $ldflags"
|
|---|
| 112 | case "$osvers" in
|
|---|
| 113 | [0-2].*|3.[0-2])
|
|---|
| 114 | # Change from -lc to -lc_r
|
|---|
| 115 | set `echo "X $libswanted " | sed 's/ c / c_r /'`
|
|---|
| 116 | shift
|
|---|
| 117 | libswanted="$*"
|
|---|
| 118 | ;;
|
|---|
| 119 | esac
|
|---|
| 120 | case "$osvers" in
|
|---|
| 121 | [012].*|3.[0-6])
|
|---|
| 122 | # Broken at least up to OpenBSD 3.6, we'll see about 3.7
|
|---|
| 123 | d_getservbyname_r=$undef ;;
|
|---|
| 124 | esac
|
|---|
| 125 | esac
|
|---|
| 126 | EOCBU
|
|---|
| 127 |
|
|---|
| 128 | # This script UU/use64bitint.cbu will get 'called-back' by Configure
|
|---|
| 129 | # after it has prompted the user for whether to use 64-bitness.
|
|---|
| 130 | cat > UU/use64bitint.cbu <<'EOCBU'
|
|---|
| 131 | case "$use64bitint" in
|
|---|
| 132 | $define|true|[yY]*)
|
|---|
| 133 | echo " "
|
|---|
| 134 | echo "Checking if your C library has broken 64-bit functions..." >&4
|
|---|
| 135 | $cat >check.c <<EOCP
|
|---|
| 136 | #include <stdio.h>
|
|---|
| 137 | typedef $uquadtype myULL;
|
|---|
| 138 | int main (void)
|
|---|
| 139 | {
|
|---|
| 140 | struct {
|
|---|
| 141 | double d;
|
|---|
| 142 | myULL u;
|
|---|
| 143 | } *p, test[] = {
|
|---|
| 144 | {4294967303.15, 4294967303ULL},
|
|---|
| 145 | {4294967294.2, 4294967294ULL},
|
|---|
| 146 | {4294967295.7, 4294967295ULL},
|
|---|
| 147 | {0.0, 0ULL}
|
|---|
| 148 | };
|
|---|
| 149 | for (p = test; p->u; p++) {
|
|---|
| 150 | myULL x = (myULL)p->d;
|
|---|
| 151 | if (x != p->u) {
|
|---|
| 152 | printf("buggy\n");
|
|---|
| 153 | return 0;
|
|---|
| 154 | }
|
|---|
| 155 | }
|
|---|
|
|---|