1#!/bin/sh
2#
3# $Header: /cvsroot/faces/faces/autogen.sh,v 1.1.1.1 2002/04/15 20:20:47 richburridge Exp $
4#
5# Copyright (C) 1990-2002  Rich Burridge, Sun Microsystems Inc.
6# All rights reserved.
7#
8# Permission is given to distribute these sources, as long as the
9# copyright messages are not removed, and no monies are exchanged.
10#
11# No responsibility is taken for any errors on inaccuracies inherent
12# either to the comments or the code of this program, but if reported
13# to me, then an attempt will be made to fix them.
14#
15# Run this to generate all the initial makefiles, etc.
16
17srcdir=`dirname $0`
18PKG_NAME="the package."
19
20DIE=0
21
22(autoconf --version) < /dev/null > /dev/null 2>&1 || {
23  echo
24  echo "**Error**: You must have \`autoconf' installed to."
25  echo "Download the appropriate package for your distribution,"
26  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
27  DIE=1
28}
29
30(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
31  (libtool --version) < /dev/null > /dev/null 2>&1 || {
32    echo
33    echo "**Error**: You must have \`libtool' installed."
34    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
35    echo "(or a newer version if it is available)"
36    DIE=1
37  }
38}
39
40grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
41  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
42  (gettext --version) < /dev/null > /dev/null 2>&1 || {
43    echo
44    echo "**Error**: You must have \`gettext' installed."
45    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
46    echo "(or a newer version if it is available)"
47    DIE=1
48  }
49}
50
51grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
52  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
53  (gettext --version) < /dev/null > /dev/null 2>&1 || {
54    echo
55    echo "**Error**: You must have \`gettext' installed."
56    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
57    echo "(or a newer version if it is available)"
58    DIE=1
59  }
60}
61
62(automake --version) < /dev/null > /dev/null 2>&1 || {
63  echo
64  echo "**Error**: You must have \`automake' installed."
65  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
66  echo "(or a newer version if it is available)"
67  DIE=1
68  NO_AUTOMAKE=yes
69}
70
71
72# if no automake, don't bother testing for aclocal
73test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
74  echo
75  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
76  echo "installed doesn't appear recent enough."
77  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
78  echo "(or a newer version if it is available)"
79  DIE=1
80}
81
82if test "$DIE" -eq 1; then
83  exit 1
84fi
85
86if test -z "$*"; then
87  echo "**Warning**: I am going to run \`configure' with no arguments."
88  echo "If you wish to pass any to it, please specify them on the"
89  echo \`$0\'" command line."
90  echo
91fi
92
93case $CC in
94xlc )
95  am_opt=--include-deps;;
96esac
97
98for coin in `find $srcdir -name configure.in -print`
99do
100  dr=`dirname $coin`
101  if test -f $dr/NO-AUTO-GEN; then
102    echo skipping $dr -- flagged as no auto-gen
103  else
104    echo processing $dr
105    macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
106    ( cd $dr
107      aclocalinclude="$ACLOCAL_FLAGS"
108      for k in $macrodirs; do
109  	if test -d $k; then
110          aclocalinclude="$aclocalinclude -I $k"
111  	##else
112	##  echo "**Warning**: No such directory \`$k'.  Ignored."
113        fi
114      done
115      if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
116	if grep "sed.*POTFILES" configure.in >/dev/null; then
117	  : do nothing -- we still have an old unmodified configure.in
118	else
119	  echo "Creating $dr/aclocal.m4 ..."
120	  test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
121	  echo "Running gettextize...  Ignore non-fatal messages."
122	  echo "no" | gettextize --force --copy
123	  echo "Making $dr/aclocal.m4 writable ..."
124	  test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
125        fi
126      fi
127      if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
128	echo "Creating $dr/aclocal.m4 ..."
129	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
130	echo "Running gettextize...  Ignore non-fatal messages."
131	echo "no" | gettextize --force --copy
132	echo "Making $dr/aclocal.m4 writable ..."
133	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
134      fi
135      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
136	echo "Running libtoolize..."
137	libtoolize --force --copy
138      fi
139      echo "Running aclocal $aclocalinclude ..."
140      aclocal $aclocalinclude
141      if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
142	echo "Running autoheader..."
143	autoheader
144      fi
145      echo "Running automake --gnu $am_opt ..."
146      automake --add-missing --gnu $am_opt
147      echo "Running autoconf ..."
148      autoconf
149    )
150  fi
151done
152
153#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
154
155if test x$NOCONFIGURE = x; then
156  echo Running $srcdir/configure $conf_flags "$@" ...
157  $srcdir/configure $conf_flags "$@" \
158  && echo Now type \`make\' to compile $PKG_NAME
159else
160  echo Skipping configure process.
161fi
162