Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / build
blobfc2ba4c85de4f843033107f01b064ed2e2a1a8ca
1 #! /bin/sh
3 LOGF=make.log
4 IAM=`hostname || uname -n`
5 MYNAME=`IFS=. ; set $IAM ; echo $1`
6 SIG=
8 case "$1" in
9 0.*)
10 SIG=$1
11 shift
12 CONFIG_ARGS="$@"
13 KEY=`sed -e q < .buildkey-$MYNAME`
14 case "$SIG" in
15 $KEY) ;;
17 echo "Wrong directory for build on host $IAM"
18 echo "This is <`pwd`>"
19 echo "SIG is <$SIG>"
20 echo "KEY is <$KEY>"
21 exit 1
23 esac
26 CONFIG_ARGS="$@"
28 esac
30 #set -e
31 #set -x
33 # scripts/cvo.sh invokes config.guess, and we want it to use the copy
34 # in the top directory (alongside build) if there's not another
35 # config.guess earlier on the path, so we invoke it using env to append
36 # . to the PATH.
38 CVO=`env PATH="$PATH:." scripts/cvo.sh @cvo@`
39 case "$CVO" in
40 *-*-*-*) "echo scripts/cvo.sh returned <$CVO>, which makes no sense to me."
41 exit 1
43 *-*-*) ;;
44 *) echo "scripts/cvo.sh returned <$CVO>, which makes no sense to me."
45 exit 1
47 esac
49 case "$IAM" in
50 *.udel.edu)
51 BASEDIR=A.$MYNAME
52 CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts"
53 case "$CVO" in
54 *-*-ultrix*)
55 CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local"
57 esac
60 BASEDIR=A.$CVO
62 esac
64 KEYSUF=""
66 case "$CONFIG_ARGS" in
67 *--with-crypto=autokey*)
68 KEYSUF="-autokey"
70 *--without-crypto*)
71 KEYSUF="-noopenssl"
73 esac
75 case "$CONFIG_ARGS" in
76 *--disable-all-clocks*)
77 KEYSUF="$KEYSUF-no-refclocks"
79 esac
81 case "$CONFIG_ARGS" in
82 *--disable-debugging*)
83 KEYSUF="$KEYSUF-nodebug"
85 esac
87 CCSUF=""
89 case "$CC" in
90 '') ;;
91 *) CCSUF="-$CC"
93 esac
95 BDIR="$BASEDIR$KEYSUF$CCSUF"
97 [ -d "$BDIR" ] || mkdir $BDIR
98 [ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo
99 [ -f "$BDIR/.buildhost" ] || echo $IAM > $BDIR/.buildhost
102 cd $BDIR
105 # Make sure we have a nice that works.
106 # To disable use of nice make a dummy nice script such
107 # as the heredoc a few lines below and set BNICE to its
108 # path.
111 nice true && NICEB=nice
112 nice true || {
113 NICEB=./.nicebuild-$MYNAME-$SIG
114 cat > .nicebuild-$MYNAME-$SIG <<-HEREDOC
115 #! /bin/sh
116 shift
118 HEREDOC
119 chmod +x .nicebuild-$MYNAME-$SIG
124 [ -f config.status ] || $NICEB -7 ../configure \
125 --cache-file=../config.cache-$IAM \
126 $CONFIG_ARGS
128 $NICEB -5 ./config.status
130 case "$MAKE" in
131 '') $NICEB -14 make && $NICEB -10 make check
133 *) $NICEB -14 $MAKE && $NICEB -10 $MAKE check
135 esac
136 ) > $LOGF 2>&1
139 # clean up if we made a dummy nice script
140 [ -f .nicebuild-$MYNAME-$SIG ] && rm .nicebuild-$MYNAME-$SIG