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#  NOTE:  THE NTP VERSION NUMBER COMES FROM packageinfo.sh
7#
8#  all other instances of it anywhere in the source base have propagated
9#  from this one source.
10#
11#  To use the raw sources from the repository, you must have the following
12#  tools available to you:
13#
14#  1.  Autoconf and Automake.
15#
16#  2.  lynx.  This is used to extract the COPYRIGHT file extracted from
17#      the html documentation.
18#
19#  *** The following are no longer needed for simple builds from the repo
20#  3.  AutoGen.  The repository does *not* contain the files generated from
21#      the option definition files and it does not contain the libopts
22#      tear-off/redistributable library.
23#
24#      Note: AutoGen needs GNU Guile.
25#
26#  4.  gunzip.  The tear-off library is a gzipped tarball.
27
28set -e
29
30scripts/genver
31
32# autoreconf says:
33# The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
34# AUTOPOINT, LIBTOOLIZE, M4 are honored.
35
36AUTORECONF=${AUTORECONF:-autoreconf}
37
38case `hostname` in
39 pogo.udel.edu)
40    if fgrep -q 4.2.4 version.m4; then
41	AUTOCONF=autoconf-2.59
42	AUTOHEADER=autoheader-2.59
43	AUTOMAKE=automake-1.9
44	ACLOCAL=aclocal-1.9
45	export AUTOCONF AUTOHEADER AUTOMAKE ACLOCAL
46    fi
47    ;;
48esac
49
50# 20060629: HMS: Let's try checking in libopts and the autogen-generated files
51## The copy for ntp...
52#rm -rf libopts*
53#gunzip -c $(autoopts-config --libsrc) | (
54#  tar -xvf -
55#  mv libopts-*.*.* libopts )
56
57## The copy for sntp...
58#rm -rf sntp/libopts*
59#gunzip -c $(autoopts-config --libsrc) | (
60#  cd sntp
61#  tar -xvf -
62#  mv libopts-*.*.* libopts )
63
64def_files=`find [B-Za-z]* -type f -name '*.def' -print | fgrep -v /SCCS/`
65prog_opt_files=`grep -l '^prog.name' $def_files`
66
67## AutoGen stuff
68
69#incdir=${PWD}/include
70
71#for f in ${prog_opt_files}
72#do
73#  ( cd $(dirname ${f})
74#    echo "Running autogen on $f..."
75#    autogen -L${incdir} $(basename ${f})
76#  ) || exit 1
77#done
78
79## Non-AutoGen stuff
80
81for i in autogen-version.def version.def
82do
83    cmp -s include/$i sntp/$i || cp -p include/$i sntp/$i
84done
85
86# touch the stuff generated by the opt files
87
88for f in ${prog_opt_files}
89do
90    f=`echo $f | sed -e 's/-opts.def//'`
91    l=
92    for i in `ls -1 $f*`
93    do
94	case "$i" in
95	 *.c|*.h|*.1|*.texi|*.menu)
96	    l="$l $i"
97	    ;;
98	esac
99    done
100    case "$l" in
101     '') ;;
102     *) touch $l
103	;;
104    esac
105done
106
107## EOAutoGen stuff
108
109cp bincheck.mf sntp/
110
111${AUTORECONF} -i -v
112
113# HMS: 20060618: Now that we use separate copies of libopts
114# we should only need the previous line.
115#
116## HMS: 20060615: the next line seems to be needed to make sure
117## we get the correct srcdir path in sntp/libopts/Makefile.in
118#rm -rf sntp/autom4te.cache
119#
120#(cd sntp && ${AUTORECONF} -i -v)
121