source: rtems/bootstrap @ 1450de0

4.115
Last change on this file since 1450de0 was 22fb90e4, checked in by Ralf Corsépius <ralf.corsepius@…>, on 07/27/12 at 13:38:04

Misc. cosmetic changes.

  • Property mode set to 100755
File size: 6.5 KB
RevLine 
[22fb90e4]1#!/bin/sh
[9b8baa1]2#
[e619c28]3# helps bootstrapping, when checked out from CVS
4# requires GNU autoconf and GNU automake
[9b8baa1]5#
[e619c28]6# this is not meant to be exported outside the source tree
[65c6425]7#
[e619c28]8# NOTE: Inspired by libtool's autogen script
[65c6425]9#
[e619c28]10# to be run from the toplevel directory of RTEMS'
11# source tree
12
13progname=`basename $0`
[df49c60]14top_srcdir=`dirname $0`
15
[22fb90e4]16verbose=""
[e619c28]17quiet="false"
[fba17c9e]18mode="autoreconf"
[aa96f47]19force=0
[e619c28]20
21usage()
22{
[7e03d10]23  echo
[77fff592]24  echo "usage: ${progname} [-c|-p|-h] [-q][-v]"
[7e03d10]25  echo
26  echo "options:"
[8cdb582]27  echo "        -c .. clean, remove all aclocal/autoconf/automake generated files"
[77fff592]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"
[7e03d10]32  echo
[22fb90e4]33  exit 1
[e619c28]34}
35
[282cb9c]36generate_bspdir_acinclude()
37{
38cat << EOF > acinclude.m4~
[1d3713ef]39# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
[282cb9c]40AC_DEFUN([RTEMS_CHECK_BSPDIR],
41[
[1d3713ef]42  case "\$1" in
[282cb9c]43EOF
44
45for i in */bsp_specs; 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
[22fb90e4]59  echo "acinclude.m4 is unchanged"
[282cb9c]60else
61  cp acinclude.m4~ acinclude.m4
62fi
63rm -f acinclude.m4~
64}
65
[76d527ec]66if test ! -f $top_srcdir/aclocal/version.m4; then
[7e03d10]67  echo "${progname}:"
[76d527ec]68  echo "        Installation problem: Can't find file aclocal/version.m4"
[22fb90e4]69  exit 1
[7e03d10]70fi
71
[e619c28]72while test $# -gt 0; do
73case $1 in
[7e03d10]74-h|--he|--hel|--help)
75  usage ;;
[e619c28]76-q|--qu|--qui|--quie|--quiet)
[22fb90e4]77  quiet="true"
[e619c28]78  shift;;
79-v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
[22fb90e4]80  verbose="-v"
[e619c28]81  shift;;
[8cdb582]82-c|--cl|--cle|--clea|--clean)
[22fb90e4]83  mode="clean"
[8cdb582]84  shift;;
[aa96f47]85-f|--fo|--for|--forc|--force)
86  force=`expr $force + 1`
87  shift;;
[77fff592]88-p|--pr|--pre|--prei|--prein|--preins|--preinst)
[22fb90e4]89  mode="preinstall"
[77fff592]90  shift;;
[3031e6c]91-r|--re|--rec|--reco|--recon|--reconf)
[22fb90e4]92  mode="autoreconf"
[3031e6c]93  shift;;
[fba17c9e]94-g|--ge|--gen|--gene|--gener|--genera|--generat|--generate)
[22fb90e4]95  mode="generate"
[fba17c9e]96  shift;;
[22fb90e4]97-*) echo "unknown option $1"
[e619c28]98  usage ;;
[22fb90e4]99*) echo "invalid parameter $1"
[e619c28]100  usage ;;
101esac
102done
103
[8cdb582]104case $mode in
[77fff592]105preinstall)
[58b9db5]106  confs=`find . -name Makefile.am -exec grep -l 'include .*/preinstall\.am' {} \;`
[77fff592]107  for i in $confs; do
[22fb90e4]108    dir=$(dirname $i)
[77fff592]109    test "$quite" = "true" || echo "Generating $dir/preinstall.am"
110    ${top_srcdir}/ampolish3 "$dir/Makefile.am" > "$dir/preinstall.am"
111  done
112  ;;
113
[8cdb582]114generate)
[d854517]115  AUTOCONF=${AUTOCONF-autoconf}
[58fd5ab]116  if test -z "$AUTOCONF"; then
117    echo "You must have autoconf installed to run $program"
[0b22af6]118    exit 1
[58fd5ab]119  fi
[22fb90e4]120
[0b22af6]121  AUTOHEADER=${AUTOHEADER-autoheader}
122  if test -z "$AUTOHEADER"; then
123    echo "You must have autoconf installed to run $program"
124    exit 1
[58fd5ab]125  fi
[22fb90e4]126
[d854517]127  AUTOMAKE=${AUTOMAKE-automake}
[58fd5ab]128  if test -z "$AUTOMAKE"; then
129    echo "You must have automake installed to run $program"
[0b22af6]130    exit 1
[58fd5ab]131  fi
[22fb90e4]132
[0b22af6]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
[df49c60]139  case $top_srcdir in
[ec6968b]140  /* ) aclocal_dir=$top_srcdir
[df49c60]141    ;;
[ec6968b]142  *) aclocal_dir=`pwd`/$top_srcdir
[df49c60]143    ;;
144  esac
145
[e712997]146  confs=`find . \( -name 'configure.in' -o -name 'configure.ac' \) -print`
[8cdb582]147  for i in $confs; do
[22fb90e4]148  dir=`dirname $i`
149  configure=`basename $i`
150  ( test "$quiet" = "true" || echo "$dir"
151    cd $dir
[282cb9c]152    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
[22fb90e4]153      generate_bspdir_acinclude
[ec6968b]154    pat="s,\$(RTEMS_TOPdir),${aclocal_dir},g"
155    aclocal_args=`grep '^[ ]*ACLOCAL_AMFLAGS' Makefile.am | \
[22fb90e4]156      sed -e 's%.*ACLOCAL_AMFLAGS.*\=[ ]*%%g' -e $pat `
[0b22af6]157    test "$verbose" = "-v" && echo "${ACLOCAL} $aclocal_args"
[22fb90e4]158    ${ACLOCAL} $aclocal_args
[0b22af6]159    test -n "`grep CONFIG_HEADER ${configure}`" && ${AUTOHEADER} \
[22fb90e4]160      && test "$verbose" = "-v" && echo "${AUTOHEADER}"
[0b22af6]161    test -n "`grep RTEMS_BSP_CONFIGURE ${configure}`" && ${AUTOHEADER} \
[22fb90e4]162      && test "$verbose" = "-v" && echo "${AUTOHEADER}"
163    test -f Makefile.am && ${AUTOMAKE} -a -c $verbose
164    ${AUTOCONF}
[76ee648c]165    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
166      && echo timestamp > stamp-h.in
[8cdb582]167  )
168  done
169  ;;
[df49c60]170
[3031e6c]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
[22fb90e4]180  dir=`dirname $i`
181  configure=`basename $i`
182  ( test "$quiet" = "true" || echo "$dir"
183    cd $dir
[3031e6c]184    test -n "`grep RTEMS_CHECK_BSPDIR ${configure}`" && \
[22fb90e4]185      generate_bspdir_acinclude
186    ${AUTORECONF} -i --no-recursive $verbose
[3031e6c]187    test -f Makefile.am && test -n "`grep 'stamp-h\.in' Makefile.in`" \
188      && echo timestamp > stamp-h.in
189  )
190  done
191  ;;
192
[8cdb582]193clean)
194  test "$quiet" = "true" || echo "removing automake generated Makefile.in files"
[22fb90e4]195  files=`find . -name 'Makefile.am' -print | sed -e 's%\.am%\.in%g'`
196  for i in $files; do
[aa96f47]197    if test -f $i; then
198      rm -f $i
[22fb90e4]199      test "$verbose" = "-v" && echo "$i"
200    fi
[aa96f47]201  done
[8cdb582]202
203  test "$quiet" = "true" || echo "removing configure files"
[22fb90e4]204  files=`find . -name 'configure' -print`
205  for i in $files; do
[aa96f47]206    if test -f $i; then
207      rm -f $i
208      test "$verbose" = "-v" && echo "$i"
[22fb90e4]209    fi
[aa96f47]210  done
[22fb90e4]211
[aa96f47]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`
[22fb90e4]230      for i in $files; do
[aa96f47]231        if test -f $i; then
232          rm -f $i
233          test "$verbose" = "-v" && echo "$i"
[22fb90e4]234        fi
[aa96f47]235      done
236    done
237  fi
238
[8cdb582]239  test "$quiet" = "true" || echo "removing aclocal.m4 files"
[22fb90e4]240  files=`find . -name 'aclocal.m4' -print`
241  test "$verbose" = "-v" && test -n "$files" && echo "$files"
242  for i in $files; do
[aa96f47]243    if test -f $i; then
244      rm -f $i
[22fb90e4]245      test "$verbose" = "-v" && echo "$i"
246    fi
[aa96f47]247  done
[8cdb582]248
249  find . -name '*~' -print | xargs rm -f
[a5a0db4]250  find . -name 'bspopts.h.in' -print | xargs rm -f
[8cdb582]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
[76ee648c]255  find . -name 'config.cache' -print | xargs rm -f
[6693a68]256  find . -name 'Makefile' -print | xargs rm -f
[8cdb582]257  find . -name '.deps' -print | xargs rm -rf
[76ee648c]258  find . -name '.libs' -print | xargs rm -rf
259  find . -name 'stamp-h.in' | xargs rm -rf
[282cb9c]260  find . -name 'autom4te*.cache' | xargs rm -rf
[8cdb582]261  ;;
262esac
[cf0ed46]263
264exit 0
Note: See TracBrowser for help on using the repository browser.