cliffmoon / dynomite

Open source dynamo clone written in Erlang.

This URL has Read+Write access

dynomite / bootstrap
100755 190 lines (159 sloc) 4.326 kb
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/sh
 
#
# GNU Autotools bootstrap script
# bones-0.0.79
#
 
datadir="/p/share"
 
bones_home="${datadir}/bones"
bones_version="0.0.79"
 
include_dir="bones-common"
link_common="yes"
 
lt_flags="--automake"
ah_flags="--force"
am_flags="--add-missing"
cf_flags="--config-cache"
 
want_auto_configure=${BONES_AUTOCONF:+true}
 
force_all=
need_automake=
need_configure=
 
fail () { echo "$0: failure: $*" >&2; exit 1; }
 
check_age ()
{
  for file in $*; do
if test -z "$need_automake" -a -e ${file}.am -a ${file}.am -nt ${file}.in ; then
need_automake=true
need_configure=true
break;
    elif test -z "$need_configure" -a -e ${file}.in -a ${file}.in -nt ${file} -o ! -e ${file}.in ; then
need_configure=true
fi
done
 
if test -z "${need_configure}" -a -e "$1" ; then
dbpath=$(rpm --eval='%_dbpath' 2>/dev/null)
 
    test -n "${dbpath}" || fail "unable to find rpm database directory"
    if test "${dbpath}/Packages" -nt "$1" ; then
unlink config.cache 2>/dev/null
      need_configure=true
fi
fi
}
 
try ()
{
  echo "+ $*"
  $* || exit 1
}
 
 
find_exec ()
{
var_name=$1
shift
 
while [ $# -ne 0 ]; do
exec_path=`which $1 | grep '^/'`
if test -n "$exec_path" -a -x "$exec_path" ; then
eval $var_name='$1'
break
fi
shift
done
}
 
 
usage ()
{
  cat <<-EOF
Usage: bootstrap [options]
Options:
  -f force regeneration of all needed files
  -F adds force flag to automake
  -i specify alternate include directory (currently ${include_dir})
  -n disable automatic execution of configure
  -N disable automatic include symbolic link generation
EOF
  exit 1
}
 
#
# Process command line options
#
 
while getopts fFhnNi: opt; do
case "$opt" in
    f) force_all=true
       ;;
    F) am_flags="${am_flags} --force-missing"
       ;;
    i) include_dir="$OPTARG";
       ;;
    n) unset want_auto_configure
       ;;
    N) unset link_common
       ;;
    h|*) usage
       ;;
  esac
done
 
shift $((OPTIND - 1))
 
#
# Create symbolic link to shared files area
#
 
if test -n "${link_common}"; then
bones_major="$(expr $bones_version : '\([^.]*\)')"
  test -h ${include_dir} || ln -s ${bones_home}/common-${bones_major} ${include_dir}
fi
 
if test -x "${include_dir}/bootstrap-chain"; then
exec "${include_dir}/bootstrap-chain"
elif test -r "${include_dir}/bootstrap-include"; then
source "${include_dir}/bootstrap-include"
fi
 
#
# Find our configure template
#
 
if test -f configure.ac; then
configure_ac=configure.ac
elif test -f configure.in; then
configure_ac=configure.in
else
echo "$0: \`configure.ac' does not exist" 1>&2
  exit 1
fi
 
if test -n "${force_all}"; then
rm -rf ./autom4te.cache 2>/dev/null
  touch *.ac *.am 2>/dev/null
fi
  
#
# Use autoconf to determine what features this configure.ac requires
# Execute those for which their output is stale
#
 
test -n "${force_all}" -o ${configure_ac} -nt aclocal.m4 && try aclocal -I ${include_dir}
 
autoconf -t AM_INIT_AUTOMAKE -t AC_CONFIG_HEADERS -t AM_PROG_LIBTOOL -t AC_CONFIG_FILES |
  awk -F: '/AC_CONFIG_FILES/ { print "0 ca "$NF } \
/AM_PROG_LIBTOOL/ { print "1 lt "$NF } \
/AC_CONFIG_HEADERS/ { print "2 ah "$NF } \
/AM_INIT_AUTOMAKE/ { print "3 am "$NF }
END { print "9 en" }' |
  sort -un |
  while read ord command args; do
case "$command" in
      ca) check_age $args
          ;;
      lt) find_exec my_libtoolize libtoolize glibtoolize
          try ${my_libtoolize} ${lt_flags}
          ;;
      ah) if test -n "${force_all}" -o ${configure_ac} -nt "${args}.in" ; then
try autoheader ${ah_flags}
            if test "${args}.in" -nt ${configure_ac} ; then
need_configure=true
elif test -e "${args}.in" ; then
touch "${args}.in"
            fi
fi
          ;;
      am) test -n "${force_all}" -o -n "${need_automake}" && try automake ${am_flags}
          ;;
      en) if test -n "${force_all}" -o ${configure_ac} -nt configure ; then
try autoconf -I ${include_dir}
            need_configure=true
fi
if test -n "${need_configure}" ; then
echo "* configure required"
            test -n "${want_auto_configure}" && exec ./configure ${cf_flags} $*
          fi
          ;;
    esac
done
 
exit 0