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