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