-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoconfigure
executable file
·51 lines (51 loc) · 1.61 KB
/
autoconfigure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/csh
rm -f test.c test.out compiler config.h
echo "Determining whether you have gcc..."
echo "main(){}" >test.c
gcc -c test.c >&test.out
echo "Creating 'compiler'..."
if ( -z test.out ) then
set compile=gcc
echo "CC=gcc" >compiler
# echo "CFLAGS=-O2 -funroll-loops" >> compiler # does not work with 1.42!
echo "CFLAGS=-O2" >> compiler
else
set compile=cc
echo "CC=cc" >compiler
echo "CFLAGS=-O" >> compiler
endif
cat compiler
rm -f test.o test.out test.c
echo "Determining whether your compiler understands the 'signed' keyword..."
echo "main(){signed char a;}" >test.c
$compile -c test.c >&test.out
set signed=0
if ( -z test.out ) set signed=1
#ar cq test.a test.o
#ranlib test.a >&test.out
#set ranlib=0
#if ( -z test.out ) set ranlib=1
rm -f test.a test.o test.out test.c
echo "Determining whether your C library includes the 'mmap' and 'munmap' routines..."
echo "extern void mmap();extern void munmap();main(){mmap();munmap();}" >test.c
$compile test.c >&test.out
set mmap=0
if ( -z test.out ) set mmap=1
rm -f test.o test.out test.c
echo "Determining whether your C library includes the 'sbrk' routine..."
echo "extern void sbrk();main(){sbrk();}" >test.c
$compile test.c >&test.out
set sbrk=0
if ( -z test.out ) set sbrk=1
rm -f test.out test.c test.o a.out
#if ( $ranlib ) then
# echo "rlib=ranlib" >>compiler
#else
# echo "rlib=echo" >>compiler
#endif
echo "Creating 'config.h'..."
echo "/* This file was created by the 'autoconfigure' procedure.*/" >config.h
if ( ! $signed ) echo "#define NO_SIGNED_CHAR" >>config.h
if ( ! $mmap ) echo "#define NO_MMAP" >> config.h
if ( ! $sbrk ) echo "#define NO_SBRK" >> config.h
cat config.h