Fix unnecessary re-linking
[p5sagit/p5-mst-13.2.git] / hints / linux.sh
1 # hints/linux.sh
2 # Original version by rsanders
3 # Additional support by Kenneth Albanowski <kjahds@kjahds.com>
4 #
5 # ELF support by H.J. Lu <hjl@nynexst.com>
6 # Additional info from Nigel Head <nhead@ESOC.bitnet>
7 # and Kenneth Albanowski <kjahds@kjahds.com>
8 #
9 # Consolidated by Andy Dougherty <doughera@lafcol.lafayette.edu>
10 #
11 # Updated Thu Feb  8 11:56:10 EST 1996
12
13 # Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafcol.lafayette.edu>
14
15 # Updated Fri Jun 21 11:07:54 EDT 1996
16 # NDBM support for ELF renabled by <kjahds@kjahds.com>
17
18 # No version of Linux supports setuid scripts.
19 d_suidsafe='undef'
20 #don't force people to install SUID if they don't want to (have said  
21 #-Dd_dosuid=undef explicitly on command line) - MIKEDLR
22 if [ ! "A$d_dosuid" = "Aundef" ] #do I need to be paranoid here?
23 then
24     d_dosuid='define'
25 fi
26
27
28 # perl goes into the /usr tree.  See the Filesystem Standard
29 # available via anonymous FTP at tsx-11.mit.edu in
30 # /pub/linux/docs/linux-standards/fsstnd.
31 # Allow a command line override, e.g. Configure -Dprefix=/foo/bar
32 case "$prefix" in
33 '') prefix='/usr' ;;
34 esac
35
36 # gcc-2.6.3 defines _G_HAVE_BOOL to 1, but doesn't actually supply bool.
37 ccflags="-Dbool=char -DHAS_BOOL $ccflags"
38
39 # BSD compatability library no longer needed
40 set `echo X "$libswanted "| sed -e 's/ bsd / /'`
41 shift
42 libswanted="$*"
43
44 # Configure may fail to find lstat() since it's a static/inline
45 # function in <sys/stat.h>.
46 d_lstat=define
47
48 # Explanation?
49 case "$usemymalloc" in
50 '') usemymalloc='n' ;;
51 esac
52
53 case "$optimize" in
54 '') optimize='-O2' ;;
55 esac
56
57 # Are we using ELF?  Thanks to Kenneth Albanowski <kjahds@kjahds.com>
58 # for this test.
59 cat >try.c <<'EOM'
60 /* Test for whether ELF binaries are produced */
61 #include <fcntl.h>
62 #include <stdlib.h>
63 main() {
64         char buffer[4];
65         int i=open("a.out",O_RDONLY);
66         if(i==-1)
67                 exit(1); /* fail */
68         if(read(i,&buffer[0],4)<4)
69                 exit(1); /* fail */
70         if(buffer[0] != 127 || buffer[1] != 'E' ||
71            buffer[2] != 'L' || buffer[3] != 'F')
72                 exit(1); /* fail */
73         exit(0); /* succeed (yes, it's ELF) */
74 }
75 EOM
76 if ${cc:-gcc} try.c >/dev/null 2>&1 && ./a.out; then
77     cat <<'EOM' >&4
78
79 You appear to have ELF support.  I'll try to use it for dynamic loading.
80 If dynamic loading doesn't work, read hints/linux.sh for further information.
81 EOM
82
83 #For RedHat Linux 3.0.3, you may need to fetch
84 # ftp://ftp.redhat.com/pub/redhat-3.0.3/i386/updates/RPMS/ld.so-1.7.14-3.i386.rpm
85 #
86
87 else
88     cat <<'EOM' >&4
89
90 You don't have an ELF gcc.  I will use dld if possible.  If you are
91 using a version of DLD earlier than 3.2.6, or don't have it at all, you
92 should probably upgrade. If you are forced to use 3.2.4, you should
93 uncomment a couple of lines in hints/linux.sh and restart Configure so
94 that shared libraries will be disallowed.
95
96 EOM
97     lddlflags="-r $lddlflags"
98     # These empty values are so that Configure doesn't put in the
99     # Linux ELF values.
100     ccdlflags=' '
101     cccdlflags=' '
102     ccflags="-DOVR_DBL_DIG=14 $ccflags"
103     so='sa'
104     dlext='o'
105     nm_so_opt=' '
106     ## If you are using DLD 3.2.4 which does not support shared libs,
107     ## uncomment the next two lines:
108     #ldflags="-static"
109     #so='none'
110
111         # In addition, on some systems there is a problem with perl and NDBM
112         # which causes AnyDBM and NDBM_File to lock up. This is evidenced 
113         # in the tests as AnyDBM just freezing.  Apparently, this only 
114         # happens on a.out systems, so we disable NDBM for all a.out linux
115         # systems.  If someone can suggest a more robust test
116         #  that would be appreciated.
117         #
118         # More info:
119         # Date: Wed, 7 Feb 1996 03:21:04 +0900
120         # From: Jeffrey Friedl <jfriedl@nff.ncl.omron.co.jp>
121         #
122         # I tried compiling with DBM support and sure enough things locked up
123         # just as advertised. Checking into it, I found that the lockup was
124         # during the call to dbm_open. Not *in* dbm_open -- but between the call
125         # to and the jump into.
126         # 
127         # To make a long story short, making sure that the *.a and *.sa pairs of
128         #   /usr/lib/lib{m,db,gdbm}.{a,sa}
129         # were perfectly in sync took care of it.
130         #
131         # This will generate a harmless Whoa There! message
132         case "$d_dbm_open" in
133         '')     cat <<'EOM' >&4
134
135 Disabling ndbm.  This will generate a Whoa There message in Configure.
136 Read hints/linux.sh for further information.
137 EOM
138                 # You can override this with Configure -Dd_dbm_open
139                 d_dbm_open=undef
140                 ;;
141         esac
142 fi
143
144 rm -f try.c a.out
145
146 if /bin/bash -c exit; then
147   echo ''
148   echo 'You appear to have a working bash.  Good.'
149 else
150   cat << 'EOM' >&4
151
152 *********************** Warning! *********************
153 It would appear you have a defective bash shell installed. This is likely to
154 give you a failure of op/exec test #5 during the test phase of the build,
155 Upgrading to a recent version (1.14.4 or later) should fix the problem.
156 ******************************************************
157 EOM
158
159 fi
160
161 # On SPARClinux,
162 # The following csh consistently coredumped in the test directory
163 # "/home/mikedlr/perl5.003_94/t", though not most other directories.
164
165 #Name        : csh                    Distribution: Red Hat Linux (Rembrandt)
166 #Version     : 5.2.6                        Vendor: Red Hat Software
167 #Release     : 3                        Build Date: Fri May 24 19:42:14 1996
168 #Install date: Thu Jul 11 16:20:14 1996 Build Host: itchy.redhat.com
169 #Group       : Shells                   Source RPM: csh-5.2.6-3.src.rpm
170 #Size        : 184417
171 #Description : BSD c-shell
172
173 # For this reason I suggest using the much bug-fixed tcsh for globbing
174 # where available.
175
176 if [  ! "`csh -c 'echo $version' 2>/dev/null`"  ] 
177 then
178         echo 'Real csh found (might break); looking for tcsh ...'
179         if which tcsh >/dev/null 2>&1
180         then
181                 echo 'Found tcsh; will use it for globbing.'
182                 csh='tcsh'
183                 d_csh='tcsh'
184                 full_csh=`which tcsh` # we know this will work now.
185         else
186                 echo "Couldn't find tcsh.  BEWARE BROKEN GLOBBING."
187         fi
188 else
189         echo 'Your csh is really tcsh.  Good.'
190 fi