source: rtems/bootstrap @ 48e02af

4.115
Last change on this file since 48e02af was 4b5348cc, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/03/11 at 09:38:27

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

  • depcomp, compile, texinfo.tex, mdate-sh: New.
  • bootstrap (-c): Don't remove depcomp, compile, texinfo.tex, mdate-sh.
  • Property mode set to 100755
File size: 6.0 KB
RevLine 
[282cb9c]1#! /bin/sh
[9b8baa1]2#
[e619c28]3# helps bootstrapping, when checked out from CVS
4# requires GNU autoconf and GNU automake
[9b8baa1]5#
6# $Id$
[e619c28]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`
[df49c60]16top_srcdir=`dirname $0`
17
[8cdb582]18verbose="";
[e619c28]19quiet="false"
[fba17c9e]20mode="autoreconf"
[e619c28]21
22usage()
23{
[7e03d10]24  echo
[77fff592]25  echo "usage: ${progname} [-c|-p|-h] [-q][-v]"
[7e03d10]26  echo
27  echo "options:"
[8cdb582]28  echo "        -c .. clean, remove all aclocal/autoconf/automake generated files"
[77fff592]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"
[7e03d10]33  echo
[e619c28]34  exit 1;
35}
36
[282cb9c]37generate_bspdir_acinclude()
38{
39cat << EOF > acinclude.m4~
[1d3713ef]40# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
[282cb9c]41AC_DEFUN([RTEMS_CHECK_BSPDIR],
42[
[1d3713ef]43  case "\$1" in
[282cb9c]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
[76d527ec]67if test ! -f $top_srcdir/aclocal/version.m4; then
[7e03d10]68  echo "${progname}:"
[76d527ec]69  echo "        Installation problem: Can't find file aclocal/version.m4"
[7e03d10]70  exit 1;
71fi
72
[e619c28]73while test $# -gt 0; do
74case $1 in
[7e03d10]75-h|--he|--hel|--help)
76  usage ;;
[e619c28]77-q|--qu|--qui|--quie|--quiet)
78  quiet="true";
79  shift;;
80-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
81  verbose="-v";
82  shift;;
[8cdb582]83-c|--cl|--cle|--clea|--clean)
84  mode="clean";
85  shift;;
[77fff592]86-p|--pr|--pre|--prei|--prein|--preins|--preinst)
87  mode="preinstall";
88  shift;;
[3031e6c]89-r|--re|--rec|--reco|--recon|--reconf)
90  mode="autoreconf";
91  shift;;
[fba17c9e]92-g|--ge|--gen|--gene|--gener|--genera|--generat|--generate)
93  mode="generate";
94  shift;;
[e619c28]95-*) echo "unknown option $1" ;
96  usage ;;
97*) echo "invalid parameter $1" ;
98  usage ;;
99esac
100done
101
[8cdb582]102case $mode in
[77fff592]103preinstall)
[58b9db5]104  confs=`find . -name Makefile.am -exec grep -l 'include .*/preinstall\.am' {} \;`
[77fff592]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
[8cdb582]112generate)
[d854517]113  AUTOCONF=${AUTOCONF-autoconf}
[58fd5ab]114  if test -z "$AUTOCONF"; then
115    echo "You must have autoconf installed to run $program"
[0b22af6]116    exit 1
[58fd5ab]117  fi
[0b22af6]118 
119  AUTOHEADER=${AUTOHEADER-autoheader}
120  if test -z "$AUTOHEADER"; then
121    echo "You must have autoconf installed to run $program"
122    exit 1
[58fd5ab]123  fi
124 
[d854517]125  AUTOMAKE=${AUTOMAKE-automake}
[58fd5ab]126  if test -z "$AUTOMAKE"; then
127    echo "You must have automake installed to run $program"
[0b22af6]128    exit 1
[58fd5ab]129  fi
130 
[0b22af6]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
[df49c60]137  case $top_srcdir in
[ec6968b]138  /* ) aclocal_dir=$top_srcdir
[df49c60]139    ;;
[ec6968b]140  *) aclocal_dir=`pwd`/$top_srcdir
[df49c60]141    ;;
142  esac
143
[e712997]144  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
[8cdb582]145  for i in $confs; do
146  dir=`dirname $i`;
[e712997]147  configure=`basename $i`;
[8cdb582]148  ( test "$quiet" = "true" || echo "$dir";
149    cd $dir;
[282cb9c]150    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
151      generate_bspdir_acinclude;
[ec6968b]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 ` ;
[0b22af6]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};
[76ee648c]163    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
164      && echo timestamp > stamp-h.in
[8cdb582]165  )
166  done
167  ;;
[df49c60]168
[3031e6c]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
[8cdb582]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
[4b5348cc]203    rm -f $i config.sub config.guess install-sh missing mkinstalldirs
204# rm -f depcomp compile texinfo.tex mdate-sh
[8cdb582]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
[a5a0db4]217  find . -name 'bspopts.h.in' -print | xargs rm -f
[8cdb582]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
[76ee648c]222  find . -name 'config.cache' -print | xargs rm -f
[6693a68]223  find . -name 'Makefile' -print | xargs rm -f
[8cdb582]224  find . -name '.deps' -print | xargs rm -rf
[76ee648c]225  find . -name '.libs' -print | xargs rm -rf
226  find . -name 'stamp-h.in' | xargs rm -rf
[282cb9c]227  find . -name 'autom4te*.cache' | xargs rm -rf
[8cdb582]228  ;;
229esac
[cf0ed46]230
231exit 0
Note: See TracBrowser for help on using the repository browser.