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