(Retracted by #4127, unnecessary because Configure does this.)
[p5sagit/p5-mst-13.2.git] / hints / svr5.sh
1 # svr5 hints, System V Release 5.x
2 # Last modified 1999/09/21 by Boyd Gerber, gerberb@zenez.com
3 # with changes from Mike Hopkirk hops@sco.com
4
5 # Use Configure -Dcc=gcc to use gcc.
6 case "$cc" in
7 '') cc='/bin/cc'
8     test -f $cc || cc='/usr/ccs/bin/cc'
9     ;;
10 *gcc*)
11     # "$gccversion" not set yet
12     vers=`gcc -v 2>&1 | sed -n -e 's@.*version \([^ ][^ ]*\) .*@\1@p'`
13     case $vers in
14     *2.95*)
15         ccflags='-fno-strict-aliasing'
16         # If it coredumps when running miniperl with the above switch on
17         # try instead without optimisation.
18         # optimize=' '
19         ;;
20     esac
21     ;;
22 esac
23
24 # want_ucb=''
25 # want_dbm='yes'
26 want_gdbm='yes'
27
28 # We include support for using libraries in /usr/ucblib, but the setting
29 # of libswanted excludes some libraries found there.  If you run into
30 # problems, you may have to remove "ucb" from libswanted.  Just delete
31 # the comment '#' from the sed command below.
32 # ldflags='-L/usr/ccs/lib -L/usr/ucblib'
33 # ccflags='-I/usr/include -I/usr/ucbinclude'
34 # Don't use problematic libraries:
35 libswanted=`echo " $libswanted " | sed -e 's/ malloc / /'` # -e 's/ ucb / /'`
36 # libmalloc.a - Probably using Perl's malloc() anyway.
37 # libucb.a - Remove it if you have problems ld'ing.  We include it because
38 #   it is needed for ODBM_File and NDBM_File extensions.
39
40 if [ "$want_ucb" ] ; then 
41     ldflags= '-L/usr/ccs/lib -L/usr/ucblib'
42     ccflags='-I/usr/include -I/usr/ucbinclude'
43   if [ -r /usr/ucblib/libucb.a ]; then  # If using BSD-compat. library:
44     d_Gconvert='gcvt((x),(n),(b))'      # Try gcvt() before gconvert().
45     # Use the "native" counterparts, not the BSD emulation stuff:
46     d_bcmp='undef' d_bcopy='undef' d_bzero='undef' d_safebcpy='undef'
47     d_index='undef' d_killpg='undef' d_getprior='undef' d_setprior='undef'
48     d_setlinebuf='undef' 
49     # d_setregid='undef' d_setreuid='undef'  # ???
50   fi
51 else
52 #    libswanted=`echo " $libswanted " | sed -e 's/ ucb / /' -e 's/ dbm / /'`
53     libswanted=`echo " $libswanted " | sed -e 's/ ucb / /'`
54     glibpth=`echo " $glibpth " | sed -e 's/ \/usr\/ucblib / /'`
55
56     # a non ucb native version of libdbm for /usr/local is available from 
57     # http://www.sco.com/skunkware 
58     # if its installed (and not overidden) we'll use it.
59     if [ ! -f /usr/local/lib/libdbm.so -o ! "$want_dbm" ] ; then
60         libswanted=`echo " $libswanted " | sed -e 's/ dbm / /'`
61     fi
62 fi
63
64 if [ "$want_gdbm" -a -f /usr/local/lib/libgdbm.so ] ; then 
65     i_gdbm='define'
66 else
67     i_gdbm='undef'
68    libswanted=`echo " $libswanted " | sed -e 's/ gdbm / /'`
69 fi
70
71 # Don't use problematic libraries:
72 #   libmalloc.a - Probably using Perl's malloc() anyway.
73 #   libc:  on UW7 don't want -lc explicitly - cc gives warnings/errors
74 libswanted=`echo " $libswanted " | sed -e 's/ malloc / /' -e 's/ c / /'`
75
76 # remove /shlib and /lib from library search path as both symlink to /usr/lib
77 # where runtime shared libc is 
78 glibpth=`echo " $glibpth " | sed -e 's/ \/shlib / /' -e 's/ \/lib / /`
79
80 # UnixWare has /usr/lib/libc.so.1, /usr/lib/libc.so.1.1, and
81 # /usr/ccs/lib/libc.so.  Configure chooses libc.so.1.1 while it
82 # appears that /usr/ccs/lib/libc.so contains more symbols:
83 #
84 # Try the following if you want to use nm-extraction.  We'll just
85 # skip the nm-extraction phase, since searching for all the different
86 # library versions will be hard to keep up-to-date.
87 #
88 # if [ "" = "$libc" -a -f /usr/ccs/lib/libc.so -a \
89 #   -f /usr/lib/libc.so.1 -a -f /usr/lib/libc.so.1.1 ]; then
90 #     if nm -h /usr/ccs/lib/libc.so | egrep '\<_?select$' >/dev/null; then
91 #       if nm -h /usr/lib/libc.so.1 | egrep '\<_?select$'` >/dev/null ||
92 #          nm -h /usr/lib/libc.so.1.1 | egrep '\<_?select$'` >/dev/null; then
93 #           :
94 #       else
95 #           libc=/usr/ccs/lib/libc.so
96 #       fi
97 #     fi
98 # fi
99 #
100 #  Don't bother with nm.  Just compile & link a small C program.
101 case "$usenm" in
102 '') usenm=false;;
103 esac
104
105 # Broken C-Shell tests (Thanks to Tye McQueen):
106 # The OS-specific checks may be obsoleted by the this generic test.
107         sh_cnt=`sh -c 'echo /*' | wc -c`
108         csh_cnt=`csh -f -c 'glob /*' 2>/dev/null | wc -c`
109         csh_cnt=`expr 1 + $csh_cnt`
110 if [ "$sh_cnt" -ne "$csh_cnt" ]; then
111     echo "You're csh has a broken 'glob', disabling..." >&2
112     d_csh='undef'
113 fi
114
115 # Unixware-specific problems.  The undocumented -X argument to uname 
116 # is probably a reasonable way of detecting UnixWare.  
117 # UnixWare has a broken csh.  (This might already be detected above).
118 # Configure can't detect memcpy or memset on Unixware 2 or 7
119 #
120 #    Leave leading tabs on the next two lines so Configure doesn't 
121 #    propagate these variables to config.sh
122         uw_ver=`uname -v`
123         uw_isuw=`uname -X 2>&1 | grep Release`
124
125 if [ "$uw_isuw" = "Release = 5" ]; then
126    case $uw_ver in
127    7*)
128         d_csh='undef'
129         d_memcpy='define'
130         d_memset='define'
131         stdio_cnt='((fp)->__cnt)'
132         d_stdio_cnt_lval='define'
133         stdio_ptr='((fp)->__ptr)'
134         d_stdio_ptr_lval='define'
135         ;;
136    esac
137 fi
138
139 ###############################################################
140 # Dynamic loading section:
141 #
142 # ccdlflags : must tell the linker to export all global symbols
143 # cccdlflags: must tell the compiler to generate relocatable code
144 # lddlflags : must tell the linker to output a shared library
145 #
146 # /usr/local/lib is added for convenience, since additional libraries
147 # are usually put there 
148 #
149 # use shared perl lib    
150 useshrplib='true'
151
152 case "$cc" in
153        *gcc*)
154            ccdlflags='-Xlinker -Bexport -L/usr/local/lib'
155            cccdlflags='-fpic'
156            lddlflags='-G -L/usr/local/lib'
157         ;;
158         *)
159            ccdlflags='-Wl,-Bexport -L/usr/local/lib'
160            cccdlflags='-KPIC'
161            lddlflags='-G -Wl,-Bexport -L/usr/local/lib'
162         ;;
163 esac
164
165 ###############################################################
166 # Use dynamic loading
167 usedl='define'
168 dlext='so'
169 dlsrc='dl_dlopen.xs'
170
171 # Configure may fail to find lstat() since it's a static/inline function
172 # in <sys/stat.h> on Unisys U6000 SVR4, UnixWare 2.x, and possibly other
173 # SVR4 derivatives.  (Though UnixWare has it in /usr/ccs/lib/libc.so.)
174 d_lstat=define
175
176
177 # DDE SMES Supermax Enterprise Server
178 case "`uname -sm`" in
179 "UNIX_SV SMES")
180     # the *grent functions are in libgen.
181     libswanted="$libswanted gen"
182     # csh is broken (also) in SMES
183     # This may already be detected by the generic test above.
184     d_csh='undef'
185     case "$cc" in
186     *gcc*) ;;
187     *)  # for cc we need -K PIC (not -K pic)
188         cccdlflags="$cccdlflags -K PIC"
189         ;;
190     esac
191     ;;
192 esac
193
194 # This script UU/usethreads.cbu will get 'called-back' by Configure 
195 # after it has prompted the user for whether to use threads.
196 cat > UU/usethreads.cbu <<'EOCBU'
197 case "$usethreads" in
198 $define|true|[yY]*)
199         ccflags="$ccflags"
200         set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
201         shift
202         libswanted="$*"
203   case "$cc" in
204        *gcc*)
205            ccflags="-D_REENTRANT $ccflags -fpic -pthread"
206            cccdlflags='-fpic'
207            lddlflags='-pthread -G -L/usr/local/lib '
208         ;;
209         *)
210            ccflags="-D_REENTRANT $ccflags -KPIC -Kthread"
211            ccdlflags='-Kthread -Wl,-Bexport -L/usr/local/lib'
212            cccdlflags='-KPIC -Kthread'
213            lddlflags='-G -Kthread -Wl,-Bexport -L/usr/local/lib'
214            ldflags='-Kthread -L/usr/local/lib -L/usr/gnu/lib'
215         ;;
216   esac
217 esac
218 EOCBU
219
220 # End of Unixware-specific tests.
221 # Configure may fail to find lstat() since it's a static/inline function
222 # in <sys/stat.h> on Unisys U6000 SVR4, UnixWare 2.x, and possibly other
223 # SVR4 derivatives.  (Though UnixWare has it in /usr/ccs/lib/libc.so.)
224 d_lstat=define
225
226 d_suidsafe='define'     # "./Configure -d" can't figure this out easilly
227