xref: /netbsd-src/external/bsd/ntp/dist/bootstrap (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
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
86for f in ${prog_opt_files}
87do
88    f=`echo $f | sed -e 's/-opts.def//' -e 's/.def//'`
89    l=
90    lh=
91    dfi=`dirname $f`
92    dfi=`echo $dfi | sed -e 's:$:/invoke-*:'`
93    for i in `ls -1 $f* $dfi`
94    do
95	case "$i" in
96	 *.c|*.h|*.[1-9]*man|*.[1-9]*mdoc|*.man.in|*.mdoc.in|*.texi|*.menu)
97	    l="$l $i"
98	    ;;
99	 *.html)
100	    lh="$lh $i"
101	    ;;
102	esac
103    done
104    case "$l:$lh" in
105     ':') ;;
106     *) touch $l $lh
107	;;
108    esac
109done
110
111## EOAutoGen stuff
112
113# Yacc/bison files ntp_parser.[ch] so we don't require the tool if
114# ntp_parser.y hasn't been updated.  At the same time, keyword-gen-utd
115# and ntp_keyword.h which are derived from ntp_parser.h and
116# keyword-gen.c.
117
118touch ntpd/ntp_parser.[ch] ntpd/keyword-gen-utd ntpd/ntp_keyword.h
119
120cp bincheck.mf sntp/
121cp depsver.mf sntp/
122
123${AUTORECONF} -i -v "$@"
124
125# DH: 20110118: Due to our workaround for the AM_COND_IF bug that was
126# triggering the buggy recursive autoreconf, we can once again use a
127# single autoreconf invocation.  See
128# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7860
129# DH: 20101120: We are back to a single copy of libopts, and
130# once again it seems we need to run autoreconf in sntp after
131# the top-level run to get a correct sntp/libopts/Makefile.in.
132# To reduce redundancy, the top-level autoreconf uses --no-recursive.
133#
134# HMS: 20060618: Now that we use separate copies of libopts
135# we should only need the previous line.
136#
137## HMS: 20060615: the next line seems to be needed to make sure
138## we get the correct srcdir path in sntp/libopts/Makefile.in
139#rm -rf sntp/autom4te.cache
140#
141# (cd sntp && ${AUTORECONF} -i -v "$@")
142