1 dnl aclocal.m4 -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
5 ### mostly interal macros
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}'
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}'
23 ## Workaround for broken Debian gcc version string:
24 ## gcc (GCC) 3.1.1 20020606 (Debian prerelease)
26 ## -V: Workaround for python
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]' \
35 | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
36 -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
38 ## apparently breaks on darwin,
39 # | sed -e 's/\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
40 # -e 's/\([^0-9]*\|^\) //' -e 's/[^0-9]*$//'\`\"
41 if test -z "$_ver"; then
42 ## If empty, try date [fontforge]
43 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
45 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
51 # Calculate simplistic numeric version from version string ($1)
52 # As yet, we have no need for something more elaborate.
53 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
56 if ([$]3) {three = [$]3}
59 {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
63 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
64 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
65 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
68 # Check if tested program ($2) was found ($1).
69 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
70 # We could abort here if a 'REQUIRED' program is not found
71 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
72 STEPMAKE_CHECK_SEARCH_RESULT($1)
73 if test $? -ne 0; then
74 STEPMAKE_ADD_ENTRY($3, $2)
75 if test "$3" = "REQUIRED"; then
76 command="echo ERROR: $2 not found"
77 # abort configure process here?
79 command="- echo $2 not found"
89 # Return if tested proram ($1) was found (true) or not (false).
90 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
91 r="`eval echo '$'"$1"`"
92 if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
95 ##STEPMAKE_WARN(cannot find $2. $3)
101 # Check version of program ($1)
102 # If version ($4: optional argument, supply if version cannot be
103 # parsed using --version or -V ) is smaller than requested ($3), add
104 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
105 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
106 r="`eval echo '$'"$1"`"
107 AC_MSG_CHECKING([$r version])
108 exe=`STEPMAKE_GET_EXECUTABLE($r)`
109 if test -n "$4"; then
112 ver=`STEPMAKE_GET_VERSION($exe)`
114 num=`STEPMAKE_NUMERIC_VERSION($ver)`
115 req=`STEPMAKE_NUMERIC_VERSION($3)`
116 AC_MSG_RESULT([$ver])
117 if test "$num" -lt "$req"; then
118 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
120 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
121 eval `echo $vervar=$num`
122 ## AC_SUBST(`eval echo $vervar`)
125 # Check version of program ($1)
126 # If version is greater than or equals unsupported ($3),
127 # add entry to unsupported list ($2, 'UNSUPPORTED')
128 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
129 r="`eval echo '$'"$1"`"
130 AC_MSG_CHECKING([$r version])
131 exe=`STEPMAKE_GET_EXECUTABLE($r)`
132 ver=`STEPMAKE_GET_VERSION($exe)`
133 num=`STEPMAKE_NUMERIC_VERSION($ver)`
134 sup=`STEPMAKE_NUMERIC_VERSION($3)`
135 AC_MSG_RESULT([$ver])
136 if test "$num" -ge "$sup"; then
137 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
141 ### Macros to build configure.in
144 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
145 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
146 if test "$BIBTEX2HTML" = "bib2html"; then
147 BIBTEX2HTML_FLAGS='$< $(@)'
149 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
151 AC_SUBST(BIBTEX2HTML)
152 AC_SUBST(BIBTEX2HTML_FLAGS)
156 AC_DEFUN(STEPMAKE_BISON, [
157 # ugh, automake: we want (and check for) bison
160 STEPMAKE_PROGS(BISON, bison, $1)
162 # urg. should test functionality rather than version.
163 if test "$BISON" = "bison" -a -n "$2"; then
164 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
169 AC_DEFUN(STEPMAKE_COMPILE, [
170 # -O is necessary to get inlining
172 CXXFLAGS=${CXXFLAGS-$CFLAGS}
173 LDFLAGS=${LDFLAGS-""}
179 AC_ARG_ENABLE(debugging,
180 [ --enable-debugging compile with debugging info. Default: on],
181 [debug_b=$enableval])
183 AC_ARG_ENABLE(optimising,
184 [ --enable-optimising compile with optimising. Default: on],
185 [optimise_b=$enableval])
187 AC_ARG_ENABLE(profiling,
188 [ --enable-profiling compile with gprof support. Default: off],
189 [profile_b=$enableval])
192 [ --enable-pipe compile with -pipe. Default: on],
195 if test "$optimise_b" = yes; then
197 DEFINES="$DEFINES -DNDEBUG"
198 OPTIMIZE=" -O2 -finline-functions"
201 if test $profile_b = yes; then
203 OPTIMIZE="$OPTIMIZE -pg"
206 if test $debug_b = yes; then
207 OPTIMIZE="$OPTIMIZE -g"
211 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
215 # If -pipe requested, test if it works and add to CFLAGS.
216 if test "$pipe_b" = yes; then
217 save_cflags="$CFLAGS"
218 CFLAGS=" -pipe $CFLAGS";
219 AC_CACHE_CHECK([whether compiler understands -pipe],
220 [stepmake_cflags_pipe],
221 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
222 [stepmake_cflags_pipe=yes],
223 [stepmake_cflags_pipe=no]))
225 if test $stepmake_cflags_pipe = yes; then
226 OPTIMIZE="$OPTIMIZE -pipe"
230 CFLAGS="$CFLAGS $OPTIMIZE"
231 CPPFLAGS=${CPPFLAGS-""}
233 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
234 save_cflags="$CFLAGS"
237 dnl should do compile test?
238 AC_MSG_RESULT(-mieee)
239 CFLAGS=" -mieee $CFLAGS"
242 AC_MSG_RESULT([none])
246 AC_SUBST(cross_compiling)
254 AC_DEFUN(STEPMAKE_CXX, [
257 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
259 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
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)
281 AC_DEFUN(STEPMAKE_DATADIR, [
282 if test "$datadir" = "\${prefix}/share"; then
283 datadir='${prefix}/share'
286 if test "$prefix" = "NONE"; then
287 presome=${ac_default_prefix}
290 build_package_datadir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/share/$package
292 DATADIR=`echo ${datadir} | sed "s!\\\${datarootdir}!${prefix}/share!"`
293 DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
294 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
297 AC_SUBST(datarootdir)
298 AC_SUBST(build_package_datadir)
299 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
300 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
303 ## ugh: cut & paste programming from datadir.
304 AC_DEFUN(STEPMAKE_LIBDIR, [
306 if test "$libdir" = "\${exec_prefix}/lib"; then
307 libdir='${exec_prefix}/lib'
310 build_package_libdir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/lib/$package
312 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
313 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
316 AC_SUBST(build_package_libdir)
317 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
318 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
322 AC_DEFUN(STEPMAKE_END, [
326 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
329 if test -n "$OPTIONAL"; then
331 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
334 if test -n "$REQUIRED"; then
336 echo "ERROR: Please install required programs: $REQUIRED"
339 if test -n "$UNSUPPORTED"; then
341 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
344 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
346 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
347 if test -f config.cache ; then
348 echo "Remove config.cache before rerunning ./configure"
352 if test -n "$REQUIRED$UNSUPPORTED"; then
353 rm -f $srcdir/GNUmakefile
357 # regular in-place build
358 # test for srcdir_build = yes ?
359 if test "$srcdir_build" = "yes"; then
360 rm -f $srcdir/GNUmakefile
361 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
362 chmod 444 $srcdir/GNUmakefile
364 if test -f $srcdir/GNUmakefile; then
366 Source directory already configured. Please clean the source directory
368 make -C $srcdir distclean
376 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name GNUmakefile`; do
377 mkdir -p $(dirname $mf)
378 cat <<EOF | $PYTHON - > $mf
379 print 'depth=' + ('../' * ( $d-1 ) )
380 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
381 print 'include \$(configure-srcdir)/$mf'
384 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name '*.make' | grep -v config.make `; do
385 mkdir -p $(dirname $mf)
386 cat <<EOF | $PYTHON - > $mf
387 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
388 print 'include \$(configure-srcdir)/$mf'
394 cat <<EOF > GNUmakefile
396 include config\$(if \$(conf),-\$(conf),).make
397 include \$(configure-srcdir)/GNUmakefile.in
404 AC_DEFUN(STEPMAKE_FLEX, [
405 # ugh, automake: we want (and check for) flex
407 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
411 ac_cv_prog_lex_root=lex.yy
412 STEPMAKE_PROGS(FLEX, flex, $1)
416 AC_DEFUN(STEPMAKE_FLEXLEXER, [
417 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
418 if test $? -ne 0; then
419 warn='FlexLexer.h (flex package)'
420 STEPMAKE_ADD_ENTRY($1, $warn)
422 # check for yyFlexLexer.yy_current_buffer,
423 # in 2.5.4 <= flex < 2.5.29
425 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
426 [stepmake_flexlexer_yy_current_buffer],
427 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
429 #include <FlexLexer.h>
430 class yy_flex_lexer: public yyFlexLexer
435 yy_current_buffer = 0;
439 [stepmake_flexlexer_yy_current_buffer=yes],
440 [stepmake_flexlexer_yy_current_buffer=no]))
441 if test $stepmake_flexlexer_yy_current_buffer = yes; then
442 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
449 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
450 AC_MSG_CHECKING([FlexLexer.h location])
453 cat <<EOF > conftest.cc
455 #include <FlexLexer.h>
457 FLEXLEXER_FILE=`$CXX -E conftest.cc | \
458 sed 's!# 1 "\(.*FlexLexer.h\)"!@FLEXLEXER@\1@@!g' | grep '@@' | \
459 sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` 1> /dev/null 2> /dev/null
461 AC_SUBST(FLEXLEXER_FILE)
462 AC_MSG_RESULT($FLEXLEXER_FILE)
465 AC_DEFUN(STEPMAKE_GCC, [
466 if test "$GCC" = "yes"; then
467 STEPMAKE_CHECK_VERSION(CC, $1, $2)
469 warn="$CC (Please install *GNU* cc)"
470 STEPMAKE_ADD_ENTRY($1, $warn)
474 AC_DEFUN(STEPMAKE_GETTEXT, [
476 if test "$prefix" = "NONE"; then
477 presome=${ac_default_prefix}
479 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
482 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
483 # ouch. autoconf <= 2.57's gettext check fails for
484 # g++ >= 3.3 (with -std=gnu++98, the default).
485 # While the check is OK for g++ -std=c++98,
486 # LilyPond needs GNU g++, so who is to blame here?
487 # Use a workaround until this is resolved:
488 # for g++ >= 3.3, select C language.
490 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
491 if test -n "$GCC_UNSUPPORTED"; then
492 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
493 AC_MSG_WARN([Trying gcc, cross fingers.])
496 AC_CHECK_LIB(intl, gettext)
497 AC_CHECK_FUNCS(gettext)
498 if test -n "$GCC_UNSUPPORTED"; then
504 AC_DEFUN(STEPMAKE_GUILE, [
505 STEPMAKE_PATH_PROG(GUILE, guile, $1)
509 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
511 # This macro runs the guile-config script, installed with Guile,
512 # to find out where Guile's header files and libraries are
513 # installed. It sets two variables, marked for substitution, as
516 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
517 # code that uses Guile header files. This is almost
518 # always just a -I flag.
520 # GUILE_LDFLAGS --- flags to pass to the linker to link a
521 # program against Guile. This includes -lguile for
522 # the Guile library itself, any libraries that Guile
523 # itself requires (like -lqthreads), and so on. It may
524 # also include a -L flag to tell the compiler where to
525 # find the libraries.
527 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
528 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
529 if test -x $exe; then
530 AC_MSG_CHECKING([guile compile flags])
531 GUILE_CFLAGS="`$guile_config compile`"
532 AC_MSG_RESULT($GUILE_CFLAGS)
533 AC_MSG_CHECKING([guile link flags])
534 GUILE_LDFLAGS="`$guile_config link`"
535 AC_MSG_RESULT($GUILE_LDFLAGS)
537 AC_SUBST(GUILE_CFLAGS)
538 AC_SUBST(GUILE_LDFLAGS)
542 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
543 ## First, let's just see if we can find Guile at all.
544 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
545 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
546 AC_MSG_CHECKING([for guile-config])
547 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
548 AC_MSG_RESULT([$guile_config])
549 if ! $guile_config --version > /dev/null 2>&1 ; then
550 AC_MSG_WARN([cannot execute $guile_config])
551 AC_MSG_CHECKING([if we are cross compiling])
552 GUILE_CONFIG='echo no guile-config'
554 GUILE_CONFIG=$guile_config
558 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
559 if test $? -ne 0; then
560 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
563 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
564 # urg. should test functionality rather than version.
565 if test $? -eq 0 -a -n "$2"; then
566 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
569 AC_SUBST(GUILE_CONFIG)
572 changequote(<<, >>)#dnl
573 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
574 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
575 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
576 changequote([, ])#dnl
578 save_CPPFLAGS="$CPPFLAGS"
580 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
581 LIBS="$GUILE_LDFLAGS $LIBS"
582 AC_CHECK_HEADERS([libguile.h])
583 AC_CHECK_LIB(guile, scm_boot_guile)
584 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
585 if test "$libguile_b" = "no"; then
586 warn='libguile (libguile-dev, guile-devel or guile-dev
588 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
590 CPPFLAGS="$save_CPPFLAGS"
592 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
593 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
594 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
598 AC_DEFUN(STEPMAKE_DLOPEN, [
599 AC_CHECK_LIB(dl, dlopen)
600 AC_CHECK_FUNCS(dlopen)
603 AC_DEFUN(STEPMAKE_GXX, [
604 if test "$GXX" = "yes"; then
605 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
607 warn="$CXX (Please install *GNU* c++)"
608 STEPMAKE_ADD_ENTRY($1, $warn)
613 AC_DEFUN(STEPMAKE_INIT, [
617 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
618 MICRO_VERSION=$PATCH_LEVEL
619 TOPLEVEL_VERSION=$FULL_VERSION
620 if test x$MY_PATCH_LEVEL != x; then
621 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
623 VERSION=$FULL_VERSION
624 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
625 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
626 changequote(<<, >>)#dnl
627 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
628 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
629 changequote([, ])#dnl
631 # No versioning on directory names of sub-packages
633 stepmake=${datadir}/stepmake
635 if test "$prefix" = "NONE"; then
636 presome=${ac_default_prefix}
638 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
640 # urg, how is this supposed to work?
641 if test "$program_prefix" = "NONE"; then
644 if test "$program_suffix" = "NONE"; then
648 AC_MSG_CHECKING(Package)
649 if test "$PACKAGE" = "STEPMAKE"; then
650 AC_MSG_RESULT(Stepmake package!)
652 AC_MSG_CHECKING(builddir)
654 ugh_ugh_autoconf250_builddir="`pwd`"
656 if test "$srcdir" = "."; then
660 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
661 package_srcdir="`dirname $srcdir`"
663 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
665 (cd stepmake 2>/dev/null || mkdir stepmake)
666 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
669 AC_MSG_RESULT($PACKAGE)
671 AC_MSG_CHECKING(builddir)
672 ugh_ugh_autoconf250_builddir="`pwd`"
673 if test "$srcdir" = "."; then
678 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
680 AC_MSG_CHECKING(for stepmake)
681 # Check for installed stepmake
682 if test -d $stepmake; then
683 AC_MSG_RESULT($stepmake)
685 stepmake="`cd $srcdir/stepmake; pwd`"
686 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
690 AC_SUBST(ugh_ugh_autoconf250_builddir)
692 # Use absolute directory for non-srcdir builds, so that build
694 if test "$srcdir_build" = "no" ; then
695 srcdir="`cd $srcdir; pwd`"
702 AC_SUBST(PACKAGE_NAME)
704 AC_SUBST(MAJOR_VERSION)
705 AC_SUBST(MINOR_VERSION)
706 AC_SUBST(MICRO_VERSION)
708 # stepmake nonstandard names
709 AC_SUBST(PATCH_LEVEL)
710 AC_SUBST(TOPLEVEL_VERSION)
712 # We don't need the upper case variant,
713 # so stick to macros are uppercase convention.
714 # AC_DEFINE_UNQUOTED(package, ["${package}"])
715 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
716 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
717 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
718 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
720 if test -z "$package_depth"; then
723 package_depth="../$package_depth"
726 AC_SUBST(package_depth)
728 AUTOGENERATE="This file was automatically generated by configure"
729 AC_SUBST(AUTOGENERATE)
732 AC_ARG_ENABLE(config,
733 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
734 do `make conf=CONF' to get output in ./out-CONF],
735 [CONFIGURATION=$enableval])
739 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
740 CONFIGFILE=config$CONFIGSUFFIX
741 AC_SUBST(CONFIGSUFFIX)
744 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
745 STEPMAKE_PROGS(FIND, find, REQUIRED)
747 STEPMAKE_PROGS(TAR, tar, REQUIRED)
749 if test "$(echo 2)" != "2" ||
750 test "x`uname`" = "xHP-UX"; then
751 AC_PATH_PROG(KSH, ksh, /bin/ksh)
752 AC_PATH_PROG(BASH, bash, $KSH)
753 STEPMAKE_WARN(avoiding buggy /bin/sh)
754 AC_PATH_PROG(SHELL, bash, $KSH)
757 AC_PATH_PROG(BASH, bash, $SHELL)
761 STEPMAKE_PYTHON(REQUIRED, 1.5)
763 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
764 $MAKE -v 2> /dev/null | grep GNU > /dev/null
765 if test "$?" = 1; then
766 warn='make (Please install *GNU* make)'
767 # STEPMAKE_WARN($warn)
768 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
779 AC_SUBST(program_prefix)
780 AC_SUBST(program_suffix)
784 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
785 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
795 AC_DEFUN(STEPMAKE_KPATHSEA, [
797 AC_ARG_WITH(kpathsea-include,
798 [ --with-kpathsea-include=DIR
799 location of the kpathsea include dir],[
800 if test "$withval" = "yes" -o "$withval" = "no"; then
801 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
803 CPPFLAGS="$CPPFLAGS -I${withval}"
807 AC_ARG_WITH(kpathsea-lib,
808 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
809 if test "$withval" = "yes" -o "$withval" = "no"; then
810 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
812 LDFLAGS="$LDFLAGS -L${withval}"
817 AC_ARG_ENABLE(kpathsea,
818 [ --enable-kpathsea use kpathsea lib. Default: on],
819 [kpathsea_b=$enableval])
822 if test "$kpathsea_b" != "no"; then
823 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
824 AC_CHECK_LIB(kpathsea, kpse_find_file)
825 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
826 if test "$kpathsea_b" = "no"; then
827 STEPMAKE_ADD_ENTRY(OPTIONAL, $warn)
831 save_CFLAGS="$CFLAGS"
832 CFLAGS=`echo "-shared $CFLAGS" | sed -e 's/ -g//'`
833 AC_MSG_CHECKING([for shared libkpathsea])
834 AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
835 [kpse_var_expand ("\$TEXMF");],
836 [have_libkpathsea_so=maybe;
837 shared_size=`wc -c conftest$ac_exeext`;
838 shared_size=`echo $shared_size | sed -e 's/ .*//g'`],
839 [have_libkpathsea_so=no])
841 if test "$have_libkpathsea_so" = "maybe"; then
842 if test "$shared_size" -lt 40000 ; then
843 have_libkpathsea_so=yes
845 have_libkpathsea_so=no
849 AC_MSG_RESULT($have_libkpathsea_so)
850 if test "$have_libkpathsea_so" = "yes"; then
851 AC_DEFINE(HAVE_LIBKPATHSEA_SO)
853 CFLAGS="$save_CFLAGS"
855 KPATHSEA_LIBS="$LIBS"
857 AC_MSG_CHECKING(whether to use kpathsea)
858 if test "$kpathsea_b" != no; then
867 AC_SUBST(KPATHSEA_LIBS)
868 AC_SUBST(HAVE_LIBKPATHSEA_SO, $have_libkpathsea_so)
869 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
873 AC_DEFUN(STEPMAKE_LIB, [
874 STEPMAKE_PROGS(AR, ar, $1)
876 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
880 AC_DEFUN(STEPMAKE_LIBTOOL, [
882 # **Never** try to set library version numbers so that they correspond
883 # to the release number of your package. This is an abuse that only
884 # fosters misunderstanding of the purpose of library versions.
886 REVISION=$PATCH_LEVEL
887 # CURRENT=$MINOR_VERSION
888 CURRENT=`expr $MINOR_VERSION + 1`
889 # AGE=`expr $MAJOR_VERSION + 1`
897 AC_DEFUN(STEPMAKE_LOCALE, [
902 AC_ARG_WITH(localedir,
903 [ --with-localedir=DIR location of locales. Default: PREFIX/share/locale ],
904 localedir=$with_localedir,
905 localedir='${prefix}/share/locale')
908 [ --with-lang=LANG use LANG as language to emit messages],
912 AC_MSG_CHECKING(language)
914 En* | en* | Am* | am* | US* | us*)
916 NL | nl | Du* | du* | Ned* | ned*)
925 if test "$lang" = "unknown" ; then
926 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
932 AC_DEFUN(STEPMAKE_MAKEINFO, [
933 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
937 AC_DEFUN(STEPMAKE_MAN, [
938 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
940 STEPMAKE_PROGS(TROFF, troff, $1)
942 STEPMAKE_PROGS(TBL, tbl, $1)
947 AC_DEFUN(STEPMAKE_MSGFMT, [
948 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
952 # Check for program ($2), set full path result to ($1).
953 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
954 AC_DEFUN(STEPMAKE_PATH_PROG, [
955 AC_CHECK_PROGS($1, $2, no)
956 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
957 if test $? -eq 0; then
959 if test -n "$4"; then
960 STEPMAKE_CHECK_VERSION($1, $3, $4)
966 # Check for program in set of names ($2), set result to ($1) .
967 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
968 # If exists, and a minimal version ($4) is required
969 AC_DEFUN(STEPMAKE_PROGS, [
970 AC_CHECK_PROGS($1, $2, no)
971 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
972 if test $? -eq 0 -a -n "$4"; then
973 STEPMAKE_CHECK_VERSION($1, $3, $4)
978 AC_DEFUN(STEPMAKE_PERL, [
979 STEPMAKE_PATH_PROG(PERL, perl, $1)
983 AC_DEFUN(STEPMAKE_PYTHON, [
985 AC_MSG_CHECKING([for python])
986 for python in $PYTHON python python2 python2.4 python2.3 python2.2 python2.1 python2.0; do
987 AC_MSG_RESULT([$python])
988 if ! $python -V > /dev/null 2>&1 ; then
989 #AC_MSG_WARN([cannot execute $python])
990 PYTHON='echo no python'
993 STEPMAKE_CHECK_VERSION(python, pv, $2)
994 if test -z "$pv"; then
1000 if test -n "$pv"; then
1001 STEPMAKE_ADD_ENTRY($1, $pv)
1003 # clear cached value since arg 2 might point us to a new binary
1004 unset ac_cv_path_PYTHON
1006 AC_PATH_PROG(PYTHON, $PYTHON)
1010 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
1011 AC_ARG_WITH(python-include,
1012 [ --with-python-include=DIR
1013 location of the python include dir],[
1014 if test "$withval" = "yes" -o "$withval" = "no"; then
1015 AC_MSG_WARN(Usage: --with-python-include=includedir)
1017 PYTHON_CFLAGS="-I${withval}"
1021 AC_ARG_WITH(python-lib,
1022 [ --with-python-lib=NAME name of the python lib],[
1023 if test "$withval" = "yes" -o "$withval" = "no"; then
1024 AC_MSG_WARN(Usage: --with-python-lib=name)
1026 LDFLAGS="$LDFLAGS -l${withval}"
1030 if test "$cross_compiling" = "no" -a -z "$PYTHON_CFLAGS"; then
1031 changequote(<<, >>)#dnl
1032 # alternatively, for python >= 2.0
1033 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
1034 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
1035 PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
1036 changequote([, ])#dnl
1039 if test "$cross_compiling" = "yes" -a -z "$PYTHON_CFLAGS"; then
1040 PYTHON_CFLAGS=`python-config --cflags`
1041 PYTHON_LDFLAGS=`python-config --ldflags`
1044 if test -z "$PYTHON_HEADER"; then
1045 CPPFLAGS="$PYTHON_CFLAGS $CPPFLAGS"
1046 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1049 if test -z "$PYTHON_HEADER"; then
1050 warn="Python.h (python-devel, python-dev or libpython-dev package)"
1051 STEPMAKE_ADD_ENTRY($1, $warn)
1057 AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [
1059 AC_CACHE_CHECK([for stl.data () method],
1060 [stepmake_stl_data_method],
1061 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1063 using namespace std;
1065 void *p = v.data ();
1067 [stepmake_stl_data_method=yes],
1068 [stepmake_stl_data_method=no]))
1069 if test $stepmake_stl_data_method = yes; then
1070 AC_DEFINE(HAVE_STL_DATA_METHOD, 1, [define if stl classes have data () method])
1076 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1078 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1081 AC_DEFUN(STEPMAKE_TEXMF, [
1082 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1083 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1085 AC_MSG_CHECKING(for working metafont mode)
1086 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1087 for MFMODE in $modelist; do
1088 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1089 if test -f mfput.tfm; then
1093 AC_MSG_RESULT($MFMODE)
1101 AC_DEFUN(STEPMAKE_WARN, [
1107 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1108 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1109 dnl also defines GSTUFF_PKG_ERRORS on error
1110 AC_DEFUN(PKG_CHECK_MODULES, [
1113 if test -z "$PKG_CONFIG"; then
1114 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1117 if test "$PKG_CONFIG" = "no" ; then
1118 echo "*** The pkg-config script could not be found. Make sure it is"
1119 echo "*** in your path, or set the PKG_CONFIG environment variable"
1120 echo "*** to the full path to pkg-config."
1121 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1123 PKG_CONFIG_MIN_VERSION=0.9.0
1124 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1125 AC_MSG_CHECKING(for $2)
1127 if $PKG_CONFIG --exists "$2" ; then
1131 AC_MSG_CHECKING($1_CFLAGS)
1132 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1133 AC_MSG_RESULT($$1_CFLAGS)
1135 AC_MSG_CHECKING($1_LIBS)
1136 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1137 AC_MSG_RESULT($$1_LIBS)
1141 ## If we have a custom action on failure, don't print errors, but
1142 ## do set a variable so people can do so.
1143 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1144 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1152 if test $succeeded = yes; then
1153 ifelse([$3], , :, [$3])
1155 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])
1159 AC_DEFUN(STEPMAKE_FREETYPE2, [
1160 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1161 if test "$have_freetype2" = yes; then
1162 AC_DEFINE(HAVE_FREETYPE2)
1163 save_CPPFLAGS="$CPPFLAGS"
1165 CPPFLAGS="$FREETYPE2_CFLAGS $CPPFLAGS"
1166 LIBS="$FREETYPE2_LIBS $LIBS"
1167 AC_SUBST(FREETYPE2_CFLAGS)
1168 AC_SUBST(FREETYPE2_LIBS)
1169 CPPFLAGS="$save_CPPFLAGS"
1173 #r="lib$1-dev or $1-devel"
1174 r="libfreetype6-dev or freetype?-devel"
1175 ver="`pkg-config --modversion $1`"
1176 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1180 AC_DEFUN(STEPMAKE_GTK2, [
1181 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1182 if test "$have_gtk2" = yes ; then
1183 AC_DEFINE(HAVE_GTK2)
1184 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1185 save_CPPFLAGS="$CPPFLAGS"
1187 CPPFLAGS="$GTK2_CFLAGS $CPPFLAGS"
1188 LIBS="$GTK2_LIBS $LIBS"
1189 AC_SUBST(GTK2_CFLAGS)
1191 CPPFLAGS="$save_CPPFLAGS"
1195 # r="lib$1-dev or $1-devel"
1196 r="libgtk2.0-dev or gtk2-devel"
1197 ver="`pkg-config --modversion $1`"
1198 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1202 AC_DEFUN(STEPMAKE_PANGO, [
1203 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1204 if test "$have_pango16" = yes ; then
1205 AC_DEFINE(HAVE_PANGO16)
1206 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1207 save_CPPFLAGS="$CPPFLAGS"
1209 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1210 LIBS="$PANGO_LIBS $LIBS"
1211 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1212 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1213 AC_SUBST(PANGO_CFLAGS)
1214 AC_SUBST(PANGO_LIBS)
1215 CPPFLAGS="$save_CPPFLAGS"
1219 #r="lib$1-dev or $1-devel"
1220 r="libpango1.0-dev or pango1.0-devel"
1221 ver="`pkg-config --modversion $1`"
1222 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1226 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1227 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1228 if test "$have_pangoft2" = yes ; then
1229 AC_DEFINE(HAVE_PANGO16)
1230 AC_DEFINE(HAVE_PANGO_FT2)
1231 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1232 save_CPPFLAGS="$CPPFLAGS"
1234 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1235 LIBS="$PANGO_FT2_LIBS $LIBS"
1236 AC_CHECK_HEADERS([pango/pangoft2.h])
1237 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1238 AC_SUBST(PANGO_FT2_CFLAGS)
1239 AC_SUBST(PANGO_FT2_LIBS)
1240 CPPFLAGS="$save_CPPFLAGS"
1244 #r="lib$1-dev or $1-devel"e
1245 r="libpango1.0-dev or pango?-devel"
1246 ver="`pkg-config --modversion $1`"
1247 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1251 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1252 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1253 if test "$have_fontconfig" = yes ; then
1254 AC_DEFINE(HAVE_FONTCONFIG)
1255 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1256 save_CPPFLAGS="$CPPFLAGS"
1258 CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1259 LIBS="$FONTCONFIG_LIBS $LIBS"
1260 AC_SUBST(FONTCONFIG_CFLAGS)
1261 AC_SUBST(FONTCONFIG_LIBS)
1262 CPPFLAGS="$save_CPPFLAGS"
1265 r="lib$1-dev or $1-devel"
1266 ver="`pkg-config --modversion $1`"
1267 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1271 AC_DEFUN(STEPMAKE_WINDOWS, [
1275 if test "$CYGWIN" = "yes"; then
1276 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1278 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1279 elif test "$MINGW32" = "yes"; then
1283 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1289 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1290 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1293 AC_SUBST(program_suffix)
1295 AC_MSG_CHECKING([for some flavor of Windows])
1296 if test "$CYGWIN$MINGW32" = "nono"; then
1299 PLATFORM_WINDOWS=yes
1301 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1302 AC_SUBST(PLATFORM_WINDOWS)
1303 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)