source: rtems/bootstrap @ f412e12

4.11
Last change on this file since f412e12 was b74c9cf, checked in by Chris Johns <chrisj@…>, on Apr 23, 2014 at 4:31:55 AM

bootstrap: Sort the contents of the prinstall.am files.

Sorting removed the variations across different host operating systems
and file systems.

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