]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/aclocal.m4
* stepmake/stepmake/*:
[lilypond.git] / stepmake / aclocal.m4
1 dnl aclocal.m4   -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
3
4
5 ### mostly interal macros
6
7 # Get full path of executable ($1)
8 AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [
9     ## which doesn't work in ash, if /usr/bin/which isn't installed
10     ## type -p doesn't work in ash
11     ## command -v doesn't work in zsh
12     ## command -v "$1" 2>&1
13     ## this test should work in ash, bash, pdksh (ksh), zsh
14     type -p $1 2>/dev/null | tail -n 1 | awk '{print $NF}'
15 ])
16
17
18 # Get version string from executable ($1)
19 AC_DEFUN(STEPMAKE_GET_VERSION, [
20     ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}'
21     ##
22     ## ARG.
23     ## Workaround for broken Debian gcc version string:
24     ##     gcc (GCC) 3.1.1 20020606 (Debian prerelease)
25     ##
26     ## -V: Workaround for python
27
28     changequote(<<, >>)#dnl
29     ## Assume and hunt for dotted version multiplet.
30     ## use eval trickery, because we cannot use multi-level $() instead of ``
31     ## for compatibility reasons.
32     ## FIXME: what systems still do not have $() in /bin/sh?
33     eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \
34         | head -n 1 \
35         | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
36             -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
37     if test -z "$_ver"; then
38         ## If empty, try date [fontforge]
39         eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
40             | head -n 1 \
41             | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
42     fi
43     echo "$_ver"
44     changequote([, ])#dnl
45 ])
46
47 # Calculate simplistic numeric version from version string ($1)
48 # As yet, we have no need for something more elaborate.
49 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
50     echo "$1" | awk -F. '
51     {
52       if ([$]3) {three = [$]3}
53       else {three = 0}
54     }
55     {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
56 ])
57
58
59 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
60 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
61     eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
62 ])
63
64 # Check if tested program ($2) was found ($1).
65 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
66 # We could abort here if a 'REQUIRED' program is not found
67 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
68     STEPMAKE_CHECK_SEARCH_RESULT($1)
69     if test $? -ne 0; then
70         STEPMAKE_ADD_ENTRY($3, $2)
71         if test "$3" = "REQUIRED"; then
72             command="echo ERROR: $2 not found"
73             # abort configure process here?
74         else
75             command="- echo $2 not found"
76         fi
77         eval "$1"='$command'
78         false
79     else
80         true
81     fi
82 ])
83
84
85 # Return if tested proram ($1) was found (true) or not (false).
86 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
87     r="`eval echo '$'"$1"`"
88     if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
89         true
90     else
91         ##STEPMAKE_WARN(cannot find $2. $3)
92         false
93     fi
94 ])
95
96
97 # Check version of program ($1)
98 # If version ($4: optional argument, supply if version cannot be
99 # parsed using --version or -V ) is smaller than requested ($3), add
100 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
101 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
102     r="`eval echo '$'"$1"`"
103     AC_MSG_CHECKING([$r version])
104     exe=`STEPMAKE_GET_EXECUTABLE($r)`
105     if test -n "$4"; then
106         ver="$4"
107     else
108         ver=`STEPMAKE_GET_VERSION($exe)`
109     fi
110     num=`STEPMAKE_NUMERIC_VERSION($ver)`
111     req=`STEPMAKE_NUMERIC_VERSION($3)`
112     AC_MSG_RESULT([$ver])
113     if test "$num" -lt "$req"; then
114         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
115     fi
116     vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
117     eval `echo $vervar=$num`
118 ##    AC_SUBST(`eval echo $vervar`)
119 ])
120
121 # Check version of program ($1)
122 # If version is greater than or equals unsupported ($3),
123 # add entry to unsupported list ($2, 'UNSUPPORTED')
124 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
125     r="`eval echo '$'"$1"`"
126     AC_MSG_CHECKING([$r version])
127     exe=`STEPMAKE_GET_EXECUTABLE($r)`
128     ver=`STEPMAKE_GET_VERSION($exe)`
129     num=`STEPMAKE_NUMERIC_VERSION($ver)`
130     sup=`STEPMAKE_NUMERIC_VERSION($3)`
131     AC_MSG_RESULT([$ver])
132     if test "$num" -ge "$sup"; then
133         STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
134     fi
135 ])
136
137 ### Macros to build configure.in
138
139
140 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
141     STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
142     if test "$BIBTEX2HTML" = "bib2html"; then
143         BIBTEX2HTML_FLAGS='$< $(@)'
144     else
145         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
146     fi
147     AC_SUBST(BIBTEX2HTML)
148     AC_SUBST(BIBTEX2HTML_FLAGS)
149 ])
150
151
152 AC_DEFUN(STEPMAKE_BISON, [
153     # ugh, automake: we want (and check for) bison
154     AC_PROG_YACC
155     
156     STEPMAKE_PROGS(BISON, bison, $1)
157     
158     # urg.  should test functionality rather than version.
159     if test "$BISON" = "bison" -a -n "$2"; then
160         STEPMAKE_CHECK_VERSION(BISON, $1, $2)
161     fi
162 ])
163
164
165 AC_DEFUN(STEPMAKE_COMPILE, [
166     # -O is necessary to get inlining
167     CFLAGS=${CFLAGS-""}
168     CXXFLAGS=${CXXFLAGS-$CFLAGS}
169     LDFLAGS=${LDFLAGS-""}
170     optimise_b=yes
171     profile_b=no
172     debug_b=yes
173     pipe_b=yes
174
175     AC_ARG_ENABLE(debugging,
176     [  --enable-debugging      compile with debugging info.  Default: on],
177     [debug_b=$enableval])
178
179     AC_ARG_ENABLE(optimising,
180     [  --enable-optimising     compile with optimising.  Default: on],
181     [optimise_b=$enableval])
182
183     AC_ARG_ENABLE(profiling, 
184     [  --enable-profiling      compile with gprof support.  Default: off],
185     [profile_b=$enableval])
186     
187     AC_ARG_ENABLE(pipe, 
188     [  --enable-pipe           compile with -pipe.  Default: on],
189     [pipe_b=$enableval])
190
191     if test "$optimise_b" = yes; then
192         AC_DEFINE(NDEBUG)
193         DEFINES="$DEFINES -DNDEBUG"
194         OPTIMIZE="-O2 -finline-functions"
195     fi
196
197     if test $profile_b = yes; then
198         EXTRA_LIBS="-pg"
199         OPTIMIZE="$OPTIMIZE -pg"
200     fi
201
202     if test $debug_b = yes; then
203         OPTIMIZE="$OPTIMIZE -g"
204     fi
205  
206     AC_PROG_CC
207     STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
208     LD='$(CC)'
209     AC_SUBST(LD)
210
211     # If -pipe requested, test if it works and add to CFLAGS.
212     if test "$pipe_b" = yes; then
213         save_cflags="$CFLAGS"
214         CFLAGS="-pipe $CFLAGS";
215         AC_CACHE_CHECK([whether compiler understands -pipe],
216             [stepmake_cflags_pipe],
217             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
218                 [stepmake_cflags_pipe=yes],
219                 [stepmake_cflags_pipe=no]))
220         CFLAGS=$save_cflags
221         if test $stepmake_cflags_pipe = yes; then
222             OPTIMIZE="$OPTIMIZE -pipe"
223         fi
224     fi
225
226     CFLAGS="$CFLAGS $OPTIMIZE"
227     CPPFLAGS=${CPPFLAGS-""}
228
229     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
230     save_cflags="$CFLAGS"
231     case "$host" in
232         alpha*-*-*)
233             dnl should do compile test?
234             AC_MSG_RESULT(-mieee)
235             CFLAGS="-mieee $CFLAGS"
236             ;;
237         *)
238             AC_MSG_RESULT([none])
239             ;;
240     esac
241
242     AC_SUBST(cross_compiling)
243     AC_SUBST(CFLAGS)
244     AC_SUBST(CPPFLAGS)
245     AC_SUBST(LDFLAGS)
246     AC_SUBST(DEFINES)
247     AC_SUBST(EXTRA_LIBS)
248 ])
249
250 AC_DEFUN(STEPMAKE_CXX, [
251     AC_LANG([C++])
252     AC_PROG_CXX
253     STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
254
255     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
256     LD='$(CXX)'
257
258     AC_SUBST(CXX)
259     AC_SUBST(CXXFLAGS)
260     AC_SUBST(LD)
261 ])
262
263
264 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
265     AC_CACHE_CHECK([whether explicit instantiation is needed],
266         lily_cv_need_explicit_instantiation,
267         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
268     template <class T> struct foo { static int baz; };
269     template <class T> int foo<T>::baz = 1;
270     ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
271     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
272         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
273     fi
274 ])
275
276
277 AC_DEFUN(STEPMAKE_DATADIR, [
278     if test "$datadir" = "\${prefix}/share"; then
279             datadir='${prefix}/share'
280     fi
281     presome=${prefix}
282     if test "$prefix" = "NONE"; then
283         presome=${ac_default_prefix}
284     fi
285     
286     build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package
287     
288     DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
289     BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
290     
291     AC_SUBST(datadir)
292     AC_SUBST(build_package_datadir)
293     AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
294     AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
295 ])
296
297 ## ugh: cut & paste programming from datadir. 
298 AC_DEFUN(STEPMAKE_LIBDIR, [
299
300     if test "$libdir" = "\${exec_prefix}/lib"; then
301         libdir='${exec_prefix}/lib'
302     fi
303     presome=$exec_prefix
304     build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package
305     
306     LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
307     BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
308     
309     AC_SUBST(libdir)
310     AC_SUBST(build_package_libdir)
311     AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
312     AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
313 ])
314
315
316 AC_DEFUN(STEPMAKE_END, [
317     AC_SUBST(OPTIONAL)
318     AC_SUBST(REQUIRED)
319     
320     AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
321     AC_OUTPUT
322     
323     if test -n "$OPTIONAL"; then
324         echo
325         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
326     fi
327
328     if test -n "$REQUIRED"; then
329         echo
330         echo "ERROR: Please install required programs: $REQUIRED"
331     fi
332     
333     if test -n "$UNSUPPORTED"; then
334         echo
335         echo "ERROR: Please use older version of programs: $UNSUPPORTED"
336     fi
337     
338     if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
339         echo
340         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
341         if test -f config.cache ; then
342             echo "Remove config.cache before rerunning ./configure"
343         fi 
344     fi
345     
346     if test -n "$REQUIRED$UNSUPPORTED"; then
347         rm -f $srcdir/GNUmakefile
348         exit 1
349     fi
350
351     # regular in-place build
352     # test for srcdir_build = yes ?
353     if test "$srcdir_build" = "yes"; then
354         rm -f $srcdir/GNUmakefile
355         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
356         chmod 444 $srcdir/GNUmakefile
357     else
358         if test -f $srcdir/GNUmakefile; then
359             cat <<EOF
360 Source directory already configured.  Please clean the source directory
361
362      make -C $srcdir distclean
363
364 and rerun configure.
365 EOF
366             exit 2
367         fi
368         rm -f GNUmakefile
369         cp $srcdir/GNUmakefile.in GNUmakefile
370         ## (cd $srcdir && find . -name GNUmakefile -o -name '*.make' | grep -v config.make | xargs tar -cf-) | tar -xf-
371         for i in $(cd $srcdir && find . -name GNUmakefile -o -name '*.make' | grep -v config.make); do
372             mkdir -p $(dirname $i)
373             ln -sf $srcdir/$i $i
374         done
375         ln -sf $srcdir/VERSION .
376         AC_SUBST(VPATH)
377     fi
378 ])
379
380
381 AC_DEFUN(STEPMAKE_FLEX, [
382     # ugh, automake: we want (and check for) flex
383     # AC_PROG_LEX
384     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
385
386     # AC_PROG_LEX()
387     # ugh, ugh
388     ac_cv_prog_lex_root=lex.yy
389     STEPMAKE_PROGS(FLEX, flex, $1)
390 ])
391
392
393 AC_DEFUN(STEPMAKE_FLEXLEXER, [
394     AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
395     if test $? -ne 0; then
396         warn='FlexLexer.h (flex package)'
397         STEPMAKE_ADD_ENTRY($1, $warn)
398     fi
399     # check for yyFlexLexer.yy_current_buffer,
400     # in 2.5.4 <= flex < 2.5.29
401     AC_LANG_PUSH(C++)
402     AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
403         [stepmake_flexlexer_yy_current_buffer],
404         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
405 using namespace std;
406 #include <FlexLexer.h>
407 class yy_flex_lexer: public yyFlexLexer
408 {
409   public:
410     yy_flex_lexer ()
411     {
412       yy_current_buffer = 0;
413     }
414 };
415 ]])],
416             [stepmake_flexlexer_yy_current_buffer=yes],
417             [stepmake_flexlexer_yy_current_buffer=no]))
418     if test $stepmake_flexlexer_yy_current_buffer = yes; then
419         AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
420     fi
421     AC_LANG_POP(C++)
422 ])
423   
424
425
426 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
427         AC_MSG_CHECKING([FlexLexer.h path])
428
429         # ugh.
430         cat <<EOF > conftest.cc
431 using namespace std;
432 #include <FlexLexer.h>
433 EOF
434         FLEXLEXER_PATH=`$CXX -E conftest.cc | \
435           sed 's!# 1 "\(.*\)FlexLexer.h"!@FLEXLEXER@\1@@!g' | grep '@@' | \
436           sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` >& /dev/null
437         rm conftest.cc
438         AC_SUBST(FLEXLEXER_PATH)
439         AC_MSG_RESULT($FLEXLEXER_PATH)
440 ])
441
442 AC_DEFUN(STEPMAKE_GCC, [
443     if test "$GCC" = "yes"; then
444         STEPMAKE_CHECK_VERSION(CC, $1, $2)
445     else
446         warn="$CC (Please install *GNU* cc)"
447         STEPMAKE_ADD_ENTRY($1, $warn)
448     fi
449 ])
450
451 AC_DEFUN(STEPMAKE_GETTEXT, [
452     presome=${prefix}
453     if test "$prefix" = "NONE"; then
454             presome=${ac_default_prefix}
455     fi
456     LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
457     
458     AC_SUBST(localedir)
459     AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
460     # ouch.  autoconf <= 2.57's gettext check fails for
461     # g++ >= 3.3 (with -std=gnu++98, the default).
462     # While the check is OK for g++ -std=c++98,
463     # LilyPond needs GNU g++, so who is to blame here?
464     # Use a workaround until this is resolved:
465     # for g++ >= 3.3, select C language.
466     GCC_UNSUPPORTED=
467     STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
468     if test -n "$GCC_UNSUPPORTED"; then
469         AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
470         AC_MSG_WARN([Trying gcc, cross fingers.])
471         AC_LANG_PUSH(C)
472     fi
473     AC_CHECK_LIB(intl, gettext)
474     AC_CHECK_FUNCS(gettext)
475     if test -n "$GCC_UNSUPPORTED"; then
476         AC_LANG_POP(C)
477     fi
478 ])
479
480
481 AC_DEFUN(STEPMAKE_GUILE, [
482     STEPMAKE_PATH_PROG(GUILE, guile, $1)
483 ])
484
485
486 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
487 #
488 #   This macro runs the guile-config script, installed with Guile,
489 #   to find out where Guile's header files and libraries are
490 #   installed.  It sets two variables, marked for substitution, as
491 #   by AC_SUBST.
492 #   
493 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
494 #             code that uses Guile header files.  This is almost
495 #             always just a -I flag.
496 #   
497 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
498 #             program against Guile.  This includes -lguile for
499 #             the Guile library itself, any libraries that Guile
500 #             itself requires (like -lqthreads), and so on.  It may
501 #             also include a -L flag to tell the compiler where to
502 #             find the libraries.
503
504 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
505     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
506     if test -x $exe; then
507         AC_MSG_CHECKING([guile compile flags])
508         GUILE_CFLAGS="`$guile_config compile`"
509         AC_MSG_RESULT($GUILE_CFLAGS)
510         AC_MSG_CHECKING([guile link flags])
511         GUILE_LDFLAGS="`$guile_config link`"
512         AC_MSG_RESULT($GUILE_LDFLAGS)
513     fi
514     AC_SUBST(GUILE_CFLAGS)
515     AC_SUBST(GUILE_LDFLAGS)
516 ])
517
518
519 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
520     ## First, let's just see if we can find Guile at all.
521     test -n "$target_alias" && target_guile_config=$target_alias-guile-config
522     test -n "$host_alias" && host_guile_config=$host_alias-guile-config
523     AC_MSG_CHECKING([for guile-config])
524     for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
525         AC_MSG_RESULT([$guile_config])
526         if ! $guile_config --version > /dev/null 2>&1 ; then
527             AC_MSG_WARN([cannot execute $guile_config])
528             AC_MSG_CHECKING([if we are cross compiling])
529             GUILE_CONFIG='echo no guile-config'
530         else
531             GUILE_CONFIG=$guile_config
532             break
533         fi
534     done
535     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
536     if test $? -ne 0; then
537         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
538     fi 
539
540     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
541     # urg.  should test functionality rather than version.
542     if test $? -eq 0 -a -n "$2"; then
543         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
544     fi
545
546     AC_SUBST(GUILE_CONFIG)
547     
548     guile_version="$ver"
549     changequote(<<, >>)#dnl
550     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
551     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
552     GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
553     changequote([, ])#dnl
554     STEPMAKE_GUILE_FLAGS
555     save_CPPFLAGS="$CPPFLAGS"
556     save_LIBS="$LIBS"
557     CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
558     LIBS="$GUILE_LDFLAGS $LIBS"
559     AC_CHECK_HEADERS([libguile.h])
560     AC_CHECK_LIB(guile, scm_boot_guile)
561     AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
562     if test "$libguile_b" = "no"; then
563             warn='libguile (libguile-dev, guile-devel or guile-dev
564    package).'
565             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
566     fi
567     CPPFLAGS="$save_CPPFLAGS"
568     LIBS="$save_LIBS"
569     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
570     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
571     AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
572 ])
573
574
575 AC_DEFUN(STEPMAKE_DLOPEN, [
576     AC_CHECK_LIB(dl, dlopen)
577     AC_CHECK_FUNCS(dlopen)
578 ])
579
580 AC_DEFUN(STEPMAKE_GXX, [
581     if test "$GXX" = "yes"; then
582         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
583     else
584         warn="$CXX (Please install *GNU* c++)"
585         STEPMAKE_ADD_ENTRY($1, $warn)
586     fi
587 ])
588
589
590 AC_DEFUN(STEPMAKE_INIT, [
591
592     AC_PREREQ(2.50)
593     . $srcdir/VERSION
594     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
595     MICRO_VERSION=$PATCH_LEVEL
596     TOPLEVEL_VERSION=$FULL_VERSION
597     if test x$MY_PATCH_LEVEL != x; then
598         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
599     fi
600     VERSION=$FULL_VERSION
601     export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
602     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
603     changequote(<<, >>)#dnl
604     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
605     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
606     changequote([, ])#dnl
607
608     # No versioning on directory names of sub-packages 
609     # urg, urg
610     stepmake=${datadir}/stepmake
611     presome=${prefix}
612     if test "$prefix" = "NONE"; then
613             presome=${ac_default_prefix}
614     fi
615     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
616
617     # urg, how is this supposed to work?
618     if test "$program_prefix" = "NONE"; then
619           program_prefix=
620     fi
621     if test "$program_suffix" = "NONE"; then
622           program_suffix=
623     fi
624
625     AC_MSG_CHECKING(Package)
626     if test "$PACKAGE" = "STEPMAKE"; then
627         AC_MSG_RESULT(Stepmake package!)
628
629         AC_MSG_CHECKING(builddir)
630
631         ugh_ugh_autoconf250_builddir="`pwd`"
632         
633         if test "$srcdir" = "."; then
634             srcdir_build=yes
635         else
636             srcdir_build=no
637             package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
638             package_srcdir="`dirname  $srcdir`"
639         fi
640         AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
641
642         (cd stepmake 2>/dev/null || mkdir stepmake)
643         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
644 # only possible with autoconf < 2.50 -- hardcoded in configure.in
645 #       AC_CONFIG_AUX_DIR(bin)
646         stepmake=stepmake
647     else
648         AC_MSG_RESULT($PACKAGE)
649
650         AC_MSG_CHECKING(builddir)
651         ugh_ugh_autoconf250_builddir="`pwd`"
652         if test "$srcdir" = "."; then
653             srcdir_build=yes
654         else
655             srcdir_build=no
656         fi
657         AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
658
659         AC_MSG_CHECKING(for stepmake)
660         # Check for installed stepmake
661         if test -d $stepmake; then
662             AC_MSG_RESULT($stepmake)
663         else
664             stepmake="`cd $srcdir/stepmake; pwd`"
665             AC_MSG_RESULT([$srcdir/stepmake  ($datadir/stepmake not found)])
666         fi
667
668 # only possible with autoconf < 2.50 -- hardcoded in configure.in
669 #       AC_CONFIG_AUX_DIR(\
670 #         stepmake/bin\
671 #         $srcdir/stepmake/bin\
672 #       )
673     fi
674
675     AC_SUBST(ugh_ugh_autoconf250_builddir)
676     AC_SUBST(srcdir)
677     AC_SUBST(stepmake)
678     AC_SUBST(package)
679     AC_SUBST(PACKAGE)
680     AC_SUBST(PACKAGE_NAME)
681     AC_SUBST(VERSION)
682     AC_SUBST(MAJOR_VERSION)
683     AC_SUBST(MINOR_VERSION)
684     AC_SUBST(MICRO_VERSION)
685
686     # stepmake nonstandard names
687     AC_SUBST(PATCH_LEVEL)
688     AC_SUBST(TOPLEVEL_VERSION)
689     
690     # We don't need the upper case variant,
691     # so stick to macros are uppercase convention.
692     # AC_DEFINE_UNQUOTED(package, ["${package}"])
693     # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
694     AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
695     AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
696     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
697
698     if test -z "$package_depth"; then
699         package_depth="."
700     else
701         package_depth="../$package_depth"
702     fi
703     export package_depth
704     AC_SUBST(package_depth)
705
706     AUTOGENERATE="This file was automatically generated by configure"
707     AC_SUBST(AUTOGENERATE)
708
709     CONFIGSUFFIX=
710     AC_ARG_ENABLE(config,
711     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
712                             do \`make conf=CONF' to get output in ./out-CONF],
713     [CONFIGURATION=$enableval])
714
715     ##'
716
717     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
718     CONFIGFILE=config$CONFIGSUFFIX
719     AC_SUBST(CONFIGSUFFIX)
720      
721     AC_CANONICAL_HOST
722     STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
723     STEPMAKE_PROGS(FIND, find, REQUIRED)
724
725     STEPMAKE_PROGS(TAR, tar, REQUIRED)
726
727     if test "$(echo 2)" != "2" ||
728         test "x`uname`" = "xHP-UX"; then
729         AC_PATH_PROG(KSH, ksh, /bin/ksh)
730         AC_PATH_PROG(BASH, bash, $KSH)
731         STEPMAKE_WARN(avoiding buggy /bin/sh)
732         AC_PATH_PROG(SHELL, bash, $KSH)
733     else
734         SHELL=/bin/sh
735         AC_PATH_PROG(BASH, bash, $SHELL)
736     fi
737     AC_SUBST(SHELL)
738
739     STEPMAKE_PYTHON(REQUIRED, 1.5)
740
741     if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
742         $MAKE -v 2> /dev/null | grep GNU > /dev/null
743         if test "$?" = 1; then
744             warn='make (Please install *GNU* make)'
745             # STEPMAKE_WARN($warn)
746             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
747         fi
748     fi
749
750     ROOTSEP=':'
751     DIRSEP='/'
752     PATHSEP=':'
753     LN=ln
754     LN_S='ln -s'
755     ZIP="zip -r -9"
756     INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
757
758     AC_SUBST(program_prefix)
759     AC_SUBST(program_suffix)
760     AC_SUBST(ZIP)
761     AC_SUBST(LN)
762     AC_SUBST(LN_S)
763     AC_SUBST(INSTALL)
764     AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
765     AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
766     AC_SUBST(DIRSEP)
767     AC_SUBST(PATHSEP)
768     AC_SUBST(ROOTSEP)
769   
770     STEPMAKE_DATADIR
771     STEPMAKE_LIBDIR
772 ])
773
774     
775 AC_DEFUN(STEPMAKE_KPATHSEA, [
776         
777     AC_ARG_WITH(kpathsea-include,
778         [  --with-kpathsea-include=DIR
779                           location of the kpathsea include dir],[
780             if test "$withval" = "yes" -o "$withval" = "no"; then
781                 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
782             else
783                 CPPFLAGS="$CPPFLAGS -I${withval}"
784             fi
785             ])
786     
787     AC_ARG_WITH(kpathsea-lib,
788         [  --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
789             if test "$withval" = "yes" -o "$withval" = "no"; then
790                 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
791             else
792                 LDFLAGS="$LDFLAGS -L${withval}"
793             fi
794             ])
795     
796     kpathsea_b=yes
797     #FIXME --with-xxx is meant for specifying a PATH too,
798     # so this should read: --enable-kpathsea,
799     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
800     AC_ARG_WITH(kpathsea,
801     [  --with-kpathsea         use kpathsea lib.  Default: on],
802     [kpathsea_b=$with_kpathsea])
803
804     save_LIBS="$LIBS"
805     if test "$kpathsea_b" != "no"; then 
806         AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
807         AC_CHECK_LIB(kpathsea, kpse_find_file)
808         AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
809         if test "$kpathsea_b" = "no"; then
810             STEPMAKE_ADD_ENTRY(OPTIONAL, $warn)
811         fi
812     fi
813
814     save_CFLAGS="$CFLAGS"
815     CFLAGS=$(echo "-shared $CFLAGS" | sed -e 's/ -g//')
816     AC_MSG_CHECKING([for shared libkpathsea])
817     AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
818                  [kpse_var_expand ("\$TEXMF");],
819                  [have_libkpathsea_so=maybe;
820                   shared_size=`wc -c conftest$ac_exeext`;
821                   shared_size=`echo $shared_size | sed -e 's/ .*//g'`],
822                  [have_libkpathsea_so=no])
823
824     if test "$have_libkpathsea_so" = "maybe"; then
825         if test "$shared_size" -lt 40000 ; then
826           have_libkpathsea_so=yes
827         else
828           have_libkpathsea_so=no
829         fi
830     fi
831     
832     AC_MSG_RESULT($have_libkpathsea_so)
833     if test "$have_libkpathsea_so" = "yes"; then
834         AC_DEFINE(HAVE_LIBKPATHSEA_SO)
835     fi
836     CFLAGS="$save_CFLAGS"
837
838     KPATHSEA_LIBS="$LIBS"
839     LIBS="$save_LIBS"
840     AC_MSG_CHECKING(whether to use kpathsea)
841     if test "$kpathsea_b" != no; then
842         AC_MSG_RESULT(yes)
843         KPATHSEA=1
844     else
845         AC_MSG_RESULT(no)
846         KPATHSEA=0
847     fi
848
849     AC_SUBST(KPATHSEA)
850     AC_SUBST(KPATHSEA_LIBS)
851     AC_SUBST(HAVE_LIBKPATHSEA_SO, $have_libkpathsea_so)
852     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
853 ])
854
855
856 AC_DEFUN(STEPMAKE_LIB, [
857     STEPMAKE_PROGS(AR, ar, $1)
858     AC_PROG_RANLIB
859     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
860 ])
861
862
863 AC_DEFUN(STEPMAKE_LIBTOOL, [
864     # libtool.info ...
865     # **Never** try to set library version numbers so that they correspond
866     # to the release number of your package.  This is an abuse that only
867     # fosters misunderstanding of the purpose of library versions.
868
869     REVISION=$PATCH_LEVEL
870     # CURRENT=$MINOR_VERSION
871     CURRENT=`expr $MINOR_VERSION + 1`
872     # AGE=`expr $MAJOR_VERSION + 1`
873     AGE=$MAJOR_VERSION
874     AC_SUBST(CURRENT)
875     AC_SUBST(REVISION)
876     AC_SUBST(AGE)
877 ])
878
879
880 AC_DEFUN(STEPMAKE_LOCALE, [
881     lang=English
882     ALL_LINGUAS="en nl"
883
884     # with/enable ??
885     AC_ARG_WITH(localedir,
886     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
887                             PREFIX/share/locale ],
888     localedir=$with_localedir,
889     localedir='${prefix}/share/locale')
890
891     AC_ARG_WITH(lang,
892     [  --with-lang=LANG        use LANG as language to emit messages],
893     language=$with_lang,
894     language=English)
895
896     AC_MSG_CHECKING(language)    
897     case "$language" in
898       En* | en* | Am* | am* | US* | us*)
899             lang=English;;
900       NL | nl | Du* | du* | Ned* | ned*)
901             lang=Dutch;;
902       "")
903             lang=English;;
904       *)
905             lang=unknown;;
906     esac
907     AC_MSG_RESULT($lang)
908
909     if test "$lang" = "unknown" ; then
910         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
911     fi
912
913 ])
914
915
916 AC_DEFUN(STEPMAKE_MAKEINFO, [
917     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
918 ])
919
920
921 AC_DEFUN(STEPMAKE_MAN, [
922     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
923     AC_SUBST(GROFF)
924     STEPMAKE_PROGS(TROFF, troff, $1)
925     AC_SUBST(TROFF)
926     STEPMAKE_PROGS(TBL, tbl, $1)
927     AC_SUBST(TBL)
928 ])
929
930
931 AC_DEFUN(STEPMAKE_MSGFMT, [
932     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
933 ])
934
935
936 # Check for program ($2), set full path result to ($1).
937 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
938 AC_DEFUN(STEPMAKE_PATH_PROG, [
939     AC_CHECK_PROGS($1, $2, no)
940     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
941     if test $? -eq 0; then
942         AC_PATH_PROG($1, $2)
943         if test -n "$4"; then
944             STEPMAKE_CHECK_VERSION($1, $3, $4)
945         fi
946     fi
947 ])
948
949
950 # Check for program in set of names ($2), set result to ($1) .
951 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
952 # If exists, and a minimal version ($4) is required
953 AC_DEFUN(STEPMAKE_PROGS, [
954     AC_CHECK_PROGS($1, $2, no)
955     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
956     if test $? -eq 0 -a -n "$4"; then
957         STEPMAKE_CHECK_VERSION($1, $3, $4)
958     fi
959 ])
960
961
962 AC_DEFUN(STEPMAKE_PERL, [
963     STEPMAKE_PATH_PROG(PERL, perl, $1)
964 ])
965
966
967 AC_DEFUN(STEPMAKE_PYTHON, [
968     unset pv
969     AC_MSG_CHECKING([for python])
970     for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
971         AC_MSG_RESULT([$python])
972         if ! $python -V > /dev/null 2>&1 ; then
973             #AC_MSG_WARN([cannot execute $python])
974             PYTHON='echo no python'
975         else
976             unset pv
977             STEPMAKE_CHECK_VERSION(python, pv, $2)
978             if test -z "$pv"; then
979                 PYTHON=$python
980                 break
981             fi
982         fi
983     done
984     if test -n "$pv"; then
985         STEPMAKE_ADD_ENTRY($1, $pv)
986     fi
987     AC_PATH_PROG(PYTHON, $PYTHON)
988     AC_SUBST(PYTHON)
989 ])
990
991 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
992     unset PYTHON_HEADER PYTHON_INCLUDE
993     if test -n "$PYTHON"; then
994         changequote(<<, >>)#dnl
995         # alternatively, for python >= 2.0
996         # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
997         PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
998         changequote([, ])#dnl
999     fi
1000     
1001     ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1002     if test -z "$PYTHON_HEADER"; then
1003         #URG -- how to extend include path?
1004         ac_compile="$ac_compile -I$PYTHON_INCLUDE"
1005         ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
1006         CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
1007         AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1008     fi
1009     
1010     if test -z "$PYTHON_HEADER"; then
1011         warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
1012         STEPMAKE_ADD_ENTRY($1, $warn)
1013     fi
1014 ])
1015
1016 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1017     # ugh
1018     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1019 ])
1020
1021 AC_DEFUN(STEPMAKE_TEXMF, [
1022     STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1023     # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1024
1025     AC_MSG_CHECKING(for working metafont mode)
1026     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1027     for MFMODE in $modelist; do
1028         $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1029         if test -f mfput.tfm; then
1030             break;
1031         fi
1032     done
1033     AC_MSG_RESULT($MFMODE)
1034
1035     rm -f mfput.*
1036
1037     AC_SUBST(MFMODE)
1038 ])
1039
1040
1041 AC_DEFUN(STEPMAKE_WARN, [
1042     AC_MSG_WARN($1)
1043     warn_b=yes
1044 ])
1045
1046
1047 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1048 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1049 dnl also defines GSTUFF_PKG_ERRORS on error
1050 AC_DEFUN(PKG_CHECK_MODULES, [
1051   succeeded=no
1052
1053   if test -z "$PKG_CONFIG"; then
1054     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1055   fi
1056
1057   if test "$PKG_CONFIG" = "no" ; then
1058      echo "*** The pkg-config script could not be found. Make sure it is"
1059      echo "*** in your path, or set the PKG_CONFIG environment variable"
1060      echo "*** to the full path to pkg-config."
1061      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1062   else
1063      PKG_CONFIG_MIN_VERSION=0.9.0
1064      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1065         AC_MSG_CHECKING(for $2)
1066
1067         if $PKG_CONFIG --exists "$2" ; then
1068             AC_MSG_RESULT(yes)
1069             succeeded=yes
1070
1071             AC_MSG_CHECKING($1_CFLAGS)
1072             $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1073             AC_MSG_RESULT($$1_CFLAGS)
1074
1075             AC_MSG_CHECKING($1_LIBS)
1076             $1_LIBS=`$PKG_CONFIG --libs "$2"`
1077             AC_MSG_RESULT($$1_LIBS)
1078         else
1079             $1_CFLAGS=""
1080             $1_LIBS=""
1081             ## If we have a custom action on failure, don't print errors, but 
1082             ## do set a variable so people can do so.
1083             $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1084             ifelse([$4], ,echo $$1_PKG_ERRORS,)
1085         fi
1086
1087         AC_SUBST($1_CFLAGS)
1088         AC_SUBST($1_LIBS)
1089      fi
1090   fi
1091
1092   if test $succeeded = yes; then
1093      ifelse([$3], , :, [$3])
1094   else
1095      ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
1096   fi
1097 ])
1098
1099 AC_DEFUN(STEPMAKE_FREETYPE2, [
1100     PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1101     if test "$have_freetype2" = yes; then
1102         AC_DEFINE(HAVE_FREETYPE2)
1103         save_CPPFLAGS="$CPPFLAGS"
1104         save_LIBS="$LIBS"
1105         CPPFLAGS="$FREETYPE2_CFLAGS $CPPFLAGS"
1106         LIBS="$FREETYPE2_LIBS $LIBS"
1107         AC_SUBST(FREETYPE2_CFLAGS)
1108         AC_SUBST(FREETYPE2_LIBS)
1109         CPPFLAGS="$save_CPPFLAGS"
1110         LIBS="$save_LIBS"
1111     else
1112         # UGR
1113         #r="lib$1-dev or $1-devel"
1114         r="libfreetype6-dev or freetype?-devel"
1115         ver="$(pkg-config --modversion $1)"
1116         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1117     fi
1118 ])
1119
1120 AC_DEFUN(STEPMAKE_GTK2, [
1121     PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1122     if test "$have_gtk2" = yes ; then
1123         AC_DEFINE(HAVE_GTK2)
1124         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1125         save_CPPFLAGS="$CPPFLAGS"
1126         save_LIBS="$LIBS"
1127         CPPFLAGS="$GTK2_CFLAGS $CPPFLAGS"
1128         LIBS="$GTK2_LIBS $LIBS"
1129         AC_SUBST(GTK2_CFLAGS)
1130         AC_SUBST(GTK2_LIBS)
1131         CPPFLAGS="$save_CPPFLAGS"
1132         LIBS="$save_LIBS"
1133     else
1134         # UGR
1135         # r="lib$1-dev or $1-devel"
1136         r="libgtk2.0-dev or gtk2-devel"
1137         ver="$(pkg-config --modversion $1)"
1138         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1139     fi
1140 ])
1141
1142 AC_DEFUN(STEPMAKE_PANGO, [
1143     PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1144     if test "$have_pango16" = yes ; then
1145         AC_DEFINE(HAVE_PANGO16)
1146         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1147         save_CPPFLAGS="$CPPFLAGS"
1148         save_LIBS="$LIBS"
1149         CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1150         LIBS="$PANGO_LIBS $LIBS"
1151         AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1152         AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1153         AC_SUBST(PANGO_CFLAGS)
1154         AC_SUBST(PANGO_LIBS)
1155         CPPFLAGS="$save_CPPFLAGS"
1156         LIBS="$save_LIBS"
1157     else
1158         # UGR
1159         #r="lib$1-dev or $1-devel"
1160         r="libpango1.0-dev or pango1.0-devel"
1161         ver="$(pkg-config --modversion $1)"
1162         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1163     fi
1164 ])
1165
1166 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1167     PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1168     if test "$have_pangoft2" = yes ; then
1169         AC_DEFINE(HAVE_PANGO16)
1170         AC_DEFINE(HAVE_PANGO_FT2)
1171         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1172         save_CPPFLAGS="$CPPFLAGS"
1173         save_LIBS="$LIBS"
1174         CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1175         LIBS="$PANGO_FT2_LIBS $LIBS"
1176         AC_CHECK_HEADERS([pango/pangoft2.h])
1177         AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1178         AC_SUBST(PANGO_FT2_CFLAGS)
1179         AC_SUBST(PANGO_FT2_LIBS)
1180         CPPFLAGS="$save_CPPFLAGS"
1181         LIBS="$save_LIBS"
1182     else
1183         # UGR
1184         #r="lib$1-dev or $1-devel"e
1185         r="libpango1.0-dev or pango?-devel"
1186         ver="$(pkg-config --modversion $1)"
1187         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1188     fi
1189 ])
1190
1191 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1192     PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1193     if test "$have_fontconfig" = yes ; then
1194         AC_DEFINE(HAVE_FONTCONFIG)
1195         # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1196         save_CPPFLAGS="$CPPFLAGS"
1197         save_LIBS="$LIBS"
1198         CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1199         LIBS="$FONTCONFIG_LIBS $LIBS"
1200         AC_SUBST(FONTCONFIG_CFLAGS)
1201         AC_SUBST(FONTCONFIG_LIBS)
1202         CPPFLAGS="$save_CPPFLAGS"
1203         LIBS="$save_LIBS"
1204     else
1205         r="lib$1-dev or $1-devel"
1206         ver="$(pkg-config --modversion $1)"
1207         STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1208     fi
1209 ])
1210
1211 AC_DEFUN(STEPMAKE_WINDOWS, [
1212     AC_CYGWIN
1213     AC_MINGW32
1214
1215     if test "$CYGWIN" == "yes"; then
1216         LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1217         program_suffix=.exe
1218         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1219     elif test "$MINGW32" == "yes"; then
1220         LN='cp -r'
1221         LN_S='cp -r'
1222         program_suffix=.exe
1223         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1224         PATHSEP=';'
1225     fi
1226
1227     AC_SUBST(LN)
1228     AC_SUBST(LN_S)
1229     AC_SUBST(INSTALL)
1230     AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1231     AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1232     AC_SUBST(DIRSEP)
1233     AC_SUBST(PATHSEP)
1234     AC_SUBST(program_suffix)
1235
1236     AC_MSG_CHECKING([for some flavor of Windows])
1237     if test "$CYGWIN$MINGW32" == "nono"; then
1238         PLATFORM_WINDOWS=no
1239     else
1240         PLATFORM_WINDOWS=yes
1241     fi
1242     AC_MSG_RESULT([$PLATFORM_WINDOWS])
1243     AC_SUBST(PLATFORM_WINDOWS)
1244     STEPMAKE_PROGS(WINDRES, $target-windres windres, x)
1245     AC_SUBST(WINDRES)
1246 ])