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