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