source: rtems/bootstrap @ b0f45d8

4.104.115
Last change on this file since b0f45d8 was 58b9db5, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/14/08 at 07:41:30

2008-04-14 Ralf Corsépius <ralf.corsepius@…>

  • bootstrap: Use find . ... preinstall.am for portability reasons.
  • Property mode set to 100755
File size: 5.9 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="generate"
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-*) echo "unknown option $1" ;
93  usage ;;
94*) echo "invalid parameter $1" ;
95  usage ;;
96esac
97done
98
99case $mode in
100preinstall)
101  confs=`find . -name Makefile.am -exec grep -l 'include .*/preinstall\.am' {} \;`
102  for i in $confs; do
103    dir=$(dirname $i);
104    test "$quite" = "true" || echo "Generating $dir/preinstall.am"
105    ${top_srcdir}/ampolish3 "$dir/Makefile.am" > "$dir/preinstall.am"
106  done
107  ;;
108
109generate)
110  AUTOCONF=${AUTOCONF-autoconf}
111  if test -z "$AUTOCONF"; then
112    echo "You must have autoconf installed to run $program"
113    exit 1
114  fi
115 
116  AUTOHEADER=${AUTOHEADER-autoheader}
117  if test -z "$AUTOHEADER"; then
118    echo "You must have autoconf installed to run $program"
119    exit 1
120  fi
121 
122  AUTOMAKE=${AUTOMAKE-automake}
123  if test -z "$AUTOMAKE"; then
124    echo "You must have automake installed to run $program"
125    exit 1
126  fi
127 
128  ACLOCAL=${ACLOCAL-aclocal}
129  if test -z "$ACLOCAL"; then
130    echo "You must have automake installed to run $program"
131    exit 1
132  fi
133
134  case $top_srcdir in
135  /* ) aclocal_dir=$top_srcdir
136    ;;
137  *) aclocal_dir=`pwd`/$top_srcdir
138    ;;
139  esac
140
141  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
142  for i in $confs; do
143  dir=`dirname $i`;
144  configure=`basename $i`;
145  ( test "$quiet" = "true" || echo "$dir";
146    cd $dir;
147    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
148      generate_bspdir_acinclude;
149    pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g"
150    aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
151      sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat ` ;
152    test "$verbose" = "-v" && echo "${ACLOCAL} $aclocal_args"
153    ${ACLOCAL} $aclocal_args;
154    test -n "`grep CONFIG_HEADER ${configure}`" && ${AUTOHEADER} \
155      && test "$verbose" = "-v" && echo "${AUTOHEADER}";
156    test -n "`grep RTEMS_BSP_CONFIGURE ${configure}`" && ${AUTOHEADER} \
157      && test "$verbose" = "-v" && echo "${AUTOHEADER}";
158    test -f Makefile.am && ${AUTOMAKE} -a -c $verbose ;
159    ${AUTOCONF};
160    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
161      && echo timestamp > stamp-h.in
162  )
163  done
164  ;;
165
166autoreconf)
167  AUTORECONF=${AUTORECONF-autoreconf}
168  if test -z "$AUTORECONF"; then
169    echo "You must have autoreconf installed to run $program"
170    exit 1
171  fi
172
173  confs=`find . -name 'configure.ac' -print`
174  for i in $confs; do
175  dir=`dirname $i`;
176  configure=`basename $i`;
177  ( test "$quiet" = "true" || echo "$dir";
178    cd $dir;
179    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
180      generate_bspdir_acinclude;
181    ${AUTORECONF} -i --no-recursive $verbose;
182    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
183      && echo timestamp > stamp-h.in
184  )
185  done
186  ;;
187
188clean)
189  test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
190  files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'` ;
191  for i in $files; do if test -f $i; then
192    rm -f $i
193    test "$verbose" = "-v" && echo "$i"   
194  fi; done
195
196  test "$quiet" = "true" || echo "removing configure files"
197  files=`find . -name 'configure' -print` ;
198  test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
199  for i in $files; do if test -f $i; then
200    rm -f $i config.sub config.guess depcomp install-sh mdate-sh missing \
201        mkinstalldirs texinfo.tex compile
202    test "$verbose" = "-v" && echo "$i"   
203  fi; done
204 
205  test "$quiet" = "true" || echo "removing aclocal.m4 files"
206  files=`find . -name 'aclocal.m4' -print` ;
207  test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
208  for i in $files; do if test -f $i; then
209    rm -f $i
210    test "$verbose" = "-v" && echo "$i"   
211  fi; done
212
213  find . -name '*~' -print | xargs rm -f
214  find . -name 'bspopts.h.in' -print | xargs rm -f
215  find . -name '*.orig' -print | xargs rm -f
216  find . -name '*.rej' -print | xargs rm -f
217  find . -name 'config.status' -print | xargs rm -f
218  find . -name 'config.log' -print | xargs rm -f
219  find . -name 'config.cache' -print | xargs rm -f
220  find . -name 'Makefile' -print | xargs rm -f
221  find . -name '.deps' -print | xargs rm -rf
222  find . -name '.libs' -print | xargs rm -rf
223  find . -name 'stamp-h.in' | xargs rm -rf
224  find . -name 'autom4te*.cache' | xargs rm -rf
225  ;;
226esac
227
228exit 0
Note: See TracBrowser for help on using the repository browser.