1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3# Shamelessly copied from Glade
4
5DIE=0
6
7(autoconf --version) < /dev/null > /dev/null 2>&1 || {
8  echo
9  echo "**Error**: You must have \`autoconf' installed to compile gimp-print."
10  echo "Download the appropriate package for your distribution,"
11  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
12  DIE=1
13}
14
15test -f $srcdir/configure.in.in && sed "s/XXXRELEASE_DATE=XXX/RELEASE_DATE=\"`date '+%d %b %Y'`\"/" $srcdir/configure.in.in > $srcdir/configure.in
16
17test -f $srcdir/ChangeLog || echo > $srcdir/ChangeLog
18
19(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
20  (libtool --version) < /dev/null > /dev/null 2>&1 || {
21    echo
22    echo "**Error**: You must have \`libtool' installed to compile gimp-print."
23    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.4.2.tar.gz"
24    echo "(or a newer version if it is available)"
25    DIE=1
26  }
27}
28
29libtoolv=`libtool --version | sed 's,.*[        ]\([0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\)\)[a-z]*[   ].*,\1,'`
30libtool_major=`echo $libtoolv | awk -F. '{print $1}'`
31libtool_minor=`echo $libtoolv | awk -F. '{print $2}'`
32libtool_point=`echo $libtoolv | awk -F. '{print $3}'`
33
34test "$libtool_major" -le 1 && {
35  test "$libtool_minor" -lt 4 || {
36    test "$libtool_minor" -eq 4 -a "$libtool_point" -lt 3
37  }
38} && {
39  echo
40  echo "**Warning**: You should have \`libtool' 1.4.3 or newer installed to"
41  echo "create a gimp-print distribution.  Earlier versions of gettext do"
42  echo "not generate correct code for all platforms."
43  echo "Get ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.4.3.tar.gz"
44  echo "(or a newer version if it is available)"
45}
46
47
48grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
49  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
50  (gettext --version) < /dev/null > /dev/null 2>&1 || {
51    echo
52    echo "**Error**: You must have \`gettext' installed to compile gimp-print."
53    echo "Get ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.10.40.tar.gz"
54    echo "(or a newer version if it is available)"
55    DIE=1
56  }
57}
58
59#### MRS: The following now only generates a warning, since earlier
60####      versions of gettext *do* work, they just don't create the
61####      right uninstall code.
62
63gettextv=`gettext --version | head -1 | awk '{print $NF}'`
64gettext_major=`echo $gettextv | awk -F. '{print $1}'`
65gettext_minor=`echo $gettextv | awk -F. '{print $2}'`
66gettext_point=`echo $gettextv | awk -F. '{print $3}'`
67
68test "$gettext_major" -eq 0 && {
69  test "$gettext_minor" -lt 10 || {
70    test "$gettext_minor" -eq 10 -a "$gettext_point" -lt 38
71  }
72} && {
73  echo
74  echo "**Warning**: You must have \`gettext' 0.10.38 or newer installed to"
75  echo "create a gimp-print distribution.  Earlier versions of gettext do"
76  echo "not generate the correct 'make uninstall' code."
77  echo "Get ftp://ftp.gnu.org/gnu/gettext/gettext-0.10.40.tar.gz"
78  echo "(or a newer version if it is available)"
79}
80
81(automake --version) < /dev/null > /dev/null 2>&1 || {
82  echo
83  echo "**Error**: You must have \`automake' installed to compile gimp-print."
84  echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz"
85  echo "(or a newer version if it is available)"
86  DIE=1
87  NO_AUTOMAKE=yes
88}
89
90
91# if no automake, don't bother testing for aclocal
92test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
93  echo
94  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
95  echo "installed doesn't appear recent enough."
96  echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz"
97  echo "(or a newer version if it is available)"
98  DIE=1
99}
100
101# Check first for existence and then for proper version of Jade >= 1.2.1
102
103jade_err=0
104
105# Exists?
106jade_exists=`type -p $jade`
107test -z "$jade_exists" && jade_err=1
108
109# Proper rev?
110test "$jade_err" -eq 0 && {
111#  echo "Checking for proper revision of jade..."
112  jade_version=`jade -v < /dev/null 2>&1 | grep -i "jade version" | awk -F\" '{print $2}'`
113
114  jade_version_major=`echo $jade_version | awk -F. '{print $1}'`
115  jade_version_minor=`echo $jade_version | awk -F. '{print $2}'`
116  jade_version_point=`echo $jade_version | awk -F. '{print $3}'`
117
118  test "$jade_version_major" -ge 1 || jade_err=1
119
120  test "$jade_version_minor" -lt 2 || {
121      test "$jade_version_minor" -eq 2 -a "$jade_version_point" -lt 1
122    } && jade_err=1
123
124  test "$jade_err" -eq 1 && {
125    echo " "
126    echo "***Warning***: You must have \"Jade\" version 1.2.1 or"
127    echo "newer installed to build the Gimp-Print user's guide."
128    echo "Get ftp://ftp.jclark.com/pub/jade/jade-1.2.1.tar.gz"
129    echo "(or a newer version if available)"
130    echo " "
131  }
132}
133
134# Check for existence of dvips
135
136dvipsloc=`type -p dvips`
137
138test -z "$dvipsloc" && {
139  echo " "
140  echo "***Warning***: You must have \"dvips\" installed to"
141  echo "build the Gimp-Print user's guide."
142  echo " "
143}
144
145# Check for existence of jadetex
146
147jadetexloc=`type -p jadetex`
148
149test -z "$jadetexloc" && {
150  echo " "
151  echo "***Warning***: You must have \"jadetex\" version 3.5 or"
152  echo "newer installed to build the Gimp-Print user's guide."
153  echo "Get ftp://prdownloads.sourceforge.net/jadetex/jadetex-3.5.tar.gz"
154  echo "(or a newer version if available)"
155  echo " "
156}
157
158# Check for OpenJade >= 1.3
159
160openjade_err=0
161
162openjadeloc=`type -p openjade`
163
164# Exists?
165test -z "$openjadeloc" && openjade_err=1
166
167# Proper rev?
168test "$openjade_err" -eq 0 && {
169#  echo "Checking for proper revision of openjade..."
170  openjade_version=`openjade -v < /dev/null 2>&1 | grep -i "openjade version" $tmp_file | awk -F\" '{print $2}'`
171
172  openjade_version_major=`echo $openjade_version | awk -F. '{print $1}'`
173  openjade_version_minor=`echo $openjade_version | awk -F. '{print $2}'`
174  openjade_version_minor=`echo $openjade_version_minor | awk -F- '{print $1}'`
175
176  test "$openjade_version_major" -ge 1 || openjade_err=1
177  test "$openjade_version_minor" -ge 3 || openjade_err=1
178
179  test "$openjade_err" -eq 1 && {
180    echo " "
181    echo "***Warning***: You must have \"OpenJade\" version 1.3 or"
182    echo "newer installed to build the Gimp-Print user's guide."
183    echo "Get http://download.sourceforge.net/openjade/openjade-1.3.tar.gz"
184    echo "(or a newer version if available)"
185    echo " "
186  }
187}
188
189# Check for ps2pdf
190
191ps2pdfloc=`type -p ps2pdf`
192
193test -z "ps2pdfloc" && {
194  echo " "
195  echo "***Warning***: You must have \"ps2pdf\" installed to"
196  echo "build the Gimp-Print user's guide."
197  echo "\"ps2pdf\" comes from the GNU Ghostscript software package."
198  echo "Get ftp://ftp.gnu.org/gnu/ghostscript/ghostscript-6.5.1.tar.gz"
199  echo "(or a newer version if available)"
200  echo " "
201}
202
203# Check first for existence and then for proper version of sgmltools-lite >=3.0.2
204
205sgmltools_err=0
206
207# Exists?
208sgmltoolsloc=`type -p sgmltools`
209test -z "$sgmltoolsloc" && sgmltools_err=1
210
211# Proper rev?
212test "$sgmltools_err" -eq 0 && {
213#  echo "Checking for proper revision of sgmltools..."
214  sgmltools_version=`sgmltools --version | awk '{print $3}'`
215
216  sgmltools_version_major=`echo $sgmltools_version | awk -F. '{print $1}'`
217  sgmltools_version_minor=`echo $sgmltools_version | awk -F. '{print $2}'`
218  sgmltools_version_point=`echo $sgmltools_version | awk -F. '{print $3}'`
219
220  test "$sgmltools_version_major" -ge 3 || sgmltools_err=1
221  test "$sgmltools_version_minor" -gt 0 ||
222    (test "$sgmltools_version_minor" -eq 0 -a "$sgmltools_version_point" -ge 2) ||
223    sgmltools_err=1
224
225  test "$sgmltools_err" -eq 1 && {
226    echo " "
227    echo "***Warning***: You must have \"sgmltools-lite\" version 3.0.2"
228    echo "or newer installed to build the Gimp-Print user's guide."
229    echo "Get http://prdownloads.sourceforge.net/projects/sgmltools-lite/sgmltools-lite-3.0.2.tar.gz"
230    echo "(or a newer version if available)"
231    echo " "
232  }
233}
234
235# Check for convert
236
237convertloc=`type -p convert`
238test -z "$convertloc" && {
239  echo " "
240  echo "***Warning***: You must have \"convert\" installed to"
241  echo "build the Gimp-Print user's guide."
242  echo "\"convert\" comes from the ImageMagick software package."
243  echo "Go to http://imagemagick.sourceforge.net/http and get"
244  echo "the file ImageMagick-5.3.1.tar.gz"
245  echo "(or a newer version if available)"
246  echo " "
247}
248
249test -d "/usr/share/sgml/docbook_4" || {
250  echo " "
251  echo "***Warning***: You must have "Docbook v4" installed to"
252  echo "build the Gimp-Print user's guide."
253  echo " "
254}
255
256if test "$DIE" -eq 1; then
257  exit 1
258fi
259
260if test -z "$*"; then
261  echo "**Warning**: I am going to run \`configure' with no arguments."
262  echo "If you wish to pass any to it, please specify them on the"
263  echo \`$0\'" command line."
264  echo
265fi
266
267case $CC in
268xlc )
269  am_opt=--include-deps;;
270esac
271
272for coin in `find $srcdir -name configure.in -print`
273do
274  dr=`dirname $coin`
275  if test -f $dr/NO-AUTO-GEN; then
276    echo skipping $dr -- flagged as no auto-gen
277  else
278    echo processing $dr
279    macrodirs=`sed -n -e 's,^dnl AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
280    ( cd $dr
281      aclocalinclude="$ACLOCAL_FLAGS"
282      for k in $macrodirs; do
283  	if test -d $k; then
284          aclocalinclude="$aclocalinclude -I $k"
285  	##else
286	##  echo "**Warning**: No such directory \`$k'.  Ignored."
287        fi
288      done
289      if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
290	if grep "sed.*POTFILES" configure.in >/dev/null; then
291	  : do nothing -- we still have an old unmodified configure.in
292	else
293	  echo "Creating $dr/aclocal.m4 ..."
294	  test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
295	  # We've removed po/ChangeLog from the repository.  Version
296	  # 0.10.40 of gettext appends an entry to the ChangeLog every time
297	  # anyone runs autogen.sh.  Since developers do that a lot, and
298	  # then proceed to commit their entire sandbox, we wind up with
299	  # an ever-growing po/ChangeLog that generates CVS conflicts on
300	  # a routine basis.  There's no good reason for this.
301	  echo 'This ChangeLog is redundant. Please see the main ChangeLog for i18n changes.' > po/ChangeLog
302	  echo >> po/ChangeLog
303	  echo 'This file is present only to keep po/Makefile.in.in happy.' >> po/ChangeLog
304	  echo "Running gettextize...  Ignore non-fatal messages."
305	  echo "no" | gettextize --force --copy
306	  echo "Making $dr/aclocal.m4 writable ..."
307	  test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
308        fi
309      fi
310      if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
311	echo "Creating $dr/aclocal.m4 ..."
312	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
313	echo "Running gettextize...  Ignore non-fatal messages."
314	echo "no" | gettextize --force --copy
315	echo "Making $dr/aclocal.m4 writable ..."
316	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
317      fi
318      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
319	echo "Running libtoolize..."
320	libtoolize --force --copy
321      fi
322      echo "Running aclocal $aclocalinclude ..."
323      if aclocal $aclocalinclude -I src/main ; then
324        echo "added local version of AM_PATH_GIMPPRINT"
325      else
326        echo "aclocal returned error status; running again without '-I src/main' ..."
327        aclocal $aclocalinclude
328	echo "using installed version of AM_PATH_GIMPPRINT"
329      fi
330      if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
331	echo "Running autoheader..."
332	autoheader
333      fi
334      echo "Running automake --gnu $am_opt ..."
335      automake --add-missing --gnu $am_opt
336      echo "Running autoconf ..."
337      autoconf
338    )
339  fi
340done
341
342conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
343
344if test x$NOCONFIGURE = x; then
345  echo Running $srcdir/configure $conf_flags "$@" ...
346  $srcdir/configure $conf_flags "$@" \
347  && echo Now type \`make\' to compile $PKG_NAME || exit 1
348else
349  echo Skipping configure process.
350fi
351