xref: /freebsd/contrib/ntp/bootstrap (revision 98e0ffaefb0f241cda3a72395d3be04192ae0d47)
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# 20060629: HMS: Let's try checking in libopts and the autogen-generated files
54## The copy for ntp...
55#rm -rf libopts*
56#gunzip -c $(autoopts-config --libsrc) | (
57#  tar -xvf -
58#  mv libopts-*.*.* libopts )
59
60## The copy for sntp...
61#rm -rf sntp/libopts*
62#gunzip -c $(autoopts-config --libsrc) | (
63#  cd sntp
64#  tar -xvf -
65#  mv libopts-*.*.* libopts )
66
67def_files=`find [B-Za-z]* -type f -name '*.def' -print | fgrep -v /SCCS/`
68prog_opt_files=`grep -l '^prog.name' $def_files`
69
70## AutoGen stuff
71
72#incdir=${PWD}/include
73
74#for f in ${prog_opt_files}
75#do
76#  ( cd $(dirname ${f})
77#    echo "Running autogen on $f..."
78#    autogen -L${incdir} $(basename ${f})
79#  ) || exit 1
80#done
81
82## Non-AutoGen stuff
83
84# touch the stuff generated by the opt files
85
86l=
87lh=
88li=
89for f in ${prog_opt_files}
90do
91    f=`echo $f | sed -e 's/-opts.def//' -e 's/.def//'`
92    dfi=`dirname $f`
93    dfi=`echo $dfi | sed -e 's:$:/invoke-*:'`
94    for i in `ls -1 $f* $dfi`
95    do
96	case "$i" in
97	 *invoke-*)
98	    li="$li $i"
99	    ;;
100	 *.c|*.h|*.[1-9]*man|*.[1-9]*mdoc|*.man.in|*.mdoc.in|*-opts|*.texi|*.menu)
101	    l="$l $i"
102	    ;;
103	 *.html)
104	    lh="$lh $i"
105	    ;;
106	esac
107    done
108done
109case "$l" in
110 '') ;;
111 *) touch $l
112    echo "Touching <$l>"
113    sleep 1
114    ;;
115esac
116case "$li" in
117 '') ;;
118 *) touch $li
119    echo "Touching <$li>"
120    sleep 1
121    ;;
122esac
123case "$lh" in
124 '') ;;
125 *) touch $lh
126    echo "Touching <$lh>"
127    ;;
128esac
129
130## EOAutoGen stuff
131
132# Yacc/bison files ntp_parser.[ch] so we don't require the tool if
133# ntp_parser.y hasn't been updated.  At the same time, keyword-gen-utd
134# and ntp_keyword.h which are derived from ntp_parser.h and
135# keyword-gen.c.
136
137touch ntpd/ntp_parser.[ch] ntpd/keyword-gen-utd ntpd/ntp_keyword.h
138
139cp bincheck.mf sntp/
140cp depsver.mf sntp/
141
142${AUTORECONF} -i -v "$@"
143
144# Because some systems do not support 'test a -nt b'
145case `ls -1tr config.h.in aclocal.m4 | tail -1` in
146 aclocal.m4) touch config.h.in ;;
147esac
148case `ls -1tr sntp/config.h.in sntp/aclocal.m4 | tail -1` in
149 sntp/aclocal.m4) touch sntp/config.h.in ;;
150esac
151case `ls -1tr sntp/libevent/config.h.in sntp/libevent/aclocal.m4 | tail -1` in
152 sntp/libevent/aclocal.m4) touch sntp/libevent/config.h.in ;;
153esac
154
155# DH: 20110118: Due to our workaround for the AM_COND_IF bug that was
156# triggering the buggy recursive autoreconf, we can once again use a
157# single autoreconf invocation.  See
158# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7860
159# DH: 20101120: We are back to a single copy of libopts, and
160# once again it seems we need to run autoreconf in sntp after
161# the top-level run to get a correct sntp/libopts/Makefile.in.
162# To reduce redundancy, the top-level autoreconf uses --no-recursive.
163#
164# HMS: 20060618: Now that we use separate copies of libopts
165# we should only need the previous line.
166#
167## HMS: 20060615: the next line seems to be needed to make sure
168## we get the correct srcdir path in sntp/libopts/Makefile.in
169#rm -rf sntp/autom4te.cache
170#
171# (cd sntp && ${AUTORECONF} -i -v "$@")
172