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