4 IAM=`hostname || uname -n`
5 MYNAME=`IFS=. ; set $IAM ; echo $1`
13 KEY=`sed -e q < .buildkey-$MYNAME`
17 echo "Wrong directory for build on host $IAM"
18 echo "This is <`pwd`>"
33 if [ ! -r sntp/libevent/build-aux/config.guess ] ; then
34 echo "Error: bootstrap required." 1>&2 && exit 1
37 # sntp/scripts/cvo.sh invokes config.guess, and we want it to use the copy
38 # in the build-aux directory if there's not another config.guess earlier
39 # on the path, so we invoke it using env to append to the PATH.
41 CVO=`env PATH="$PATH:./sntp/libevent/build-aux" sntp/scripts/cvo.sh @cvo@`
43 *-*-*-*) echo "sntp/scripts/cvo.sh returned <$CVO>, which makes no sense to me."
47 *) echo "sntp/scripts/cvo.sh returned <$CVO>, which makes no sense to me."
60 # HMS: --enable-local-libopts is the default now...
61 #CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts"
64 CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local"
83 echo "build: NTP_BDIR must be either 'cvo' or 'host'!" 1>&2
90 case "$CONFIG_ARGS" in
91 *--with-crypto=autokey*)
99 case "$CONFIG_ARGS" in
100 *--disable-all-clocks*)
101 KEYSUF="$KEYSUF-no-refclocks"
105 case "$CONFIG_ARGS" in
106 *--disable-debugging*)
107 KEYSUF="$KEYSUF-nodebug"
116 CCSUF="-`echo $CC | sed -e 's: :_:g' -e's:/:+:g'`"
120 BDIR="$BASEDIR$KEYSUF$CCSUF"
122 [ -d "$BDIR" ] || mkdir $BDIR
123 [ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo
124 [ -f "$BDIR/.buildhost" ] || echo $IAM > $BDIR/.buildhost
130 # Make sure we have a nice that works.
131 # To disable use of nice, setenv NO_NICE_BUILD=1
134 [ "$NO_NICE_BUILD" != "1" ] && nice true && NICEB=nice
136 NICEB="./.nicebuild-$MYNAME-$SIG"
137 cat > $NICEB <<-HEREDOC
146 # Find a test which supports -nt, unlike Solaris /bin/sh builtin.
149 if [ -z "$TEST" ] ; then
150 for try in test /bin/test /usr/bin/test ; do
151 case `$try config.status -nt ../configure 2>&1` in
159 if [ -z "$TEST" ] ; then
160 echo "build: need help finding test binary" 1>&2
165 CONFIGURE="../configure"
166 # We need KEYSUF because of RAND_ and others, and -noopenssl"
167 #CONFIGURE="$CONFIGURE --cache-file=../config.cache-$IAM$KEYSUF$CCSUF"
168 CONFIGURE="$CONFIGURE $CONFIG_ARGS"
171 ( # This sequence of commands is logged to make.log.
172 # If config.status is newer than ../configure, and the same
173 # is true for sntp, we do not need to re-run configure.
174 # For libevent, the twist is we may not be configuring the
175 # tearoff, so only act if its config.status exists.
176 # Solaris /bin/sh doesn't grok -nt.
178 ( "$TEST" config.status -nt ../configure &&
179 "$TEST" sntp/config.status -nt ../sntp/configure &&
180 ( "$TEST" '!' -f sntp/libevent/config.status ||
181 "$TEST" sntp/libevent/config.status -nt ../sntp/libevent/configure ) ) ||
182 "$NICEB" -7 $CONFIGURE
183 "$TEST" Makefile -nt config.status ||
184 "$NICEB" -5 ./config.status
185 "$TEST" sntp/Makefile -nt sntp/config.status ||
186 ( cd sntp && "$NICEB" -5 ./config.status )
187 "$TEST" '!' -f sntp/libevent/Makefile ||
188 "$TEST" sntp/libevent/Makefile -nt sntp/libevent/config.status ||
189 ( cd sntp/libevent && "$NICEB" -5 ./config.status )
190 "$NICEB" -14 ${MAKE-make} && "$NICEB" -11 ${MAKE-make} check
195 # clean up if we made a dummy nice script