Fix #736: Please migrate from gnome-doc-tool to yelp-build
[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.ac\
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.ac >/dev/null) && {
28   (grep "sed.*POTFILES" $srcdir/configure.ac) >/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 (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
39   echo
40   echo "**Error**: You must have \`intltoolize' installed" 
41   DIE=1
42 }
43
44 (automake --version) < /dev/null > /dev/null 2>&1 || {
45   echo
46   echo "**Error**: You must have \`automake' installed."
47   echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
48   DIE=1
49   NO_AUTOMAKE=yes
50 }
51
52 # if no automake, don't bother testing for aclocal
53 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
54   echo
55   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
56   echo "installed doesn't appear recent enough."
57   echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
58   DIE=1
59 }
60
61 GNOMEDOC=`which yelp-build`
62 if test -z $GNOMEDOC; then
63   echo "*** The tools to build the documentation are not found,"
64   echo "    please intall the yelp-tool package ***"
65   DIE=1
66 fi
67
68 if test "$DIE" -eq 1; then
69   exit 1
70 fi
71
72 if test -z "$*"; then
73   echo "**Warning**: I am going to run \`configure' with no arguments."
74   echo "If you wish to pass any to it, please specify them on the"
75   echo \`$0\'" command line."
76   echo
77 fi
78
79 case $CC in
80 xlc )
81   am_opt=--include-deps;;
82 esac
83
84 auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $srcdir/configure.ac`"
85 if test -n "$auxdir"; then
86   if test ! -d "$srcdir/$auxdir"; then
87     mkdir -p "$srcdir/$auxdir"
88   fi                                                                            fi
89
90 for coin in `find $srcdir -name configure.ac -print`
91 do 
92   dr=`dirname $coin`
93   if test -f $dr/NO-AUTO-GEN; then
94     echo skipping $dr -- flagged as no auto-gen
95   else
96     echo processing $dr
97     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
98     ( cd $dr
99       aclocalinclude="$ACLOCAL_FLAGS"
100       for k in $macrodirs; do
101         if test -d $k; then
102           aclocalinclude="$aclocalinclude -I $k"
103         ##else 
104         ##  echo "**Warning**: No such directory \`$k'.  Ignored."
105         fi
106       done
107       if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
108         if grep "sed.*POTFILES" configure.ac >/dev/null; then
109           : do nothing -- we still have an old unmodified configure.ac
110         else
111           echo "Creating $dr/aclocal.m4 ..."
112           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
113           echo "Running glib-gettextize..."
114           echo "no" | glib-gettextize --force --copy
115           echo "Running intltoolize"
116           intltoolize --copy --force --automake
117           if intltoolize --version | grep -q ' 0.40.6'; then
118                   echo "Workaround intltoolize 0.40.6 bug (LINGUAS)"
119                   sed "s:'\^\$\$lang\$\$':\^\$\$lang\$\$:g" -i po/Makefile.in.in
120           fi
121           echo "Making $dr/aclocal.m4 writable ..."
122           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
123         fi
124       fi
125       echo "Running aclocal $aclocalinclude ..."
126       aclocal $aclocalinclude
127       if grep "^AC_CONFIG_HEADER" configure.ac >/dev/null; then
128         echo "Running autoheader..."
129         autoheader
130       fi
131       echo "Running automake --gnu $am_opt ..."
132       automake --add-missing --gnu $am_opt
133       echo "Running autoconf ..."
134       autoconf
135     )
136   fi
137 done
138
139 conf_flags="--enable-maintainer-mode" #--enable-iso-c
140
141 if test x$NOCONFIGURE = x; then
142   echo Running $srcdir/configure $conf_flags "$@" ...
143   $srcdir/configure $conf_flags "$@" \
144   && echo Now type \`make\' to compile $PKG_NAME
145 else
146   echo Skipping configure process.
147 fi