71afccd1f95651b6fb44e7361bb7e2d32dd6e81c
[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 # Last updated Thu Apr  6 12:22:03 EDT 1995
12 #
13
14 # perl goes into the /usr tree.  See the Filesystem Standard
15 # available via anonymous FTP at tsx-11.mit.edu in
16 # /pub/linux/docs/linux-standards/fsstnd.
17 # This used to be
18 # bin='/usr/bin'
19 # but it doesn't seem sensible to put the binary in /usr and all the
20 # rest of the support stuff (lib, man pages) into /usr/local.
21 # However, allow a command line override, e.g. Configure -Dprefix=/foo/bar
22 case "$prefix" in
23 '') prefix='/usr' ;;
24 esac
25
26 # Perl expects BSD style signal handling.
27 ccflags="-D__USE_BSD_SIGNAL $ccflags"
28
29 # The following functions are gcc built-ins, but the Configure test
30 # may fail because it doesn't supply a proper prototype.
31 d_memcmp=define
32 d_memcpy=define
33
34 # Configure may fail to find lstat() since it's a static/inline
35 # function in <sys/stat.h>.
36 d_lstat=define
37
38 d_dosuid='define'
39
40 malloctype='void *'
41 usemymalloc='n'
42
43 case "$optimize" in
44 '') optimize='-O2' ;;
45 esac
46
47 # Are we using ELF?  Thanks to Kenneth Albanowski <kjahds@kjahds.com>
48 # for this test.
49 cat >try.c <<'EOM'
50 /* Test for whether ELF binaries are produced */
51 #include <fcntl.h>
52 #include <stdlib.h>
53 main() {
54         char buffer[4];
55         int i=open("a.out",O_RDONLY);
56         if(i==-1)
57                 exit(1); /* fail */
58         if(read(i,&buffer[0],4)<4)
59                 exit(1); /* fail */
60         if(buffer[0] != 127 || buffer[1] != 'E' ||
61            buffer[2] != 'L' || buffer[3] != 'F')
62                 exit(1); /* fail */
63         exit(0); /* succeed (yes, it's ELF) */
64 }
65 EOM
66 if gcc try.c >/dev/null 2>&1 && ./a.out; then
67     cat <<'EOM'
68
69 You appear to have ELF support.  I'll try to use it for dynamic loading.
70 EOM
71     # Be careful not to overwrite lddlflags, since the user might
72     # have specified some -L/path options on the Configure command line.
73     lddlflags="-shared $lddlflags"
74     ccdlflags='-rdynamic'
75     so='so'
76     dlext='so'
77     ld=gcc
78 else
79     echo "You don't have an ELF gcc, using dld if available."
80     # We might possibly have a version of DLD around.
81     lddlflags="-r $lddlflags"
82     so='sa'
83     dlext='o'
84     ## If you are using DLD 3.2.4 which does not support shared libs,
85     ## uncomment the next two lines:
86     #ldflags="-static"
87     #so='none'
88 fi
89 rm -rf try.c a.out
90
91 cat <<'EOM'
92
93 You should take a look at hints/linux.sh. There are a some lines you
94 may wish to change.
95 EOM
96
97 # And -- reported by one user:
98 # We need to get -lc away from the link lines.
99 # If we leave it there we get SEGV from miniperl during the build.
100 # This may have to do with bugs in the pre-release version of libc for ELF.
101 # Uncomment the next two lines to remove -lc from the link line.
102 # set `echo " $libswanted " | sed -e 's@ c @ @'`
103 # libswanted="$*"