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