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