summaryrefslogtreecommitdiff
path: root/configure
blob: 18dc70a8960f1b664d7133d6f089903aaaed451f (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh

for i in `seq 30`; do
    echo "Lots of output to emulate automake... ok"
    echo "Testing for things you'll never use... fail"
    echo "Satisfying the fortran77 lobby... ok"
    echo "Burning CPU time checking for the bloody obvious... ok"
done
echo "Automake emulated successfully"

INST_ROOT='/usr/local'
prefix="/usr/local"

for arg in $*; do
    shift 1
    case $arg in
        "--prefix" | "-p") 
            prefix=shift $*
            ;;
        --prefix=*)
            prefix=`echo $arg | sed 's/^--prefix=//g'`
            ;;
        "--help" | "-h") 
            echo "Usage:"
            echo "      --prefix | -p: The prefix to install to"
            break;
            ;;
        *) echo "Unrecognized argument $arg";;
    esac
done

OS=`uname`
MACH=`uname -m`

echo export INST_ROOT=$prefix > config.mk

echo '#define Instroot "'$prefix'"' > config.h
echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
echo '#define Arcmd {"ar", "-rcs", NULL}' >> config.h
echo '#define Ldcmd {"ld", "-o", NULL}' >> config.h
echo '#define Defaultasm Gnugas' >> config.h
echo '#define Objsuffix ".o"' >> config.h
echo 'export SYSCLASS=posixy' >> config.mk
case $OS in
    *Linux*)
        echo '#define Symprefix ""' >> config.h
        echo '#define Defaultasm Gnugas' >> config.h
        echo 'export SYS=linux' >> config.mk
        ;;
    *Darwin*)
        echo '#define Symprefix "_"' >> config.h
        echo 'export SYS=osx' >> config.mk
        ;;
    *FreeBSD*)
        echo '#define Symprefix ""' >> config.h
        echo '#define Defaultasm Gnugas' >> config.h
        echo 'export SYS=freebsd' >> config.mk
        ;;
    *)
        echo ''
        echo '********************************'
        echo 'Unknown system'
        echo 'Cannot build'
        echo '********************************'
        rm -f config.h config.mk
        exit 1
        ;;
esac

case $MACH in
    *x86_64*)
        echo 'export ARCH=x64' >> config.mk
        ;;
    *)
        echo ''
        echo '********************************'
        echo 'Unknown system'
        echo 'Cannot build'
        echo '********************************'
esac

cat << EOF
    Building with:
        prefix=$prefix
EOF