xref: /netbsd-src/external/bsd/ntp/dist/bootstrap (revision f17b710f3d406bee67aa39c65053114ab78297c5)
1abb0f93cSkardel#! /bin/sh
2abb0f93cSkardel
3abb0f93cSkardel#  This "bootstrap" script performs various pre-autoreconf actions
4abb0f93cSkardel#  that are required after pulling fresh sources from the repository.
5abb0f93cSkardel#
6f003fb54Skardel#  --force is supported and will be passed to autoreconf
7f003fb54Skardel#
8abb0f93cSkardel#  NOTE:  THE NTP VERSION NUMBER COMES FROM packageinfo.sh
9abb0f93cSkardel#
10abb0f93cSkardel#  all other instances of it anywhere in the source base have propagated
11abb0f93cSkardel#  from this one source.
12abb0f93cSkardel#
13abb0f93cSkardel#  To use the raw sources from the repository, you must have the following
14abb0f93cSkardel#  tools available to you:
15abb0f93cSkardel#
16abb0f93cSkardel#  1.  Autoconf and Automake.
17abb0f93cSkardel#
18abb0f93cSkardel#  2.  lynx.  This is used to extract the COPYRIGHT file extracted from
19abb0f93cSkardel#      the html documentation.
20abb0f93cSkardel#
21abb0f93cSkardel#  *** The following are no longer needed for simple builds from the repo
22abb0f93cSkardel#  3.  AutoGen.  The repository does *not* contain the files generated from
23abb0f93cSkardel#      the option definition files and it does not contain the libopts
24abb0f93cSkardel#      tear-off/redistributable library.
25abb0f93cSkardel#
26abb0f93cSkardel#      Note: AutoGen needs GNU Guile.
27abb0f93cSkardel#
28abb0f93cSkardel#  4.  gunzip.  The tear-off library is a gzipped tarball.
29abb0f93cSkardel
30abb0f93cSkardelset -e
31abb0f93cSkardel
328585484eSchristos(cd sntp  && ../scripts/build/genver) || {
338585484eSchristos    echo scripts/build/genver failed ; exit 1; }
34abb0f93cSkardel
35abb0f93cSkardel# autoreconf says:
36abb0f93cSkardel# The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
37abb0f93cSkardel# AUTOPOINT, LIBTOOLIZE, M4 are honored.
38abb0f93cSkardel
39abb0f93cSkardelAUTORECONF=${AUTORECONF:-autoreconf}
40abb0f93cSkardel
418585484eSchristos# case `hostname` in
428585484eSchristos#  pogo.udel.edu)
438585484eSchristos#     if fgrep -q 4.2.4 sntp/m4/version.m4; then
448585484eSchristos# 	AUTOCONF=autoconf-2.59
458585484eSchristos# 	AUTOHEADER=autoheader-2.59
468585484eSchristos# 	AUTOMAKE=automake-1.9
478585484eSchristos# 	ACLOCAL=aclocal-1.9
488585484eSchristos# 	export AUTOCONF AUTOHEADER AUTOMAKE ACLOCAL
498585484eSchristos#     fi
508585484eSchristos#     ;;
518585484eSchristos# esac
52abb0f93cSkardel
53*f17b710fSchristos## Old way
54abb0f93cSkardel# 20060629: HMS: Let's try checking in libopts and the autogen-generated files
55abb0f93cSkardel## The copy for ntp...
56abb0f93cSkardel#rm -rf libopts*
57abb0f93cSkardel#gunzip -c $(autoopts-config --libsrc) | (
58abb0f93cSkardel#  tar -xvf -
59abb0f93cSkardel#  mv libopts-*.*.* libopts )
60abb0f93cSkardel
61abb0f93cSkardel## The copy for sntp...
62abb0f93cSkardel#rm -rf sntp/libopts*
63abb0f93cSkardel#gunzip -c $(autoopts-config --libsrc) | (
64abb0f93cSkardel#  cd sntp
65abb0f93cSkardel#  tar -xvf -
66abb0f93cSkardel#  mv libopts-*.*.* libopts )
67abb0f93cSkardel
68*f17b710fSchristos## EOOld way
69*f17b710fSchristos
70*f17b710fSchristos## Unity test runners
71*f17b710fSchristos# the ruby generator must be older than the test files.
72*f17b710fSchristos# the test files must be older than the runner files.
73*f17b710fSchristos
74*f17b710fSchristosrunner_files=`find [B-Za-z]* -type f -name 'run-*' -print | fgrep -v /SCCS/`
75*f17b710fSchristosl=
76*f17b710fSchristoslt=
77*f17b710fSchristoslr=
78*f17b710fSchristosfor f in ${runner_files}
79*f17b710fSchristosdo
80*f17b710fSchristos    fb=`echo $f | sed -e 's/run-//'`
81*f17b710fSchristos    lt="$lt $fb"
82*f17b710fSchristos    lr="$lr $f"		# Yes, lr and runner_files are eventually the same
83*f17b710fSchristosdone
84*f17b710fSchristostouch $lt
85*f17b710fSchristosecho "Touching <$lt>"
86*f17b710fSchristossleep 1
87*f17b710fSchristostouch $lr
88*f17b710fSchristosecho "Touching <$lr>"
89*f17b710fSchristos
90*f17b710fSchristos## EOUnity test runners
91abb0f93cSkardel
92abb0f93cSkardel## AutoGen stuff
93abb0f93cSkardel
94*f17b710fSchristosdef_files=`find [B-Za-z]* -type f -name '*.def' -print | fgrep -v /SCCS/`
95*f17b710fSchristosprog_opt_files=`grep -l '^prog.name' $def_files`
96abb0f93cSkardel
97abb0f93cSkardel# touch the stuff generated by the opt files
98abb0f93cSkardel
99b8ecfcfeSchristosl=
100b8ecfcfeSchristoslh=
101b8ecfcfeSchristosli=
102abb0f93cSkardelfor f in ${prog_opt_files}
103abb0f93cSkardeldo
1048585484eSchristos    f=`echo $f | sed -e 's/-opts.def//' -e 's/.def//'`
1058585484eSchristos    dfi=`dirname $f`
1068585484eSchristos    dfi=`echo $dfi | sed -e 's:$:/invoke-*:'`
1078585484eSchristos    for i in `ls -1 $f* $dfi`
108abb0f93cSkardel    do
109abb0f93cSkardel	case "$i" in
110b8ecfcfeSchristos	 *invoke-*)
111b8ecfcfeSchristos	    li="$li $i"
112b8ecfcfeSchristos	    ;;
113b8ecfcfeSchristos	 *.c|*.h|*.[1-9]*man|*.[1-9]*mdoc|*.man.in|*.mdoc.in|*-opts|*.texi|*.menu)
114abb0f93cSkardel	    l="$l $i"
115abb0f93cSkardel	    ;;
116f003fb54Skardel	 *.html)
117f003fb54Skardel	    lh="$lh $i"
118f003fb54Skardel	    ;;
119abb0f93cSkardel	esac
120abb0f93cSkardel    done
121b8ecfcfeSchristosdone
122b8ecfcfeSchristoscase "$l" in
123b8ecfcfeSchristos '') ;;
124b8ecfcfeSchristos *) touch $l
125b8ecfcfeSchristos    echo "Touching <$l>"
126b8ecfcfeSchristos    sleep 1
127abb0f93cSkardel    ;;
128abb0f93cSkardelesac
129b8ecfcfeSchristoscase "$li" in
130b8ecfcfeSchristos '') ;;
131b8ecfcfeSchristos *) touch $li
132b8ecfcfeSchristos    echo "Touching <$li>"
133b8ecfcfeSchristos    sleep 1
134b8ecfcfeSchristos    ;;
135b8ecfcfeSchristosesac
136b8ecfcfeSchristoscase "$lh" in
137b8ecfcfeSchristos '') ;;
138b8ecfcfeSchristos *) touch $lh
139b8ecfcfeSchristos    echo "Touching <$lh>"
140b8ecfcfeSchristos    ;;
141b8ecfcfeSchristosesac
142abb0f93cSkardel
143abb0f93cSkardel## EOAutoGen stuff
144abb0f93cSkardel
145*f17b710fSchristos## Yacc/bison files
146*f17b710fSchristos
147f003fb54Skardel# Yacc/bison files ntp_parser.[ch] so we don't require the tool if
148f003fb54Skardel# ntp_parser.y hasn't been updated.  At the same time, keyword-gen-utd
149f003fb54Skardel# and ntp_keyword.h which are derived from ntp_parser.h and
150f003fb54Skardel# keyword-gen.c.
151abb0f93cSkardel
152f003fb54Skardeltouch ntpd/ntp_parser.[ch] ntpd/keyword-gen-utd ntpd/ntp_keyword.h
153abb0f93cSkardel
154*f17b710fSchristos## EOYacc/bison files
155*f17b710fSchristos
156abb0f93cSkardelcp bincheck.mf sntp/
157abb0f93cSkardelcp depsver.mf sntp/
158abb0f93cSkardel
1598585484eSchristos${AUTORECONF} -i -v "$@"
160abb0f93cSkardel
161b8ecfcfeSchristos# Because some systems do not support 'test a -nt b'
162b8ecfcfeSchristoscase `ls -1tr config.h.in aclocal.m4 | tail -1` in
163b8ecfcfeSchristos aclocal.m4) touch config.h.in ;;
164b8ecfcfeSchristosesac
165b8ecfcfeSchristoscase `ls -1tr sntp/config.h.in sntp/aclocal.m4 | tail -1` in
166b8ecfcfeSchristos sntp/aclocal.m4) touch sntp/config.h.in ;;
167b8ecfcfeSchristosesac
168b8ecfcfeSchristoscase `ls -1tr sntp/libevent/config.h.in sntp/libevent/aclocal.m4 | tail -1` in
169b8ecfcfeSchristos sntp/libevent/aclocal.m4) touch sntp/libevent/config.h.in ;;
170b8ecfcfeSchristosesac
171b8ecfcfeSchristos
1728585484eSchristos# DH: 20110118: Due to our workaround for the AM_COND_IF bug that was
1738585484eSchristos# triggering the buggy recursive autoreconf, we can once again use a
1748585484eSchristos# single autoreconf invocation.  See
1758585484eSchristos# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7860
176f003fb54Skardel# DH: 20101120: We are back to a single copy of libopts, and
177f003fb54Skardel# once again it seems we need to run autoreconf in sntp after
178f003fb54Skardel# the top-level run to get a correct sntp/libopts/Makefile.in.
179f003fb54Skardel# To reduce redundancy, the top-level autoreconf uses --no-recursive.
180f003fb54Skardel#
181abb0f93cSkardel# HMS: 20060618: Now that we use separate copies of libopts
182abb0f93cSkardel# we should only need the previous line.
183abb0f93cSkardel#
184abb0f93cSkardel## HMS: 20060615: the next line seems to be needed to make sure
185abb0f93cSkardel## we get the correct srcdir path in sntp/libopts/Makefile.in
186abb0f93cSkardel#rm -rf sntp/autom4te.cache
187abb0f93cSkardel#
1888585484eSchristos# (cd sntp && ${AUTORECONF} -i -v "$@")
189