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