Initial revision
[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/gqview.h) || {
12     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
13     echo " top-level gqview 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_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
28   grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
29   (gettext --version) < /dev/null > /dev/null 2>&1 || {
30     echo
31     echo "**Error**: You must have \`gettext' installed."
32     echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
33     echo "(or a newer version if it is available)"
34     DIE=1
35   }
36 }
37
38 # if no automake, don't bother testing for aclocal
39 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
40   echo
41   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
42   echo "installed doesn't appear recent enough."
43   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
44   echo "(or a newer version if it is available)"
45   DIE=1
46 }
47
48 if test "$DIE" -eq 1; then
49   exit 1
50 fi
51
52 if test -z "$*"; then
53   echo "**Warning**: I am going to run \`configure' with no arguments."
54   echo "If you wish to pass any to it, please specify them on the"
55   echo \`$0\'" command line."
56   echo
57 fi
58
59 case $CC in
60 xlc )
61   am_opt=--include-deps;;
62 esac
63
64 for coin in `find $srcdir -name configure.in -print`
65 do 
66   dr=`dirname $coin`
67   if test -f $dr/NO-AUTO-GEN; then
68     echo skipping $dr -- flagged as no auto-gen
69   else
70     echo processing $dr
71     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
72     ( cd $dr
73       aclocalinclude="$ACLOCAL_FLAGS"
74       for k in $macrodirs; do
75         if test -d $k; then
76           aclocalinclude="$aclocalinclude -I $k"
77         ##else 
78         ##  echo "**Warning**: No such directory \`$k'.  Ignored."
79         fi
80       done
81       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
82         if grep "sed.*POTFILES" configure.in >/dev/null; then
83           : do nothing -- we still have an old unmodified configure.in
84         else
85           echo "Creating $dr/aclocal.m4 ..."
86           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
87           echo "Running gettextize...  Ignore non-fatal messages."
88           echo "no" | gettextize --force --copy
89           echo "Making $dr/aclocal.m4 writable ..."
90           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
91         fi
92       fi
93       echo "Running aclocal $aclocalinclude ..."
94       aclocal $aclocalinclude
95       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
96         echo "Running autoheader..."
97         autoheader
98       fi
99       echo "Running automake --gnu $am_opt ..."
100       automake --add-missing --gnu $am_opt
101       echo "Running autoconf ..."
102       autoconf
103     )
104   fi
105 done
106
107 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
108
109 if test x$NOCONFIGURE = x; then
110   echo Running $srcdir/configure $conf_flags "$@" ...
111   $srcdir/configure $conf_flags "$@" \
112   && echo Now type \`make\' to compile $PKG_NAME
113 else
114   echo Skipping configure process.
115 fi