source: rtems/bootstrap @ 21242c2

4.115
Last change on this file since 21242c2 was fba17c9e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/03/11 at 16:05:34

2011-02-03 Ralf Corsépius <ralf.corsepius@…>

  • bootstrap: Add -g option. Switch default to autoreconf.
  • Property mode set to 100755
File size: 6.0 KB
Line 
1#! /bin/sh
2#
3# helps bootstrapping, when checked out from CVS
4# requires GNU autoconf and GNU automake
5#
6# $Id$
7
8# this is not meant to be exported outside the source tree
9
10# NOTE: Inspired by libtool's autogen script
11
12# to be run from the toplevel directory of RTEMS'
13# source tree
14
15progname=`basename $0`
16top_srcdir=`dirname $0`
17
18verbose="";
19quiet="false"
20mode="autoreconf"
21
22usage()
23{
24  echo
25  echo "usage: ${progname} [-c|-p|-h] [-q][-v]"
26  echo
27  echo "options:"
28  echo "        -c .. clean, remove all aclocal/autoconf/automake generated files"
29  echo "        -h .. display this message and exit"
30  echo "        -p .. regenerate preinstall.am files"
31  echo "        -q .. quiet, don't display directories"
32  echo "        -v .. verbose, pass -v to autotools"
33  echo
34  exit 1;
35}
36
37generate_bspdir_acinclude()
38{
39cat << EOF > acinclude.m4~
40# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
41AC_DEFUN([RTEMS_CHECK_BSPDIR],
42[
43  case "\$1" in
44EOF
45
46for i in */bsp_specs; do
47  d=`dirname $i`
48cat << EOF >> acinclude.m4~
49  $d )
50    AC_CONFIG_SUBDIRS([$d]);;
51EOF
52done
53cat << EOF >> acinclude.m4~
54  *)
55    AC_MSG_ERROR([Invalid BSP]);;
56  esac
57])
58EOF
59if cmp -s acinclude.m4 acinclude.m4~ 2>/dev/null; then
60  echo "acinclude.m4 is unchanged";
61else
62  cp acinclude.m4~ acinclude.m4
63fi
64rm -f acinclude.m4~
65}
66
67if test ! -f $top_srcdir/aclocal/version.m4; then
68  echo "${progname}:"
69  echo "        Installation problem: Can't find file aclocal/version.m4"
70  exit 1;
71fi
72
73while test $# -gt 0; do
74case $1 in
75-h|--he|--hel|--help)
76  usage ;;
77-q|--qu|--qui|--quie|--quiet)
78  quiet="true";
79  shift;;
80-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
81  verbose="-v";
82  shift;;
83-c|--cl|--cle|--clea|--clean)
84  mode="clean";
85  shift;;
86-p|--pr|--pre|--prei|--prein|--preins|--preinst)
87  mode="preinstall";
88  shift;;
89-r|--re|--rec|--reco|--recon|--reconf)
90  mode="autoreconf";
91  shift;;
92-g|--ge|--gen|--gene|--gener|--genera|--generat|--generate)
93  mode="generate";
94  shift;;
95-*) echo "unknown option $1" ;
96  usage ;;
97*) echo "invalid parameter $1" ;
98  usage ;;
99esac
100done
101
102case $mode in
103preinstall)
104  confs=`find . -name Makefile.am -exec grep -l 'include .*/preinstall\.am' {} \;`
105  for i in $confs; do
106    dir=$(dirname $i);
107    test "$quite" = "true" || echo "Generating $dir/preinstall.am"
108    ${top_srcdir}/ampolish3 "$dir/Makefile.am" > "$dir/preinstall.am"
109  done
110  ;;
111
112generate)
113  AUTOCONF=${AUTOCONF-autoconf}
114  if test -z "$AUTOCONF"; then
115    echo "You must have autoconf installed to run $program"
116    exit 1
117  fi
118 
119  AUTOHEADER=${AUTOHEADER-autoheader}
120  if test -z "$AUTOHEADER"; then
121    echo "You must have autoconf installed to run $program"
122    exit 1
123  fi
124 
125  AUTOMAKE=${AUTOMAKE-automake}
126  if test -z "$AUTOMAKE"; then
127    echo "You must have automake installed to run $program"
128    exit 1
129  fi
130 
131  ACLOCAL=${ACLOCAL-aclocal}
132  if test -z "$ACLOCAL"; then
133    echo "You must have automake installed to run $program"
134    exit 1
135  fi
136
137  case $top_srcdir in
138  /* ) aclocal_dir=$top_srcdir
139    ;;
140  *) aclocal_dir=`pwd`/$top_srcdir
141    ;;
142  esac
143
144  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
145  for i in $confs; do
146  dir=`dirname $i`;
147  configure=`basename $i`;
148  ( test "$quiet" = "true" || echo "$dir";
149    cd $dir;
150    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
151      generate_bspdir_acinclude;
152    pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g"
153    aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
154      sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat ` ;
155    test "$verbose" = "-v" && echo "${ACLOCAL} $aclocal_args"
156    ${ACLOCAL} $aclocal_args;
157    test -n "`grep CONFIG_HEADER ${configure}`" && ${AUTOHEADER} \
158      && test "$verbose" = "-v" && echo "${AUTOHEADER}";
159    test -n "`grep RTEMS_BSP_CONFIGURE ${configure}`" && ${AUTOHEADER} \
160      && test "$verbose" = "-v" && echo "${AUTOHEADER}";
161    test -f Makefile.am && ${AUTOMAKE} -a -c $verbose ;
162    ${AUTOCONF};
163    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
164      && echo timestamp > stamp-h.in
165  )
166  done
167  ;;
168
169autoreconf)
170  AUTORECONF=${AUTORECONF-autoreconf}
171  if test -z "$AUTORECONF"; then
172    echo "You must have autoreconf installed to run $program"
173    exit 1
174  fi
175
176  confs=`find . -name 'configure.ac' -print`
177  for i in $confs; do
178  dir=`dirname $i`;
179  configure=`basename $i`;
180  ( test "$quiet" = "true" || echo "$dir";
181    cd $dir;
182    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
183      generate_bspdir_acinclude;
184    ${AUTORECONF} -i --no-recursive $verbose;
185    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
186      && echo timestamp > stamp-h.in
187  )
188  done
189  ;;
190
191clean)
192  test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
193  files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'` ;
194  for i in $files; do if test -f $i; then
195    rm -f $i
196    test "$verbose" = "-v" && echo "$i"   
197  fi; done
198
199  test "$quiet" = "true" || echo "removing configure files"
200  files=`find . -name 'configure' -print` ;
201  test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
202  for i in $files; do if test -f $i; then
203    rm -f $i config.sub config.guess depcomp install-sh mdate-sh missing \
204        mkinstalldirs texinfo.tex compile
205    test "$verbose" = "-v" && echo "$i"   
206  fi; done
207 
208  test "$quiet" = "true" || echo "removing aclocal.m4 files"
209  files=`find . -name 'aclocal.m4' -print` ;
210  test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
211  for i in $files; do if test -f $i; then
212    rm -f $i
213    test "$verbose" = "-v" && echo "$i"   
214  fi; done
215
216  find . -name '*~' -print | xargs rm -f
217  find . -name 'bspopts.h.in' -print | xargs rm -f
218  find . -name '*.orig' -print | xargs rm -f
219  find . -name '*.rej' -print | xargs rm -f
220  find . -name 'config.status' -print | xargs rm -f
221  find . -name 'config.log' -print | xargs rm -f
222  find . -name 'config.cache' -print | xargs rm -f
223  find . -name 'Makefile' -print | xargs rm -f
224  find . -name '.deps' -print | xargs rm -rf
225  find . -name '.libs' -print | xargs rm -rf
226  find . -name 'stamp-h.in' | xargs rm -rf
227  find . -name 'autom4te*.cache' | xargs rm -rf
228  ;;
229esac
230
231exit 0
Note: See TracBrowser for help on using the repository browser.