xref: /openbsd/gnu/usr.bin/perl/hints/mirbsd.sh (revision 404b540a)
1# $MirOS: src/gnu/usr.bin/perl/hints/mirbsd.sh,v 1.3 2007/05/07 20:32:09 tg Exp $
2#
3# hints file for MirOS by Thorsten Glaser <tg@mirbsd.de>
4# based upon hints for OpenBSD
5
6[ -z "$cc" ] && cc="${CC:-mgcc}"
7
8# MirOS has a better malloc than perl...
9usemymalloc='n'
10
11# Added by bingos.
12loclibpth="/usr/mpkg/lib /usr/local/lib"
13locincpath="/usr/mpkg/include /usr/local/include"
14ccflags="$ccflags -fhonour-copts -I/usr/mpkg/include"
15cppflags="$cppflags -fhonour-copts -I/usr/mpkg/include"
16
17# Currently, vfork(2) is not a real win over fork(2).
18usevfork="$undef"
19
20test -z "$usedl" && usedl=$define
21# We use -fPIC here because -fpic is *NOT* enough for some of the
22# extensions like Tk on some platforms (ie: sparc)
23cccdlflags="-DPIC -fPIC $cccdlflags"
24ld=$cc
25lddlflags="-shared -fPIC $lddlflags"
26libswanted=$(echo $libswanted | sed 's/ dl / /')
27
28# We need to force ld to export symbols on ELF platforms.
29# Without this, dlopen() is crippled. All platforms are ELF.
30ldflags="-Wl,-E $ldflags"
31
32# malloc wrap works
33case "$usemallocwrap" in
34'') usemallocwrap='define' ;;
35esac
36
37# MirOS doesn't need libcrypt
38libswanted=$(echo $libswanted | sed 's/ crypt / /')
39
40# Configure can't figure this out non-interactively
41d_suidsafe=$define
42
43# cc is gcc so we can do better than -O
44# Allow a command-line override, such as -Doptimize=-g
45test "$optimize" || optimize='-O2'
46
47# This script UU/usethreads.cbu will get 'called-back' by Configure
48# after it has prompted the user for whether to use threads.
49cat > UU/usethreads.cbu <<'EOCBU'
50case "$usethreads" in
51$define|true|[yY]*)
52	ccflags="-pthread $ccflags"
53	ldflags="-pthread $ldflags"
54esac
55EOCBU
56
57# This script UU/use64bitint.cbu will get 'called-back' by Configure
58# after it has prompted the user for whether to use 64-bitness.
59cat > UU/use64bitint.cbu <<'EOCBU'
60case "$use64bitint" in
61$define|true|[yY]*)
62	echo " "
63	echo "Checking if your C library has broken 64-bit functions..." >&4
64	$cat >check.c <<EOCP
65#include <stdio.h>
66typedef $uquadtype myULL;
67int main (void)
68{
69    struct {
70	double d;
71	myULL  u;
72    } *p, test[] = {
73	{4294967303.15, 4294967303ULL},
74	{4294967294.2,  4294967294ULL},
75	{4294967295.7,  4294967295ULL},
76	{0.0, 0ULL}
77    };
78    for (p = test; p->u; p++) {
79	myULL x = (myULL)p->d;
80	if (x != p->u) {
81	    printf("buggy\n");
82	    return 0;
83	}
84    }
85    printf("ok\n");
86    return 0;
87}
88EOCP
89	set check
90	if eval $compile_ok; then
91	    libcquad=$(./check)
92	    echo "Your C library's 64-bit functions are $libcquad."
93	else
94	    echo "(I can't seem to compile the test program.)"
95	    echo "Assuming that your C library's 64-bit functions are ok."
96	    libcquad="ok"
97	fi
98	$rm -f check.c check
99
100	case "$libcquad" in
101	    buggy*)
102		cat >&4 <<EOM
103
104*** You have a C library with broken 64-bit functions.
105*** 64-bit support does not work reliably in this configuration.
106*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
107*** Cannot continue, aborting.
108
109EOM
110		exit 1
111		;;
112	esac
113esac
114EOCBU
115
116# When building in the MirOS tree we use different paths
117# This is only part of the story, the rest comes from config.over
118case "$mirbsd_distribution" in
119''|$undef|false) ;;
120*)
121	# We put things in /usr, not /usr/local
122	prefix='/usr'
123	prefixexp='/usr'
124	sysman='/usr/share/man/man1'
125	libpth='/usr/lib'
126	glibpth='/usr/lib'
127	# Local things, however, do go in /usr/local
128	siteprefix='/usr/local'
129	siteprefixexp='/usr/local'
130	# Ports installs non-std libs in /usr/local/lib so look there too
131	locincpth='/usr/local/include'
132	loclibpth='/usr/local/lib'
133	# Link perl with shared libperl
134	if [ "$usedl" = "$define" -a -r shlib_version ]; then
135		useshrplib=true
136		libperl=$(. ./shlib_version; echo libperl.so.${major}.${minor})
137	fi
138	;;
139esac
140
141# end
142