xref: /openbsd/gnu/usr.bin/perl/hints/sco.sh (revision 17df1aa7)
1# sco.sh
2# Courtesy of Joel Rosi-Schwartz <j.schwartz@agonet.it>
3###############################################################
4# Additional SCO version info from
5# Peter Wolfe	<wolfe@teloseng.com>
6# Fri Jul 19 14:54:25 EDT 1996
7# and again Tue Sep 29 16:37:25 EDT 1998
8# by Andy Dougherty  <doughera@lafayette.edu>
9# Mostly rewritten on
10# Tue Jan 19 23:00:00 CET 1999
11# by Francois Desarmenien <desar@club-internet.fr>
12# Modified by Boyd Gerber <gerberb@zenez.com>
13# Tue Sep 21 1999
14###############################################################
15#
16# To use cc,  use   sh Configure
17# To use gcc, use   sh Configure -Dcc=gcc
18#
19# Default on 3.2v4 is to use static link (dynamic loading unsupported).
20# Default on 3.2v5 is to use dynamic loading.
21# To use static linkink instead, use to sh Configure -Dusedl=n
22#
23# Warning: - to use dynamic loading with gcc, you need gcc 2.8.0 or later
24# ******** - to compile with older releases of gcc, use Configure -Dusedl=n
25#            or it wont compile properly
26#
27###############################################################
28# NOTES:
29# -----
30#
31# I Have removed inclusion of ODBM_File for OSR5
32# because it core dumps and make tests fails.
33#
34# Support for icc compiler has been removed, because it 'breaks'
35# a lot of code :-(
36#
37# It's *always* a good idea to first make a static link to be sure to
38# have all symbols resolved with the current choice of libraries, since
39# with dynamic linking, unresolved symbols are allowed an will be detected
40# only at runtime (when you try to load the module or worse, when you call
41# the symbol)
42#
43# The best choice of compiler on OSR 5 (3.2v5.*) seems to be gcc >= 2.8.0:
44# -You cannot optimize with genuine sco cc (miniperl core dumps),
45#  so Perl is faster if compiled with gcc.
46# -Even optimized for speed, gcc generated code is smaller (!!!)
47# -gcc is free
48# -I use ld to link which is distributed with the core OS distribution, so you
49#  don't need to buy the developement kit, just find someone kind enough to
50#  give you a binary release of gcc.
51#
52#
53
54###############################################################
55# figure out what SCO version we are. The output of uname -X is
56# something like:
57#	System = SCO_SV
58#	Node = xxxxx
59#	Release = 3.2v5.0.0
60#	KernelID = 95/08/08
61#   Machine = Pentium
62#	BusType = ISA
63#	Serial = xxxxx
64#	Users = 5-user
65#	OEM# = 0
66#	Origin# = 1
67#   NumCPU = 1
68
69# Use /bin/uname (because GNU uname may be first in $PATH and
70# it does not support -X) to figure out what SCO version we are:
71# Matching '^Release' is broken by locale setting:
72# matching '3.2v' should be enough -- FD
73case `/bin/uname -X | egrep '3\.2v'` in
74*3.2v4.*) scorls=3 ;;   # OSR 3
75*3.2v5.*) scorls=5 ;;   # OSR 5
76*)
77   # Future of SCO OSR is SCO UnixWare: there should not be new OSR releases
78   echo "************************************************************" >&4
79   echo "" >&4
80   echo "  sco.sh hints file only supports:" >&4
81   echo "" >&4
82   echo "    - SCO Unix 3.2v4.x (OSR 3)" >&4
83   echo "    - SCO Unix 3.2v5.x (OSR 5)" >&4
84   echo "" >&4
85   echo "" >&4
86   echo "  For UnixWare, use svr4.sh hints instead" >&4
87   echo "  For UnixWare 7.*, use svr5.sh hints instead" >&4
88   echo "" >&4
89   echo "***********************************************************" >&4
90   exit
91;;
92esac
93
94###############################################################
95# Common fixes for all compilers an releases:
96
97###############################################################
98# What is true for SCO5 is true for SCO3 too today, so let's have a single
99# symbol for both
100ccflags="-U M_XENIX -D PERL_SCO"
101
102###############################################################
103# Compilers options section:
104if test "$scorls" = "3"
105then
106    dlext=''
107    case "$cc" in
108        *gcc*)  optimize='-O2' ;;
109        *)      ccflags="$ccflags -W0 -quiet"
110                optimize='-O' ;;
111    esac
112else
113    ###############################################################
114    # Need this in release 5 because of changed fpu exeption rules
115    ccflags="$ccflags -D HAS_FPSETMASK"
116
117    ###############################################################
118    # In Release 5, always compile ELF objects
119    case "$cc" in
120        *gcc*)
121            ccflags="$ccflags -melf"
122            optimize='-O2'
123        ;;
124        *)
125            ccflags="$ccflags -w0 -belf"
126            optimize='-O0'
127        ;;
128    esac
129    ###############################################################
130    # Dynamic loading section:
131    #
132    # We use ld to build shared libraries as it is always available
133    # and seems to work better than GNU's one on SCO
134    #
135    # ccdlflags : must tell the linker to export all global symbols
136    # cccdlflags: must tell the compiler to generate relocatable code
137    # lddlflags : must tell the linker to output a shared library
138    #
139    # /usr/local/lib is added for convenience, since 'foreign' libraries
140    # are usually put there in sco
141    #
142    if test "$usedl" != "n"; then
143        ld='ld'
144        case "$cc" in
145            *gcc*)
146                ccdlflags='-Xlinker -Bexport -L/usr/local/lib'
147                cccdlflags='-fpic'
148                lddlflags='-G -L/usr/local/lib'
149            ;;
150            *)
151                ccdlflags='-Wl,-Bexport -L/usr/local/lib'
152                cccdlflags='-Kpic'
153                lddlflags='-G -L/usr/local/lib'
154            ;;
155        esac
156
157        ###############################################################
158        # Use dynamic loading
159        usedl='define'
160        dlext='so'
161        dlsrc='dl_dlopen.xs'
162
163        ###############################################################
164        # Force to define those symbols, as they are #defines and not
165        # catched by Configure, and they are useful
166        d_dlopen='define'
167        d_dlerror='define'
168    fi
169fi
170
171
172###############################################################
173# Various hints, common to all releases, to have it work better:
174
175###############################################################
176# We need to remove libdl, as libdl.so exists, but ld complains
177# it can't find libdl.a ! Bug or feature ? :-)
178libswanted=`echo " $libswanted " | sed -e 's/ dl / /'`
179set X $libswanted
180shift
181libswanted="$*"
182
183###############################################################
184# Remove libbind because it conflicts with libsocket.
185libswanted=`echo " $libswanted " | sed -e 's/ bind / /'`
186set X $libswanted
187shift
188libswanted="$*"
189
190###############################################################
191# Try to use libintl.a since it has strcoll and strxfrm
192libswanted="intl $libswanted"
193
194###############################################################
195# Try to use libdbm.nfs.a since it has dbmclose.
196if test -f /usr/lib/libdbm.nfs.a ; then
197    libswanted=`echo "dbm.nfs $libswanted " | sed -e 's/ dbm / /'`
198    set X $libswanted
199    shift
200    libswanted="$*"
201fi
202
203###############################################################
204# At least for ORS5.0.2, prefer sprintf() over gcvt(), since gcvt()
205# used to cause a SIGFPE and a core dump when passed a NaN.
206# This may not be an issue in perl-5.8.x and later since we
207# try to trap SIGFPE.  However, preferring sprintf() should be
208# safe anyway, so let's go ahead and set it.  See the bugs database
209# item [perl #3100].   --A.D. 12/2004.
210	gconvert_preference='sprintf'
211
212###############################################################
213# We disable ODBM_File if OSR5 because it's mostly broken
214# but keep it for ODT3 as it seems to work.
215if test "$scorls" = "5"; then
216    i_dbm='undef'
217fi
218
219###############################################################
220# We don't want Xenix cross-development libraries
221glibpth=`echo $glibpth | sed -e 's! /usr/lib/386 ! !' -e 's! /lib/386 ! !'`
222xlibpth=''
223
224###############################################################
225# I have received one report that nm extraction doesn't work if you're
226# using the scocc compiler.  This system had the following 'myconfig'
227# uname='xxx xxx 3.2 2 i386 '
228# cc='scocc', optimize='-O'
229# You can override this with Configure -Dusenm.
230case "$usenm" in
231'') usenm='false' ;;
232esac
233
234###############################################################
235# If you want to use nm, you'll probably have to use nm -p.  The
236# following does that for you:
237nm_opt='-p'
238
239###############################################################
240# I have received one report that you can't include utime.h in
241# pp_sys.c.  Uncomment the following line if that happens to you:
242# i_utime=undef
243
244###############################################################
245# Perl 5.003_05 and later try to include both <time.h> and <sys/select.h>
246# in pp_sys.c, but that fails due to a redefinition of struct timeval.
247i_sysselct=$undef
248
249
250###############################################################
251#END of hint file
252