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