source: rtems/bootstrap @ 77fff592

4.104.114.84.95
Last change on this file since 77fff592 was 77fff592, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 18, 2006 at 1:58:17 AM

2006-11-18 Ralf Corsépius <ralf.corsepius@…>

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