1 dnl aclocal.m4 -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
4 AC_DEFUN(AC_STEPMAKE_BIBTEX2HTML, [
5 AC_CHECK_PROGS(BIBTEX2HTML, bibtex2html bib2html, error)
6 if test "$BIBTEX2HTML" = "bib2html"; then
7 BIBTEX2HTML_FLAGS='$< $(@)'
9 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
12 AC_SUBST(BIBTEX2HTML_FLAGS)
16 AC_DEFUN(AC_STEPMAKE_COMPILE, [
17 # -O is necessary to get inlining
19 CXXFLAGS=${CXXFLAGS:-$CFLAGS}
20 LDFLAGS=${LDFLAGS:-""}
26 AC_ARG_ENABLE(checking,
27 [ --enable-checking set runtime checks (assert calls). Default: on],
28 [checking_b=$enableval] )
30 AC_ARG_ENABLE(debugging,
31 [ --enable-debugging compile with debugging info. Default: on],
34 AC_ARG_ENABLE(profiling,
35 [ --enable-profiling compile with gprof support. Default: off],
36 [profile_b=$enableval])
39 if test "$checking_b" = no; then
42 DEFINES="$DEFINES -DNDEBUG"
45 if test "$optimise_b" = yes; then
46 OPTIMIZE="-O2 -finline-functions"
50 if test $profile_b = yes; then
52 OPTIMIZE="$OPTIMIZE -pg"
55 if test $debug_b = yes; then
56 OPTIMIZE="$OPTIMIZE -g"
64 CFLAGS="$CFLAGS $OPTIMIZE"
65 CPPFLAGS=${CPPFLAGS:-""}
66 AC_SUBST(cross_compiling)
76 AC_DEFUN(AC_STEPMAKE_CXX, [
80 AC_CHECK_HEADER(FlexLexer.h, true,
81 AC_STEPMAKE_WARN(can"\'"t find flex header. Please install Flex headers correctly))
83 CPPFLAGS="$CPPFLAGS $DEFINES"
84 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
85 LDFLAGS="$LDFLAGS $EXTRA_LIBES"
93 AC_DEFUN(AC_STEPMAKE_CXXTEMPLATE, [
94 AC_CACHE_CHECK([whether explicit instantiation is needed],
95 lily_cv_need_explicit_instantiation,
97 template <class T> struct foo { static int baz; };
98 template <class T> int foo<T>::baz = 1;
99 ], [ return foo<int>::baz; ],
100 lily_cv_need_explicit_instantiation=no,
101 lily_cv_need_explicit_instantiation=yes))
102 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
103 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
107 AC_DEFUN(AC_STEPMAKE_DATADIR, [
108 if test "$datadir" = "\${prefix}/share"; then
109 datadir='${prefix}/share/'$package
111 DIR_DATADIR=${datadir}
113 if test "$prefix" = "NONE"; then
114 presome=${ac_default_prefix}
116 DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
119 AC_SUBST(DIR_DATADIR)
121 dnl yeah, so fuck me gently with a cactus: this doesnt belong here
122 dnl Please take the person responsible for inventing shell-scripts out
123 dnl and shoot him. On behalf of the sane world, thank you.
124 dnl DIR_SHAREDSTATEDIR="foobar"
125 dnl AC_SUBST(DIR_SHAREDSTATEDIR)
127 AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
130 AC_DEFUN(AC_STEPMAKE_END, [
131 AC_OUTPUT($CONFIGFILE.make:config.make.in)
133 # regular in-place build
134 # test for srcdir_build = yes ?
135 if test "$builddir" = "."; then
136 rm -f $srcdir/GNUmakefile
137 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
138 chmod 444 $srcdir/GNUmakefile
139 else # --srcdir build
141 cp $srcdir/make/srcdir.make.in GNUmakefile
142 chmod 444 GNUmakefile
146 AC_DEFUN(AC_STEPMAKE_GXX, [
148 # urg, egcs: how to check for egcs >= 1.1?
149 changequote(<<, >>)dnl
150 if $CXX --version | egrep '2\.[89]' > /dev/null ||
151 $CXX --version | grep 'egcs' > /dev/null
156 AC_STEPMAKE_WARN(can\'t find g++ 2.8, 2.9 or egcs 1.1)
160 AC_DEFUN(AC_STEPMAKE_GUILE, [
161 ## First, let's just see if we can find Guile at all.
162 AC_MSG_CHECKING("for guile-config")
163 for guile_config in guile-config $target-guile-config $build-guile-config; do
164 AC_MSG_RESULT("$guile_config")
165 if ! $guile_config --version > /dev/null 2>&1 ; then
166 AC_MSG_WARN("cannot execute $guile_config")
167 AC_MSG_CHECKING("if we are cross compiling")
173 if test "$guile_config" = "error"; then
174 AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
177 AC_MSG_CHECKING("Guile version")
178 need_guile_version="1.3.4"
179 need_guile_version_numeric=100304
180 guile_version=`$guile_config --version 2>&1 | awk '{print $NF}'`
181 guile_version_numeric=`echo $guile_version | awk -F. '
182 {if ([$]3) {last = [$]3}
184 {printf "%s%s%s\n",[$]1*100, [$]2*10,last}'`
185 AC_MSG_RESULT("$guile_version")
186 if test $guile_version_numeric -lt $need_guile_version_numeric
188 AC_STEPMAKE_WARN("Guile version "$need_guile_version" or newer is needed")
191 AC_PATH_PROG(GUILE, guile, error)
195 AC_DEFUN(AC_STEPMAKE_INIT, [
198 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
199 if test x$MY_PATCH_LEVEL != x; then
200 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
203 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
204 changequote(<<, >>)dnl
205 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
206 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
209 # No versioning on directory names of sub-packages
211 stepmake=${datadir}/stepmake
213 if test "$prefix" = "NONE"; then
214 presome=${ac_default_prefix}
216 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
218 # urg, how is this supposed to work?
219 if test "$program_prefix" = "NONE"; then
222 if test "$program_suffix" = "NONE"; then
226 AC_MSG_CHECKING(Package)
227 if test "x$PACKAGE" = "xSTEPMAKE"; then
228 AC_MSG_RESULT(Stepmake package!)
230 AC_MSG_CHECKING(builddir)
231 if test "$srcdir" = "."; then
234 absolute_builddir="`pwd`"
235 package_absolute_builddir="`dirname $absolute_builddir`"
236 package_srcdir="`dirname $srcdir`"
237 builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
239 AC_MSG_RESULT($builddir)
241 (cd stepmake 2>/dev/null || mkdir stepmake)
242 (cd stepmake; rm -f stepmake; ln -s ../$srcdir/stepmake .)
243 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
244 AC_CONFIG_AUX_DIR(bin)
247 AC_MSG_RESULT($PACKAGE)
249 AC_MSG_CHECKING(builddir)
250 if test "$srcdir" = "."; then
254 absolute_builddir="`pwd`"
255 # builddir="`dirname $srcdir`/`basename $absolute_builddir`"
256 builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
259 AC_MSG_RESULT($builddir)
260 if expr "$srcdir" : '/' > /dev/null 2>&1; then
262 AC_STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
265 AC_MSG_CHECKING(for stepmake)
266 # Check for installed stepmake
267 if test -d $stepmake; then
268 AC_MSG_RESULT($stepmake)
270 if test "$absolute_srcdir" != "yes"; then
271 stepmake='$(depth)'/$srcdir/stepmake
273 stepmake=$srcdir/stepmake
275 AC_MSG_RESULT($srcdir/stepmake ($datadir/stepmake not found))
279 $HOME/usr/local/share/stepmake/bin\
280 $HOME/usr/local/lib/stepmake/bin\
281 $HOME/usr/share/stepmake/bin\
282 $HOME/usr/lib/stepmake/bin\
283 /usr/local/share/stepmake/bin\
284 /usr/local/lib/stepmake/bin\
285 /usr/share/stepmake/bin\
286 /usr/lib/stepmake/bin\
288 $srcdir/stepmake/bin\
296 AC_SUBST(PACKAGE_NAME)
297 AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
298 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
300 if test "$package_depth" = "" ; then
303 package_depth="../$package_depth"
306 AC_SUBST(package_depth)
308 AUTOGENERATE="This file was automatically generated by configure"
309 AC_SUBST(AUTOGENERATE)
312 AC_ARG_ENABLE(config,
313 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
314 do \`make conf=CONF' to get output in ./out-CONF],
315 [CONFIGSUFFIX=-$enableval])
317 CONFIGFILE=config$CONFIGSUFFIX
318 AC_SUBST(CONFIGSUFFIX)
321 AC_CHECK_PROGS(MAKE, gmake make, error)
322 AC_CHECK_PROGS(FIND, find, error)
324 dnl system supplied INSTALL is unsafe; use our own install.
326 dnl if test "$INSTALL" = "bin/install-sh"; then
327 dnl export INSTALL="\$\(depth\)/bin/install-sh"
330 AC_CHECK_PROGS(TAR, tar, error)
332 if test "x`uname`" = "xHP-UX"; then
333 AC_PATH_PROG(BASH, bash, /bin/sh)
334 AC_STEPMAKE_WARN(avoiding buggy /bin/sh)
335 AC_PATH_PROG(SHELL, bash, /bin/ksh)
337 AC_PATH_PROG(BASH, bash, /bin/sh)
343 AC_PATH_PROG(PYTHON, ${PYTHON:-python}, -echo no python)
346 if test $MAKE != "error" ; then
347 $MAKE -v 2> /dev/null | grep GNU > /dev/null
350 AC_STEPMAKE_WARN(Please install *GNU* make)
354 AC_CHECK_SEARCH_RESULT($PYTHON, python, You should install Python)
356 if test "x$OSTYPE" = "xcygwin32" || test "x$OSTYPE" = "xWindows_NT"; then
357 LN=cp # hard link does not work under cygnus-nt
358 LN_S='cp -r' # symbolic link does not work for native nt
366 # cygwin fixes all these things.
367 # it seems these were used because of dos-style TEXINPUTS and
368 # MFINPUTS needed for miktex.
369 # but this breaks parsing of all other cygwin/unix style paths.
371 # if your (mik)tex breaks, make a:
372 # /usr/local/bin/tex:
374 # TEXINPUTS=`cygpath -pw $TEXINPUTS` /texmf/miktex/bin/tex $*
380 # MFINPUTS=`cygpath -pw $MFINPUTS` /texmf/miktex/bin/mf $*
382 # this way, you may have buildscripts/out/lilypond-profile
383 # 'automatically' sourced from /usr/etc/profile.d/ too.
388 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
396 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
398 AC_SUBST(program_prefix)
399 AC_SUBST(program_suffix)
404 AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
405 AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
412 AC_DEFUN(AC_STEPMAKE_KPATHSEA, [
415 AC_ARG_WITH(kpathsea,
416 [ --with-kpathsea use kpathsea lib. Default: on],
417 [kpathsea_b=$enableval])
419 if test "$kpathsea_b" = "yes"; then
420 AC_HAVE_HEADERS(kpathsea/kpathsea.h)
421 AC_CHECK_LIB(kpathsea, kpse_find_file)
422 AC_CHECK_FUNCS(kpse_find_file,, AC_ERROR(Cannot find kpathsea functions. You should install kpathsea; see INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea is not available for your platform.))
424 AC_MSG_CHECKING(whether to use kpathsea)
425 if test "$kpathsea_b" = yes; then
434 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
437 AC_DEFUN(AC_STEPMAKE_LEXYACC, [
438 # ugh, automake: we want (and check for) bison
440 # ugh, automake: we want (and check for) flex
442 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
446 ac_cv_prog_lex_root=lex.yy
448 AC_CHECK_PROGS(BISON, bison, error)
449 AC_CHECK_PROGS(FLEX, flex, error)
450 AC_CHECK_SEARCH_RESULT($BISON, bison, Please install Bison, 1.25 or newer)
451 AC_CHECK_SEARCH_RESULT($FLEX, flex, Please install Flex, 2.5 or newer)
453 if test $BISON != "error"; then
454 bison_version=`$BISON --version | sed 's/^.*version 1.//g'`
455 if test `echo $bison_version | sed 's/\..*$//g'` -lt 25; then
456 AC_STEPMAKE_WARN(Your bison is a bit old (1.$bison_version). You might have to install 1.25)
464 AC_DEFUN(AC_STEPMAKE_LIB, [
465 AC_CHECK_PROGS(AR, ar, error)
472 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
474 # **Never** try to set library version numbers so that they correspond
475 # to the release number of your package. This is an abuse that only
476 # fosters misunderstanding of the purpose of library versions.
478 REVISION=$PATCH_LEVEL
479 # CURRENT=$MINOR_VERSION
480 CURRENT=`expr $MINOR_VERSION + 1`
481 # AGE=$(expr $MAJOR_VERSION + 1)
488 AC_DEFUN(AC_STEPMAKE_LOCALE, [
493 AC_ARG_WITH(localedir,
494 [ --with-localedir=LOCALE use LOCALE as locale dir. Default:
495 PREFIX/share/locale ],
496 localedir=$with_localedir,
497 localedir='${prefix}/share/locale')
500 [ --with-lang=LANG use LANG as language to emit messages],
504 AC_MSG_CHECKING(language)
506 En* | en* | Am* | am* | US* | us*)
508 NL | nl | Du* | du* | Ned* | ned*)
517 if test "$lang" = "unknown" ; then
518 AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
523 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
524 DIR_LOCALEDIR=${localedir}
526 if test "$prefix" = "NONE"; then
527 presome=${ac_default_prefix}
529 DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
531 AC_SUBST(DIR_LOCALEDIR)
532 AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
534 AC_CHECK_LIB(intl, gettext)
535 AC_CHECK_FUNCS(gettext)
538 AC_DEFUN(AC_STEPMAKE_MAKEINFO, [
539 AC_CHECK_PROGS(MAKEINFO, makeinfo, error)
540 AC_MSG_CHECKING(whether makeinfo can split html by @node)
541 makeinfo --html --output=out/split <<EOF
543 \input texinfo @c -*-texinfo-*-
544 @setfilename split.info
548 if test -d out/split; then
549 SPLITTING_MAKEINFO=yes
554 AC_STEPMAKE_WARN(your html documentation will be one large file)
557 AC_SUBST(SPLITTING_MAKEINFO)
561 AC_DEFUN(AC_STEPMAKE_MAN, [
562 AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
563 AC_CHECK_PROGS(TROFF, troff, -echo no troff)
564 AC_CHECK_PROGS(TBL, tbl, cat)
567 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
568 # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
569 AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
570 AC_MSG_CHECKING(whether msgfmt accepts -o)
571 msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
572 if test "$msgfmt_output" = ""; then
576 MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
578 AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
580 if test ! -n "$MSGFMT"; then
581 AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
585 #why has this been dropped?
586 AC_DEFUN(XXAC_STEPMAKE_TEXMF_DIRS, [
587 AC_ARG_ENABLE(tex-prefix,
588 [ --enable-tex-prefix=DIR set the tex-directory to find TeX
589 subdirectories. Default: PREFIX],
590 [TEXPREFIX=$enableval],
593 AC_ARG_ENABLE(tex-dir,
594 [ --enable-tex-dir=DIR set the directory to put $PACKAGE_NAME TeX files in. ],
598 AC_ARG_ENABLE(mf-dir,
599 [ --enable-mf-dir=DIR set the directory to put $PACKAGE_NAME MetaFont files in. ],
603 if test "x$TEXPREFIX" = xauto ; then
604 AC_TEX_PREFIX(TEXPREFIX)
606 find_texprefix=$TEXPREFIX
609 if test "x$MFDIR" = xauto; then
613 if test "x$TEXDIR" = xauto ; then
614 AC_TEX_SUBDIR(TEXDIR)
621 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
622 AC_ARG_ENABLE(tfm-path,
623 [ --enable-tfm-path=PATH set path of tex directories where tfm files live,
624 esp.: cmr10.tfm. Default: use kpsewhich],
625 [tfm_path=$enableval],
628 AC_CHECK_PROGS(KPSEWHICH, kpsewhich, no)
629 AC_MSG_CHECKING(for tfm path)
633 if test "x$tfm_path" = xauto ; then
634 if test "x$KPSEWHICH" != "xno" ; then
635 for i in $TFM_FONTS; do
636 dir=`$KPSEWHICH tfm ${i}10.tfm`
637 TFM_PATH="$TFM_PATH `dirname $dir`"
640 AC_STEPMAKE_WARN(Please specify where cmr10.tfm lives:
641 ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
647 TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
648 AC_MSG_RESULT($TFM_PATH)
652 AC_DEFUN(AC_STEPMAKE_TEXMF, [
653 # urg, never know what names these teTeX guys will think up
655 AC_CHECK_PROGS(METAFONT, mf, no)
656 if test "x$METAFONT" = "xno"; then
657 AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
661 AC_CHECK_PROGS(METAPOST, mp, no)
662 if test "x$METAPOST" = "xno"; then
663 AC_CHECK_PROGS(MPOST, mpost, -echo no mp or mpost)
668 AC_CHECK_PROGS(INIMETAFONT, inimf, no)
669 if test "x$INIMETAFONT" = "xno"; then
670 AC_CHECK_PROGS(INIMFONT, inimfont, -echo no inimf or inimfont)
671 INIMETAFONT=$INIMFONT
674 AC_CHECK_PROGS(INIMETAPOST, inimp, no)
675 if test "x$INIMETAPOST" = "xno"; then
676 AC_CHECK_PROGS(INIMPOST, inimpost, -echo no inimp or inimpost)
677 INIMETAPOST=$INIMPOST
680 AC_MSG_CHECKING(for working metafont mode)
681 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
682 for MFMODE in $modelist; do
683 $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
684 if test -f mfput.tfm; then
688 AC_MSG_RESULT($MFMODE)
690 AC_MSG_CHECKING(for mfplain.mp)
692 # For now let people define these in their environments
694 : ${MFPLAIN_MP=`kpsewhich mp mfplain.mp`}
695 AC_MSG_RESULT($MFPLAIN_MP)
697 AC_MSG_CHECKING(for inimetapost flags)
698 if test ${INIMETAPOST} = "inimp" ; then
699 : ${INIMETAPOST_FLAGS=''}
701 : ${INIMETAPOST_FLAGS='-interaction=nonstopmode'}
703 AC_MSG_RESULT($INIMETAPOST_FLAGS)
710 AC_SUBST(INIMETAFONT)
711 AC_SUBST(INIMETAPOST)
713 AC_SUBST(INIMETAPOST_FLAGS)
716 AC_DEFUN(AC_STEPMAKE_WARN, [
721 AC_DEFUN(AC_STEPMAKE_YODL, [
722 if test "x$YODL" = "x"; then
723 AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
724 AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
725 AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
726 AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
727 AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
728 AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
729 AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
730 AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
731 YODL2LESS_DIR='$(bindir)/'
737 AC_SUBST(YODL2LESS_DIR)
739 AC_SUBST(YODL2MSLESS)
740 AC_SUBST(YODL2TEXINFO)
742 export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
744 if test "x$YODL" = "-echo no yodl"; then
745 AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
749 dnl should cache result.
750 dnl should look in $prefix first.
751 dnl should probably assume TDS
753 AC_DEFUN(AC_TEX_PREFIX, [
756 AC_MSG_CHECKING(TeX/MF root dir directory)
758 find_root_prefix="$prefix"
761 test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
763 for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
764 find_texprefix="$find_root_prefix$postfix"
765 if test -d $find_texprefix; then
766 find_texpostfix=$postfix
771 if test "x$find_texpostfix" = x; then
772 find_texpostfix='/lib/texmf/tex'
773 AC_STEPMAKE_WARN(Cannot determine the TeX-directory. Please use --enable-tex-prefix)
776 find_texprefix="$find_root_prefix/$find_texpostfix"
778 # only assign if variablename not empty
779 if test x != "x[$]$1"; then
780 $1='${prefix}'/"$find_texpostfix"
782 AC_MSG_RESULT($find_texprefix)
787 # find a directory inside a prefix,
788 # $1 the prefix (expanded version)
789 # $2 variable to assign
790 # $3 the directory name
792 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
794 AC_MSG_CHECKING($4 directory)
796 $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
799 if test "x$find_dirdir" = x; then
801 AC_STEPMAKE_WARN(Cannot determine $4 subdirectory. Please set from command-line)
805 AC_MSG_RESULT($1/$find_dirdir)
808 # ugh. this is hopeless
809 AC_DEFUN(AC_KPSE_TEX_DIR, [
810 kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
811 kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
813 if test -w "$kpse_syspaths";
815 dir=`echo $kpse_syspaths | head -1`
817 dir=`echo $kpse_paths | grep -v '!'| head -1`
819 if test "$prefix" = "NONE"; then
820 local_prefix=$ac_default_prefix
821 local_prefix_quote='${prefix}'
825 local_prefix_quote=$prefix
827 echo $local_prefix_quote = $local_prefix
829 echo $dir | sed 's!'$local_prefix'!\$local_prefix_quote!g'
832 AC_DEFUN(AC_TEX_SUBDIR, [
833 dnl AC_REQUIRE([AC_TEX_PREFIX])
834 AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
838 AC_DEFUN(AC_MF_SUBDIR, [
839 dnl AC_REQUIRE([AC_TEX_PREFIX])
840 AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
844 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
845 result="`echo \"$1\" | grep echo`"
846 if test "x$1" = "xerror" -o "x$result" != "x"; then
847 AC_STEPMAKE_WARN(can\'t find $2. $3)
851 dnl GUILE_FLAGS --- set flags for compiling and linking with Guile
853 dnl This macro runs the `guile-config' script, installed with Guile,
854 dnl to find out where Guile's header files and libraries are
855 dnl installed. It sets two variables, marked for substitution, as
858 dnl GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
859 dnl code that uses Guile header files. This is almost
860 dnl always just a -I flag.
862 dnl GUILE_LDFLAGS --- flags to pass to the linker to link a
863 dnl program against Guile. This includes `-lguile' for
864 dnl the Guile library itself, any libraries that Guile
865 dnl itself requires (like -lqthreads), and so on. It may
866 dnl also include a -L flag to tell the compiler where to
867 dnl find the libraries.
869 AC_DEFUN([GUILE_FLAGS],[
870 ## The GUILE_FLAGS macro.
871 AC_MSG_CHECKING(for Guile)
872 if ! $guile_config link > /dev/null ; then
873 AC_MSG_RESULT("cannot execute $guile_config")
874 AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
877 GUILE_CFLAGS="`$guile_config compile`"
878 GUILE_LDFLAGS="`$guile_config link`"
879 AC_SUBST(GUILE_CFLAGS)
880 AC_SUBST(GUILE_LDFLAGS)
885 # Configure paths for GTK+
886 # Owen Taylor 97-11-3
888 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
889 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
891 AC_DEFUN(AM_PATH_GTK,
893 dnl Get the cflags and libraries from the gtk-config script
895 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
896 min_gtk_version=ifelse([$1], ,1.1.1,$1)
897 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
899 if test "$GTK_CONFIG" != "no" ; then
900 GTK_CFLAGS=`$GTK_CONFIG --cflags`
901 GTK_LIBS=`$GTK_CONFIG --libs`
902 ac_save_CFLAGS="$CFLAGS"
904 ac_save_CXXFLAGS="$CXXFLAGS"
905 CFLAGS="$CFLAGS $GTK_CFLAGS"
906 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
907 LIBS="$LIBS $GTK_LIBS"
909 dnl Now check if the installed GTK is sufficiently new. (Also sanity
910 dnl checks the results of gtk-config to some extent)
919 int major, minor, micro;
921 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) {
922 printf("%s, bad version string\n", "$min_gtk_version");
926 return !((gtk_major_version > major) ||
927 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
928 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
930 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
931 CFLAGS="$ac_save_CFLAGS"
932 CXXFLAGS="$ac_save_CXXFLAGS"
937 if test "x$no_gtk" = x ; then
939 ifelse([$2], , :, [$2])
944 ifelse([$3], , :, [$3])
946 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
953 # Configure paths for GTK--
954 # Erik Andersen 30 May 1998
955 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
957 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
958 dnl to be used as follows:
959 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
962 dnl Get the cflags and libraries from the gtkmm-config script
964 AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX
965 Prefix where GTK-- is installed (optional)],
966 gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
967 AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX
968 Exec prefix where GTK-- is installed (optional)],
969 gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
970 AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program],
971 , enable_gtkmmtest=yes)
973 if test x$gtkmm_config_exec_prefix != x ; then
974 gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
975 if test x${GTKMM_CONFIG+set} != xset ; then
976 GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
979 if test x$gtkmm_config_prefix != x ; then
980 gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
981 if test x${GTKMM_CONFIG+set} != xset ; then
982 GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
987 AC_DEFUN(AM_PATH_GTKMM,
991 dnl Check if the installed GTK-- is sufficiently new.
993 AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
994 min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
996 AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
998 if test "$GTKMM_CONFIG" = "no" ; then
1004 GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
1005 GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
1006 gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1007 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1008 gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1009 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1010 gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1011 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1012 if test "x$enable_gtkmmtest" = "xyes" ; then
1013 ac_save_CXXFLAGS="$CXXFLAGS"
1014 ac_save_LIBS="$LIBS"
1015 CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1016 LIBS="$LIBS $GTK___LIBS"
1018 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
1019 dnl checks the results of gtkmm-config to some extent
1021 rm -f conf.gtkmmtest
1030 int major, minor, micro;
1033 system ("touch conf.gtkmmtest");
1035 /* HP/UX 0 (%@#!) writes to sscanf strings */
1036 tmp_version = g_strdup("$min_gtkmm_version");
1037 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
1038 printf("%s, bad version string\n", "$min_gtkmm_version");
1042 if ((gtkmm_major_version != $gtkmm_config_major_version) ||
1043 (gtkmm_minor_version != $gtkmm_config_minor_version) ||
1044 (gtkmm_micro_version != $gtkmm_config_micro_version))
1046 printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n",
1047 $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
1048 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1049 printf ("*** was found! If gtkmm-config was correct, then it is best\n");
1050 printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
1051 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1052 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1053 printf("*** required on your system.\n");
1054 printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
1055 printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
1056 printf("*** before re-running configure\n");
1058 /* GTK-- does not have the GTKMM_*_VERSION constants */
1060 else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
1061 (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
1062 (gtkmm_micro_version != GTKMM_MICRO_VERSION))
1064 printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
1065 GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
1066 printf("*** library (version %d.%d.%d)\n",
1067 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1072 if ((gtkmm_major_version > major) ||
1073 ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
1074 ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
1080 printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
1081 gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1082 printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
1083 major, minor, micro);
1084 printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
1086 printf("*** If you have already installed a sufficiently new version, this error\n");
1087 printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
1088 printf("*** being found. The easiest way to fix this is to remove the old version\n");
1089 printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
1090 printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
1091 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1092 printf("*** so that the correct libraries are found at run-time))\n");
1097 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1098 CXXFLAGS="$ac_save_CXXFLAGS"
1099 LIBS="$ac_save_LIBS"
1102 if test "x$no_gtkmm" = x ; then
1104 ifelse([$2], , :, [$2])
1107 if test "$GTKMM_CONFIG" = "no" ; then
1108 echo "*** The gtkmm-config script installed by GTK-- could not be found"
1109 echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
1110 echo "*** your path, or set the GTK_CONFIG environment variable to the"
1111 echo "*** full path to gtk-config."
1112 echo "*** The gtkmm-config script was not available in GTK-- versions"
1113 echo "*** prior to 0.9.12. Perhaps you need to update your installed"
1114 echo "*** version to 0.9.12 or newer"
1116 if test -f conf.gtkmmtest ; then
1119 echo "*** Could not run GTK-- test program, checking why..."
1120 CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
1121 LIBS="$LIBS $GTK___LIBS"
1125 ], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
1126 [ echo "*** The test program compiled, but did not run. This usually means"
1127 echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
1128 echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
1129 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1130 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1131 echo "*** is required on your system"
1133 echo "*** If you have an old version installed, it is best to remove it, although"
1134 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1135 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1136 echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
1137 echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
1138 echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
1139 CXXFLAGS="$ac_save_CXXFLAGS"
1140 LIBS="$ac_save_LIBS"
1145 ifelse([$3], , :, [$3])
1148 AC_SUBST(GTK___CFLAGS)
1149 AC_SUBST(GTK___LIBS)
1150 rm -f conf.gtkmmtest
1153 # Configure paths for GTK--DRAW
1154 # Derek Quinn Wyatt 98-08-21 (adapted from Jan Nieuwenhuizen's code)
1156 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1157 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1159 AC_DEFUN(AM_PATH_GTK__DRAW,
1161 dnl Get the cflags and libraries from the gtk__-config script
1163 AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1164 min_gtk___version=ifelse([$1], ,0.0.5,$1)
1165 AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1167 if test "$GTKMM_CONFIG" != "no" ; then
1168 GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1169 GTK___LIBS=`$GTKMM_CONFIG --libs`
1170 GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1171 GTK___LIBS="$GTK___DLIBS"
1172 ac_save_CFLAGS="$CFLAGS"
1173 ac_save_LIBS="$LIBS"
1174 ac_save_CXXFLAGS="$CXXFLAGS"
1175 CFLAGS="$CFLAGS $GTK___CFLAGS"
1176 CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1177 LIBS="$LIBS $GTK___LIBS"
1179 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1180 dnl checks the results of gtk__-config to some extent)
1192 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1193 CFLAGS="$ac_save_CFLAGS"
1194 CXXFLAGS="$ac_save_CXXFLAGS"
1195 LIBS="$ac_save_LIBS"
1199 if test "x$no_gtk__" = x ; then
1201 ifelse([$2], , :, [$2])
1206 ifelse([$3], , :, [$3])
1208 CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1210 AC_SUBST(GTK___CFLAGS)
1211 AC_SUBST(GTK___LIBS)