source: rtems/bootstrap @ 282cb9c

4.104.114.84.95
Last change on this file since 282cb9c was 282cb9c, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 30, 2002 at 7:08:44 AM

2002-10-30 Ralf Corsepius <corsepiu@…>

  • bootstrap: Add generate_bspdir_acinclude to automatically update c/src/lib/libbsp/<cpu>/acinclude.m4. Use #! /bin/sh instead of #!/bin/sh. Remove autom4te*.cache during ./bootstrap --clean.
  • Property mode set to 100755
File size: 5.1 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
15AUTOCONF_VERS=2.52
16AUTOMAKE_VERS=1.6.[123]
17
18progname=`basename $0`
19top_srcdir=`dirname $0`
20
21verbose="";
22quiet="false"
23mode="generate"
24
25usage()
26{
27  echo
28  echo "usage: ${progname} [-h|-q|-v]"
29  echo
30  echo "options:"
31  echo "        -h .. display this message and exit";
32  echo "        -q .. quiet, don't display directories";
33  echo "        -v .. verbose, pass -v to automake when invoking automake"
34  echo "        -c .. clean, remove all aclocal/autoconf/automake generated files"
35  echo
36  exit 1;
37}
38
39generate_bspdir_acinclude()
40{
41cat << EOF > acinclude.m4~
42# RTEMS_CHECK_BSPDIR(RTEMS_BSP)
43AC_DEFUN([RTEMS_CHECK_BSPDIR],
44[
45  RTEMS_BSP_ALIAS(ifelse([\$1],,[\${RTEMS_BSP}],[\$1]),bspdir)
46  case "\$bspdir" in
47EOF
48
49for i in */bsp_specs; do
50  d=`dirname $i`
51cat << EOF >> acinclude.m4~
52  $d )
53    AC_CONFIG_SUBDIRS([$d]);;
54EOF
55done
56cat << EOF >> acinclude.m4~
57  *)
58    AC_MSG_ERROR([Invalid BSP]);;
59  esac
60])
61EOF
62if cmp -s acinclude.m4 acinclude.m4~ 2>/dev/null; then
63  echo "acinclude.m4 is unchanged";
64else
65  cp acinclude.m4~ acinclude.m4
66fi
67rm -f acinclude.m4~
68}
69
70if test ! -f $top_srcdir/aclocal/version.m4; then
71  echo "${progname}:"
72  echo "        Installation problem: Can't find file aclocal/version.m4"
73  exit 1;
74fi
75
76while test $# -gt 0; do
77case $1 in
78-h|--he|--hel|--help)
79  usage ;;
80-q|--qu|--qui|--quie|--quiet)
81  quiet="true";
82  shift;;
83-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
84  verbose="-v";
85  shift;;
86-c|--cl|--cle|--clea|--clean)
87  mode="clean";
88  shift;;
89-*) echo "unknown option $1" ;
90  usage ;;
91*) echo "invalid parameter $1" ;
92  usage ;;
93esac
94done
95
96case $mode in
97generate)
98  AUTOCONF=${AUTOCONF-`which autoconf`}
99  if test -z "$AUTOCONF"; then
100    echo "You must have autoconf installed to run $program"
101  fi
102  AUTOCONF_VER=`$AUTOCONF --version 2>/dev/null`
103  if test -z "`echo $AUTOCONF_VER | grep \" $AUTOCONF_VERS\"`"; then
104cat << EOF
105RTEMS requires autoconf version $AUTOCONF_VERS.
106
107You are trying to use $AUTOCONF which does not seem to be sufficient
108EOF
109  exit 1
110  fi
111 
112  AUTOMAKE=${AUTOMAKE-`which automake`}
113  if test -z "$AUTOMAKE"; then
114    echo "You must have automake installed to run $program"
115  fi
116  AUTOMAKE_VER=`$AUTOMAKE --version 2>/dev/null`
117  if test -z "`echo $AUTOMAKE_VER | grep \" $AUTOMAKE_VERS\"`"; then
118cat << EOF
119RTEMS requires automake version $AUTOMAKE_VERS.
120
121You are trying to use $AUTOMAKE which does not seem to be sufficient
122EOF
123  exit 1
124  fi
125 
126  case $top_srcdir in
127  /* ) aclocal_dir=$top_srcdir
128    ;;
129  *) aclocal_dir=`pwd`/$top_srcdir
130    ;;
131  esac
132
133  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
134  for i in $confs; do
135  dir=`dirname $i`;
136  configure=`basename $i`;
137  ( test "$quiet" = "true" || echo "$dir";
138    cd $dir;
139    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
140      generate_bspdir_acinclude;
141    pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g"
142    aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
143      sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat ` ;
144    test "$verbose" = "-v" && echo "aclocal $aclocal_args"
145    aclocal $aclocal_args;
146    test -n "`grep CONFIG_HEADER ${configure}`" && autoheader \
147      && test "$verbose" = "-v" && echo "autoheader";
148    test -n "`grep RTEMS_BSP_CONFIGURE ${configure}`" && autoheader \
149      && test "$verbose" = "-v" && echo "autoheader";
150    test -f Makefile.am && automake -a -c $verbose ;
151    autoconf;
152    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
153      && echo timestamp > stamp-h.in
154  )
155  done
156  ;;
157
158clean)
159  test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
160  files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'` ;
161  for i in $files; do if test -f $i; then
162    rm -f $i
163    test "$verbose" = "-v" && echo "$i"   
164  fi; done
165
166  test "$quiet" = "true" || echo "removing configure files"
167  files=`find . -name 'configure' -print` ;
168  test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
169  for i in $files; do if test -f $i; then
170    rm -f $i config.guess config.sub depcomp install-sh mdate-sh missing \
171        mkinstalldirs texinfo.tex
172    test "$verbose" = "-v" && echo "$i"   
173  fi; done
174 
175  test "$quiet" = "true" || echo "removing aclocal.m4 files"
176  files=`find . -name 'aclocal.m4' -print` ;
177  test "$verbose" = "-v" && test -n "$files" && echo "$files" ;
178  for i in $files; do if test -f $i; then
179    rm -f $i
180    test "$verbose" = "-v" && echo "$i"   
181  fi; done
182
183  find . -name '*~' -print | xargs rm -f
184  find . -name 'bspopts.h*' -print | xargs rm -f
185  find . -name '*.orig' -print | xargs rm -f
186  find . -name '*.rej' -print | xargs rm -f
187  find . -name 'config.status' -print | xargs rm -f
188  find . -name 'config.log' -print | xargs rm -f
189  find . -name 'config.cache' -print | xargs rm -f
190  find . -name 'Makefile' -print | xargs rm -f
191  find . -name '.deps' -print | xargs rm -rf
192  find . -name '.libs' -print | xargs rm -rf
193  find . -name 'stamp-h.in' | xargs rm -rf
194  find . -name 'autom4te*.cache' | xargs rm -rf
195  ;;
196esac
Note: See TracBrowser for help on using the repository browser.