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