]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/amd/bootstrap
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / amd / bootstrap
1 #!/bin/sh
2 #set -x
3 # helps bootstrapping am-utils, when checked out from CVS
4 # requires GNU autoconf and GNU automake
5 # this is not meant to go into the distributions
6 # Erez Zadok <ezk@cs.columbia.edu>
7
8 # test cwd
9 test -f ../amd/amd.c && cd ..
10 if [ ! -f amd/amd.c ]; then
11     echo "Must run $0 from the top level source directory."
12     exit 1
13 fi
14
15 # validate macros directory and some macro files
16 if [ ! -d m4/macros ]; then
17     echo No m4/macros directory found!
18     exit 1
19 fi
20 if [ ! -f m4/macros/HEADER ]; then
21     echo No m4/macros/HEADER file found!
22     exit 1
23 fi
24
25 # remove any remaining autom4te.cache directory
26 rm -fr autom4te.cache autom4te-*.cache
27
28 # generate acinclude.m4 file
29 echo "AMU: prepare acinclude.m4..."
30 test -f acinclude.m4 && mv -f acinclude.m4 acinclude.m4.old
31 (cd m4/macros
32  for i in HEADER *.m4; do
33      cat $i
34      echo
35      echo
36  done
37  cat TRAILER
38 ) > acinclude.m4
39
40 # generate aclocal.m4 file
41 echo "AMU: aclocal..."
42 test -f aclocal.m4 && mv -f aclocal.m4 aclocal.m4.old
43 # show version
44 aclocal --version 2>&1 | head -1
45 if aclocal ; then
46     :
47 else
48     echo "aclocal command failed.  fix errors and rerun $0."
49     exit 2
50 fi
51
52 # produce new configure.in (temp) script
53 echo "AMU: autoconf..."
54 # show version
55 autoconf --version 2>&1 | head -1
56 LOG=/tmp/amu-$$.log
57 rm -f ${LOG}
58 autoconf configure.in > configure.new 2> ${LOG}
59 # until Automake requires Autoconf 2.50, manual says to ignore this
60 CUTWARNMSG1="warning: AC_PROG_LEX invoked multiple times|do not use m4_(patsubst|regexp):"
61 egrep -v "${CUTWARNMSG1}" ${LOG} > ${LOG}.new
62 mv ${LOG}.new ${LOG}
63 if test -s ${LOG}; then
64     echo "AUTOCONF ERRORS (MUST FIX):"
65     cat ${LOG}
66     rm -f ${LOG}
67     exit 2
68 fi
69 # now prepare the real configure script
70 test -f configure && mv -f configure configure.old
71 mv -f configure.new configure
72 chmod a+rx configure
73 rm -f configure.old
74
75 # run autoheader to produce C header .in files
76 echo "AMU: autoheader..."
77 # show version
78 autoheader --version 2>&1 | head -1
79 autoheader configure.in > config.h.in 2> ${LOG}
80 CUTWARNMSG2="autoheader: \`config.h.in' is updated"
81 egrep -v "${CUTWARNMSG2}" ${LOG} > ${LOG}.new
82 mv ${LOG}.new ${LOG}
83 if test -s ${LOG}; then
84     echo "AUTOHEADER ERRORS (MUST FIX):"
85     cat ${LOG}
86     rm -f ${LOG}
87     exit 2
88 fi
89 rm -f ${LOG}
90
91 # generate makefiles
92 cmd="automake --add-missing --copy --ignore-deps"
93 #cmd="automake --add-missing"
94 echo "AMU: $cmd..."
95 # show version
96 automake --version 2>&1 | head -1
97 if ${cmd} ; then
98     :
99 else
100     echo "automake command failed.  fix errors and rerun $0."
101     exit 2
102 fi
103
104 # save timestamp
105 echo "AMU: save timestamp..."
106 echo timestamp > stamp-h.in
107
108 exit 0