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