summaryrefslogtreecommitdiff
path: root/configure
blob: d274f967458c1b3f8ba76a962f2b44083468c4c5 (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
#!/bin/sh
#
# Cactus build repo configure script
# partially based on the Libav configure script
# Copyright (c) 2000-2002 Fabrice Bellard
# Copyright (c) 2005-2008 Diego Biurrun
# Copyright (c) 2005-2008 Mans Rullgard
#

# Prevent locale nonsense from breaking basic text processing.
LC_ALL=C
export LC_ALL

ln_s="ln -s -f"
logfile="config.log"

log(){
    echo "$@" >> $logfile
}

log_file(){
    log BEGIN $1
    pr -n -t $1 >> $logfile
    log END $1
}

echolog(){
    log "$@"
    echo "$@"
}

die(){
    echolog "$@"
    exit 1
}

# find source path
if test -f configure; then
    source_path=.
else
    source_path=$(cd $(dirname "$0"); pwd)
    echo "$source_path" | grep -q '[[:blank:]]' &&
        die "Out of tree builds are impossible with whitespace in source path."
    test -e "$source_path/config.h" &&
        die "Out of tree builds are impossible with config.h in source dir."
fi

test -e arrangements || $ln_s "$source_path/arrangements"
test -e lib          || $ln_s "$source_path/repos/cactus/lib"
test -e Makefile     || $ln_s "$source_path/repos/cactus/Makefile"
test -e src          || $ln_s "$source_path/repos/cactus/src"