-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathconfigure
executable file
·95 lines (82 loc) · 2.68 KB
/
configure
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
87
88
89
90
91
92
93
94
95
#!/usr/bin/env sh
# csrc/configure
#
# Part of the CCNx distribution.
#
# Copyright (C) 2009-2013 Palo Alto Research Center, Inc.
#
# This work is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Free Software Foundation.
# This work is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.
#
CONFDIR="`dirname $0`/conf"
TryAppend () {
test -f "$CONFDIR"/"$1".mk || return 0
sed -e '/^[#] /d' "$CONFDIR"/"$1".mk >> conf.mk
}
TryScript () {
SCRIPT="$CONFDIR"/"$1".sh
shift
test -f "$SCRIPT" || return 0
sh "$SCRIPT" "$@"
}
ProvideDefault () {
value=`eval 'echo ${'${1}':-:EMPTY:}'`
[ "$value" != ":EMPTY:" ] && echo ${1} = $value >> conf.mk && return 0
[ "$2" = "=" ] || return 0
grep '^'${1}'[ ]*=' conf.mk > /dev/null && return 0
echo $* >> conf.mk
}
test -f conf.mk && mv conf.mk conf.mk~
echo '#' generated `uname -nsrv` > conf.mk
# Append each of the relevant conf/*.mk,
# in order by increasing specificity.
TryAppend "`uname`"
TryAppend "`uname -sr | sed -e 's/ /-/g'`"
# Next the relevant scripts, that get to do whatever is needed.
TryScript "`uname`" "$@"
# Local overrides happen next
TryAppend "local"
TryScript "local" "$@"
# CFLAGS take some extra care.
# Save these as COPT in conf.mk
[ -z "$CFLAGS" ] || echo COPT = $CFLAGS >> conf.mk
# Finally, provide default values and pick up overrides from the environment
ProvideDefault COPT = -g
ProvideDefault CWARNFLAGS
ProvideDefault PLATCFLAGS
ProvideDefault CPREFLAGS
ProvideDefault INSTALL_BASE = /usr/local
ProvideDefault INSTALL_INCLUDE = '$(INSTALL_BASE)/include'
ProvideDefault INSTALL_LIB = '$(INSTALL_BASE)/lib'
ProvideDefault INSTALL_BIN = '$(INSTALL_BASE)/bin'
ProvideDefault PCAP_PROGRAMS = ccndumppcap
ProvideDefault RESOLV_LIBS = -lresolv
: ${ANT:=`command -v ant || echo echo SKIPPING ant`}
ProvideDefault ANT
ProvideDefault AR
ProvideDefault CC
ProvideDefault CP = cp
ProvideDefault INSTALL = install
ProvideDefault LS = /bin/ls
ProvideDefault RM = rm -f
ProvideDefault SH = /bin/sh
ProvideDefault MKDEP = gcc -MM
# For the benefit of makefiles outside of csrc
ProvideDefault BUILD_JAVA = true
grep '^BUILD_JAVA[ ]*=' conf.mk | tail -n 1 | grep 'true' >/dev/null || \
echo ANT = : skipping ant >> conf.mk
cat <<'EOF' >> conf.mk
DINST_BIN = $(DESTDIR)$(INSTALL_BIN)
DINST_INC = $(DESTDIR)$(INSTALL_INCLUDE)
DINST_LIB = $(DESTDIR)$(INSTALL_LIB)
EOF
echo ============= conf.mk =============>&2
cat conf.mk >&2
echo ===================================>&2
make config_subdir
test -f conf.mk~ || exit 0
cmp conf.mk~ conf.mk || make clean