This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.001 patch.1d
[perl5.git] / hints / linux.sh
CommitLineData
1aef975c 1# hints/linux.sh
a0d0e21e 2# Original version by rsanders
1fc4cb55 3# Additional support by Kenneth Albanowski <kjahds@kjahds.com>
1aef975c 4#
232e078e
AD
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>
1aef975c 8#
232e078e 9# Consolidated by Andy Dougherty <doughera@lafcol.lafayette.edu>
1fc4cb55 10#
232e078e
AD
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
22case "$prefix" in
23'') prefix='/usr' ;;
24esac
1fc4cb55 25
232e078e 26# Perl expects BSD style signal handling.
5d94fbed
AD
27# gcc defines _G_HAVE_BOOL to 1, but doesn't actually supply bool.
28ccflags="-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL $ccflags"
1fc4cb55 29
5d94fbed 30# The following functions are gcc built-ins, but the Configure tests
232e078e
AD
31# may fail because it doesn't supply a proper prototype.
32d_memcmp=define
33d_memcpy=define
34
35# Configure may fail to find lstat() since it's a static/inline
36# function in <sys/stat.h>.
37d_lstat=define
1aef975c 38
a0d0e21e 39d_dosuid='define'
1aef975c 40
a0d0e21e 41malloctype='void *'
1aef975c
AD
42usemymalloc='n'
43
44case "$optimize" in
45'') optimize='-O2' ;;
46esac
47
232e078e
AD
48# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
49# for this test.
50cat >try.c <<'EOM'
51/* Test for whether ELF binaries are produced */
52#include <fcntl.h>
53#include <stdlib.h>
54main() {
55 char buffer[4];
56 int i=open("a.out",O_RDONLY);
57 if(i==-1)
58 exit(1); /* fail */
59 if(read(i,&buffer[0],4)<4)
60 exit(1); /* fail */
61 if(buffer[0] != 127 || buffer[1] != 'E' ||
62 buffer[2] != 'L' || buffer[3] != 'F')
63 exit(1); /* fail */
64 exit(0); /* succeed (yes, it's ELF) */
65}
66EOM
67if gcc try.c >/dev/null 2>&1 && ./a.out; then
68 cat <<'EOM'
69
70You appear to have ELF support. I'll try to use it for dynamic loading.
71EOM
5d94fbed 72 # Configure now handles these automatically.
232e078e
AD
73else
74 echo "You don't have an ELF gcc, using dld if available."
75 # We might possibly have a version of DLD around.
76 lddlflags="-r $lddlflags"
5d94fbed
AD
77 # These empty values are so that Configure doesn't put in the
78 # Linux ELF values.
79 ccdlflags=' '
80 cccdlflags=' '
1aef975c
AD
81 so='sa'
82 dlext='o'
83 ## If you are using DLD 3.2.4 which does not support shared libs,
84 ## uncomment the next two lines:
85 #ldflags="-static"
86 #so='none'
232e078e
AD
87fi
88rm -rf try.c a.out
a0d0e21e 89
232e078e 90cat <<'EOM'
a0d0e21e 91
1aef975c 92You should take a look at hints/linux.sh. There are a some lines you
232e078e 93may wish to change.
a0d0e21e 94EOM
232e078e
AD
95
96# And -- reported by one user:
97# We need to get -lc away from the link lines.
98# If we leave it there we get SEGV from miniperl during the build.
99# This may have to do with bugs in the pre-release version of libc for ELF.
100# Uncomment the next two lines to remove -lc from the link line.
101# set `echo " $libswanted " | sed -e 's@ c @ @'`
102# libswanted="$*"