This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[patch] -Wall
[perl5.git] / hints / svr5.sh
1 # svr5 hints, System V Release 5.x (UnixWare 7)
2 # mods after mail fm Andy Dougherty
3 # Reworked by hops@sco.com Sept/Oct 1999 for UW7.1 platform support 
4 #   Boyd Gerber, gerberb@zenez.com 1999/09/21 for threads support.
5 # Originally taken from svr4 hints.sh  21-Sep-98 hops@sco.com
6 # which was version of 1996/10/25 by Tye McQueen, tye@metronet.com
7
8 # Use Configure -Dusethreads to enable threads.
9 # Use Configure -Dcc=gcc to use gcc.
10 case "$cc" in
11 *gcc*)
12     #  "$gccversion" not set yet
13     vers=`gcc -v 2>&1 | sed -n -e 's@.*version \([^ ][^ ]*\) .*@\1@p'`
14     case $vers in
15     *2.95*)
16          ccflags='-fno-strict-aliasing'
17         # More optimisation provided in gcc-2.95 causes miniperl to segv.
18         # -fno-strict-aliasing is supposed to correct this but 
19         # if it doesn't and you get segv when the build runs miniperl then 
20         # disable optimisation as below
21         #  optimize=' '
22         ;;
23     esac
24     ;;  
25 esac
26
27 # Hardwire the processor to 586 for consistancy with autoconf
28 # archname='i586-svr5'
29 #  -- seems this is generally disliked by perl porters so leave it to float
30
31 # Our default setup excludes anything from /usr/ucblib (and consequently dbm)
32 # as later modules assume symbols found are available in shared libs 
33 # On svr5 these are static archives which causes problems for
34 # dynamic modules loaded later (and ucblib is a bad dream anyway)
35
36 # However there is a dbm library built from the ucb sources outside ucblib
37 # at http://www.sco.com/skunkware (installing into /usr/local) so if we
38 # detect this we'll use it. You can change the default
39 # (to allow ucblib and its dbm or disallowing non ucb dbm) by 
40 # changing 'want_*' config values below to '' to disable or otherwise to enable
41
42 #    Leave leading tabs so Configure doesn't propagate variables to config.sh
43
44         want_ucb=''             # don't use anything from /usr/ucblib - icky
45         want_dbm='yes'          # use dbm if can find library in /usr/local/lib
46         want_gdbm='yes'         # use gdbm if can find library in /usr/local/lib
47         want_udk70=''           # link with old static libc pieces
48             # link with udk70 if building on 7.1 abd want resulting binary 
49             # to run on uw7.0* - it will link in referenced static symbols 
50             # of libc that are (now) in the shared libc.so on 7.1 but were 
51             # not there in 7.0.
52             # There are still scenarios where this is still insufficient so 
53             # overall it is preferable to get ptf7051e 
54             #   ftp://ftp.sco.com/SLS/ptf7051e.Z
55             # installed on any/all 7.0 systems and leave the above unset.
56
57 if [ "$want_ucb" ] ; then 
58     ldflags= '-L/usr/ucblib'
59     ccflags='-I/usr/ucbinclude'
60     # /usr/ccs/include and /usr/ccs/lib are used implicitly by cc as reqd
61 else
62     libswanted=`echo " $libswanted " | sed -e 's/ ucb / /'`
63     glibpth=`echo " $glibpth " | sed -e 's/ \/usr\/ucblib / /'`
64
65     # If see libdbm in /usr/local and not overidden assume its the 
66     # non ucblib rebuild from skunkware  and use it
67     if [ ! -f /usr/local/lib/libdbm.so -o ! "$want_dbm" ] ; then
68         i_dbm='undef'
69         libswanted=`echo " $libswanted " | sed -e 's/ dbm / /'`
70     fi
71 fi
72
73 if [ ! "$want_gdbm" ] ; then 
74    i_gdbm='undef'
75    libswanted=`echo " $libswanted " | sed -e 's/ gdbm / /'`
76 fi
77
78
79 # Don't use problematic libraries:
80 #   libmalloc.a - Probably using Perl's malloc() anyway.
81 #   libc:  on UW7 don't want -lc explicitly as native cc gives warnings/errors
82 libswanted=`echo " $libswanted " | sed -e 's/ malloc / /' -e 's/ c / /'`
83
84 # remove /shlib and /lib from library search path as both symlink to /usr/lib
85 # where runtime shared libc is 
86 glibpth=`echo " $glibpth " | sed -e 's/ \/shlib / /' -e 's/ \/lib / /`
87
88 # Don't use BSD emulation pieces (/usr/ucblib) regardless
89 # these would probably be autonondetected anyway but ...
90 d_Gconvert='gcvt((x),(n),(b))'  # Try gcvt() before gconvert().
91 d_bcopy='undef' d_bcmp='undef'  d_bzero='undef'  d_safebcpy='undef'
92 d_index='undef' d_killpg='undef' d_getprior='undef' d_setprior='undef'
93 d_setlinebuf='undef' 
94 d_setregid='undef' d_setreuid='undef'  # -- in /usr/lib/libc.so.1
95
96
97 # Broken C-Shell tests (Thanks to Tye McQueen):
98 # The OS-specific checks may be obsoleted by the this generic test.
99         sh_cnt=`sh -c 'echo /*' | wc -c`
100         csh_cnt=`csh -f -c 'glob /*' 2>/dev/null | wc -c`
101         csh_cnt=`expr 1 + $csh_cnt`
102 if [ "$sh_cnt" -ne "$csh_cnt" ]; then
103     echo "You're csh has a broken 'glob', disabling..." >&2
104     d_csh='undef'
105 fi
106
107 # Unixware-specific problems.  UW7 give correctname with uname -s
108 # UnixWare has a broken csh.  (This might already be detected above).
109 # Configure can't detect memcpy or memset on Unixware 2 or 7
110 #
111 #    Leave leading tabs on the next two lines so Configure doesn't 
112 #    propagate these variables to config.sh
113         uw_ver=`uname -v`
114         uw_isuw=`uname -s 2>&1`
115
116 if [ "$uw_isuw" = "UnixWare" ]; then
117    case $uw_ver in
118    7.1*)
119         d_csh='undef'
120         d_memcpy='define'
121         d_memset='define'
122         stdio_cnt='((fp)->__cnt)'
123         d_stdio_cnt_lval='define'
124         stdio_ptr='((fp)->__ptr)'
125         d_stdio_ptr_lval='define'
126
127         d_bcopy='define'    # In /usr/lib/libc.so.1
128         d_setregid='define' #  " 
129         d_setreuid='define' #  " 
130
131         if [ -f /usr/ccs/lib/libcudk70.a -a "$want_udk70" ] ; then
132             libswanted=" $libswanted cudk70"
133         fi
134         ;;
135    7*)
136         d_csh='undef'
137         d_memcpy='define'
138         d_memset='define'
139         stdio_cnt='((fp)->__cnt)'
140         d_stdio_cnt_lval='define'
141         stdio_ptr='((fp)->__ptr)'
142         d_stdio_ptr_lval='define'
143         ;;
144    esac
145 fi
146 # End of Unixware-specific tests.
147
148 ###############################################################
149 # Dynamic loading section: Is default so it should just happen.
150 # set below to explicitly force.
151 # usedl='define'
152 # dlext='so'
153 # dlsrc='dl_dlopen.xs'
154 #
155 # ccdlflags : must tell the linker to export all global symbols
156 # cccdlflags: must tell the compiler to generate relocatable code
157 # lddlflags : must tell the linker to output a shared library
158
159 # use shared perl lib    
160 useshrplib='true'
161
162 case "$cc" in
163        *gcc*)
164            ccdlflags='-Xlinker -Bexport '
165            cccdlflags='-fpic'
166            lddlflags='-G '
167         ;;
168
169         *)
170            ccdlflags='-Wl,-Bexport'
171            cccdlflags='-Kpic'
172            lddlflags='-G -Wl,-Bexport'
173         ;;
174 esac
175
176 ############################################################################
177 # Thread support
178 # use Configure -Dusethreads to enable
179 # This script UU/usethreads.cbu will get 'called-back' by Configure 
180 # after it has prompted the user for whether to use threads.
181 cat > UU/usethreads.cbu <<'EOCBU'
182 case "$usethreads" in
183 $define|true|[yY]*)
184         ccflags="$ccflags"
185         shift
186         libswanted="$*"
187   case "$cc" in
188        *gcc*)
189            ccflags="-D_REENTRANT $ccflags -fpic -pthread"
190            cccdlflags='-fpic'
191            lddlflags='-pthread -G '
192         ;;
193         *)
194            ccflags="-D_REENTRANT $ccflags -KPIC -Kthread"
195            ccdlflags='-Kthread -Wl,-Bexport'
196            cccdlflags='-KPIC -Kthread'
197            lddlflags='-G -Kthread -Wl,-Bexport '
198            ldflags='-Kthread'
199         ;;
200   esac
201 esac
202 EOCBU
203
204
205 d_suidsafe='define'     # "./Configure -d" can't figure this out easily
206
207 ################## final caveat msgs to builder ###############
208 cat <<'EOM' >&4
209
210 If you wish to use dynamic linking, you must use 
211         LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH
212 or
213         setenv LD_LIBRARY_PATH `pwd`
214 before running make.
215
216 If you are using shared libraries from /usr/local/lib
217 for libdbm or libgdbm you may need to set
218         LD_RUN_PATH=/usr/local/lib; export LD_RUN_PATH
219 in order for Configure to compile the simple test program
220
221 EOM