changing the project name
[xorg/xkeyboard-config] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5
6 srcdir=`dirname $0`
7 PKG_NAME=xkeyboard-config
8
9 if [ -n "$GNOME2_PATH" ]; then
10         ACLOCAL_FLAGS="-I $GNOME2_PATH/share/aclocal $ACLOCAL_FLAGS"
11         PATH="$GNOME2_PATH/bin:$PATH"
12         export PATH
13 fi
14
15 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
16   echo
17   echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
18   echo "Download the appropriate package for your distribution,"
19   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
20   DIE=1
21 }
22
23 (grep "^AC_PROG_INTLTOOL" $srcdir/configure.in >/dev/null) && {
24   (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
25     echo 
26     echo "**Error**: You must have \`intltoolize' installed to compile $PKG_NAME."
27     echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.10.tar.gz"
28     echo "(or a newer version if it is available)"
29     DIE=1
30   }
31 }
32
33 (grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.in >/dev/null) && {
34   (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
35     echo 
36     echo "**Error**: You must have \`xml-i18n-toolize' installed to compile $PKG_NAME."
37     echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/xml-i18n-tools/xml-i18n-tools-0.9.tar.gz"
38     echo "(or a newer version of xml-i18n-tools or intltool if it is available)"
39     DIE=1
40   }
41 }
42
43 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
44   (libtool --version) < /dev/null > /dev/null 2>&1 || {
45     echo
46     echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
47     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
48     echo "(or a newer version if it is available)"
49     DIE=1
50   }
51 }
52
53 #grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
54 #  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
55 #  (gettext --version) < /dev/null > /dev/null 2>&1 || {
56 #    echo
57 #    echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME."
58 #    echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.10.39.tar.gz"
59 #    echo "(or a newer version if it is available)"
60 #    DIE=1
61 #  }
62 #}
63
64 #grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
65 #  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
66 #  (gettext --version) < /dev/null > /dev/null 2>&1 || {
67 #    echo
68 #    echo "**Error**: You must have \`gettext' installed to compile $PKG_NAME."
69 #    echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.10.39.tar.gz"
70 #    echo "(or a newer version if it is available)"
71 #    DIE=1
72 #  }
73 #}
74
75 (automake --version) < /dev/null > /dev/null 2>&1 || {
76   echo
77   echo "**Error**: You must have \`automake' installed to compile $PKG_NAME."
78   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
79   echo "(or a newer version if it is available)"
80   DIE=1
81   NO_AUTOMAKE=yes
82 }
83
84
85 # if no automake, don't bother testing for aclocal
86 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
87   echo
88   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
89   echo "installed doesn't appear recent enough."
90   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
91   echo "(or a newer version if it is available)"
92   DIE=1
93 }
94
95 if test "$DIE" -eq 1; then
96   exit 1
97 fi
98
99 if test -z "$*"; then
100   echo "**Warning**: I am going to run \`configure' with no arguments."
101   echo "If you wish to pass any to it, please specify them on the"
102   echo \`$0\'" command line."
103   echo
104 fi
105
106 case $CC in
107 xlc )
108   am_opt=--include-deps;;
109 esac
110
111 for coin in `find $srcdir -name configure.in -print`
112 do 
113   dr=`dirname $coin`
114   if test -f $dr/NO-AUTO-GEN; then
115     echo skipping $dr -- flagged as no auto-gen
116   else
117     echo processing $dr
118     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
119     ( cd $dr
120       macrosdir=`find . -name macros -print`
121       for i in $macrodirs; do
122         if test -f $i/gnome-gettext.m4; then
123           DELETEFILES="$DELETEFILES $i/gnome-gettext.m4"
124         fi
125       done
126
127       echo "deletefiles is $DELETEFILES"
128       aclocalinclude="$ACLOCAL_FLAGS"
129       for k in $aclocalinclude; do
130         if test -d $k; then
131           if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then
132             rm -f $DELETEFILES
133           fi
134         fi
135       done
136       for k in $macrodirs; do
137         if test -d $k; then
138           aclocalinclude="$aclocalinclude -I $k"
139           if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then
140             rm -f $DELETEFILES
141           fi
142         fi
143       done
144       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
145         if grep "sed.*POTFILES" configure.in >/dev/null; then
146           : do nothing -- we still have an old unmodified configure.in
147         else
148           echo "Creating $dr/aclocal.m4 ..."
149           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
150           echo "Running gettextize...  Ignore non-fatal messages."
151           echo "no" | gettextize --intl --force --copy
152           echo "Making $dr/aclocal.m4 writable ..."
153           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
154         fi
155       fi
156       if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
157         echo "Creating $dr/aclocal.m4 ..."
158         test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
159         echo "Running gettextize...  Ignore non-fatal messages."
160         echo "no" | gettextize --intl --force --copy
161         echo "Making $dr/aclocal.m4 writable ..."
162         test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
163       fi
164       if grep "^AC_PROG_INTLTOOL" configure.in >/dev/null; then
165         echo "Running intltoolize..."
166         intltoolize --copy --force --automake
167       fi
168       if grep "^AM_PROG_XML_I18N_TOOLS" configure.in >/dev/null; then
169         echo "Running xml-i18n-toolize..."
170         xml-i18n-toolize --copy --force --automake
171       fi
172       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
173         if test -z "$NO_LIBTOOLIZE" ; then 
174           echo "Running libtoolize..."
175           libtoolize --force --copy
176         fi
177       fi
178       echo "Running aclocal $aclocalinclude ..."
179       aclocal $aclocalinclude || {
180         echo
181         echo "**Error**: aclocal failed. This may mean that you have not"
182         echo "installed all of the packages you need, or you may need to"
183         echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
184         echo "for the prefix where you installed the packages whose"
185         echo "macros were not found"
186         exit 1
187       }
188
189       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
190         echo "Running autoheader..."
191         autoheader || { echo "**Error**: autoheader failed."; exit 1; }
192       fi
193       #echo "Running automake --gnu $am_opt ..."
194       #automake --add-missing --gnu $am_opt ||
195       echo "Running automake --foreign $am_opt ..."
196       automake --add-missing --foreign $am_opt ||
197         { echo "**Error**: automake failed."; exit 1; }
198       echo "Running autoconf ..."
199       autoconf || { echo "**Error**: autoconf failed."; exit 1; }
200     ) || exit 1
201   fi
202 done
203
204 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
205
206 if test x$NOCONFIGURE = x; then
207   echo Running $srcdir/configure $conf_flags "$@" ...
208   $srcdir/configure $conf_flags "$@" \
209   && echo Now type \`make\' to compile $PKG_NAME || exit 1
210 else
211   echo Skipping configure process.
212 fi