xref: /freebsd/contrib/ntp/build (revision cc16dea626cf2fc80cde667ac4798065108e596c)
1#! /bin/sh
2
3LOGF=make.log
4IAM=`hostname || uname -n`
5MYNAME=`IFS=. ; set $IAM ; echo $1`
6SIG=
7
8case "$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) ;;
16     *)
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
22        ;;
23    esac
24    ;;
25 *)
26    CONFIG_ARGS="$@"
27    ;;
28esac
29
30#set -e
31#set -x
32
33CVO=`./config.guess`
34case "$CVO" in
35 *-*-*) ;;
36 *) echo "config.guess returned <$CVO>, which makes no sense to me."
37    exit 1
38    ;;
39esac
40
41case "$IAM" in
42 *.udel.edu)
43    BDIR=A.$MYNAME
44    CONFIG_ARGS="$CONFIG_ARGS --enable-local-libopts"
45    case "$CVO" in
46     *-*-ultrix*)
47	CONFIG_ARGS="$CONFIG_ARGS --with-libregex=/usr/local"
48	;;
49    esac
50    ;;
51 *)
52    BDIR=A.$CVO
53    ;;
54esac
55
56KEYSUF=""
57
58case "$CONFIG_ARGS" in
59 *--with-crypto=autokey*)
60    KEYSUF="-autokey"
61    ;;
62 *--without-crypto*)
63    KEYSUF="-noopenssl"
64    ;;
65esac
66
67case "$CONFIG_ARGS" in
68 *--disable-all-clocks*)
69    KEYSUF="$KEYSUF-no-refclocks"
70    ;;
71esac
72
73case "$CONFIG_ARGS" in
74 *--disable-debugging*)
75    KEYSUF="$KEYSUF-nodebug"
76    ;;
77esac
78
79CCSUF=""
80
81case "$CC" in
82 '') ;;
83 *) CCSUF="-$CC"
84    ;;
85esac
86
87BDIR="$BDIR$KEYSUF$CCSUF"
88
89[ -d "$BDIR" ] || mkdir $BDIR
90[ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo
91[ -f "$BDIR/.buildhost" ] || echo $IAM > $BDIR/.buildhost
92
93
94cd $BDIR
95
96#
97# make sure we have a nice that works,
98#
99nice true && NICEB=nice
100nice true || NICEB=./.nicebuild-$MYNAME-$SIG && (
101    cat > .nicebuild-$MYNAME-$SIG <<UNLYKUHLY
102#! /bin/sh
103shift
104\$*
105UNLYKUHLY
106    chmod +x .nicebuild-$MYNAME-$SIG
107)
108
109
110(
111[ -f config.status ] || $NICEB -7 ../configure --config-cache \
112				$CONFIG_ARGS
113
114$NICEB -5 ./config.status
115
116case "$MAKE" in
117 '') $NICEB -14 make && $NICEB -10 make check
118     ;;
119 *)  $NICEB -14 $MAKE && $NICEB -10 $MAKE check
120     ;;
121esac
122) > $LOGF 2>&1
123