]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
release: 1.1.34
[lilypond.git] / aclocal.m4
1 dnl WARNING WARNING WARNING WARNING
2 dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
3 dnl aclocal.m4   -*-shell-script-*-
4 dnl StepMake subroutines for configure.in
5
6 AC_DEFUN(AC_STEPMAKE_COMPILE, [
7     # -O is necessary to get inlining
8     OPTIMIZE=""
9     CXXFLAGS=${CXXFLAGS:-""}
10     CFLAGS=${CFLAGS:-""}
11     checking_b=yes
12     optimise_b=no
13     profile_b=no
14     debug_b=yes
15
16     AC_ARG_ENABLE(checking,
17     [  enable-checking         set runtime checks (assert calls). Default: on],
18     [checking_b=$enableval] )
19
20     # actually, the default is: tja='-O' to get inlining...
21     # off=''  --jcn
22
23     #actually, that sucks.
24     #  tja looks like a typo.  Default is optimisation off. --hwn
25     
26     AC_ARG_ENABLE(optimise,
27     [  enable-optimise         use maximal speed optimisations. Default: off],
28     [optimise_b=$enableval])
29     
30     AC_ARG_ENABLE(profiling, 
31     [  enable-profiling        compile with gprof support. Default: off],
32     [profile_b=$enableval])
33     
34     AC_ARG_ENABLE(debugging,
35     [  enable-debugging        set debug info. Default: on],
36     [debug_b=$enableval])
37
38     AC_ARG_ENABLE(mingw-prefix,
39     [  enable-mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)],
40     [MINGWPREFIX=$enableval],
41     [MINGWPREFIX=no])
42
43     if test "$printing_b" = no; then
44         # ugh
45         AC_DEFINE(NPRINT)
46         DEFINES="$DEFINES -DNPRINT"
47     fi
48         
49     if test "$checking_b" = no; then
50         # ugh
51         AC_DEFINE(NDEBUG)
52         DEFINES="$DEFINES -DNDEBUG"
53     fi
54
55     if test "$optimise_b" = yes; then
56         OPTIMIZE="-O2 -finline-functions"
57     fi
58
59     if test "$optimise_b" = no; then
60         OPTIMIZE=""
61     fi
62
63     if test $profile_b = yes; then
64         EXTRA_LIBES="-pg"
65         OPTIMIZE="$OPTIMIZE -pg"
66     fi
67
68     if test $debug_b = yes; then        
69         OPTIMIZE="$OPTIMIZE -g"
70     fi
71
72     # however, C++ support in mingw32 v 0.1.4 is still flaky
73     if test x$MINGWPREFIX != xno; then 
74         ICFLAGS="-I$MINGWPREFIX/include"
75         ILDFLAGS="-$MINGWPREFIX/lib"
76     fi
77
78     AC_PROG_CC
79     LD='$(CC)'
80     AC_SUBST(LD)
81
82     CFLAGS="$CFLAGS $OPTIMIZE"
83     CPPFLAGS=${CPPFLAGS:-""}
84     AC_SUBST(CFLAGS)
85     AC_SUBST(CPPFLAGS)
86     AC_SUBST(LDFLAGS)
87     AC_SUBST(ICFLAGS)
88     AC_SUBST(ILDFLAGS)
89     AC_SUBST(DEFINES)
90     AC_SUBST(EXTRA_LIBES)
91 ])
92
93 AC_DEFUN(AC_STEPMAKE_CXX, [
94     AC_LANG_CPLUSPLUS
95     AC_PROG_CXX
96
97     AC_CHECK_HEADER(FlexLexer.h, true,
98         AC_STEPMAKE_WARN(can"\'"t find flex header. Please install Flex headers correctly))
99
100     CPPFLAGS="$CPPFLAGS $DEFINES"
101     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
102     LDFLAGS=$EXTRA_LIBES
103
104     AC_SUBST(CXXFLAGS)
105     AC_SUBST(CXX)
106     LD='$(CXX)'
107     AC_SUBST(LD)
108 ])
109
110 AC_DEFUN(AC_STEPMAKE_CXXTEMPLATE, [
111     AC_CACHE_CHECK([whether explicit instantiation is needed],
112         lily_cv_need_explicit_instantiation,
113         AC_TRY_LINK([
114     template <class T> struct foo { static int baz; };
115     template <class T> int foo<T>::baz = 1;
116     ], [ return foo<int>::baz; ],
117             lily_cv_need_explicit_instantiation=no,
118             lily_cv_need_explicit_instantiation=yes))
119     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
120         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
121     fi
122 ])
123
124 AC_DEFUN(AC_STEPMAKE_DATADIR, [
125     if test "$datadir" = "\${prefix}/share"; then
126             datadir='${prefix}/share/'$package
127     fi
128     DIR_DATADIR=${datadir}
129     presome=${prefix}
130     if test "$prefix" = "NONE"; then
131             presome=${ac_default_prefix}
132     fi
133     DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
134     AC_SUBST(datadir)
135     AC_SUBST(DIR_DATADIR)
136     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
137 ])
138
139 AC_DEFUN(AC_STEPMAKE_END, [
140     AC_OUTPUT($CONFIGFILE.make:config.make.in)
141
142     rm -f GNUmakefile
143     cp make/toplevel.make.in ./GNUmakefile
144     chmod 444 GNUmakefile
145 ])
146
147 AC_DEFUN(AC_STEPMAKE_GXX, [
148     # ugh autoconf
149     # urg, egcs: how to check for egcs >= 1.1?
150     changequote(<<, >>)dnl
151     if $CXX --version | grep '2\.8' > /dev/null ||
152         $CXX --version | grep 'egcs' > /dev/null
153     changequote([, ])dnl
154     then
155             true
156     else
157             AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs 1.1)
158     fi
159 ])
160
161 AC_DEFUN(AC_STEPMAKE_GUILE, [
162     # on some systems, -lguile succeeds for guile-1.3
163     # others need readline, dl (or even more)
164     # urg, must check for different functions in libguile
165     # to force new check iso reading from cache
166
167     # gh_scm2doubles,gh_doubles2scm are new in 1.3
168     GUILE_FLAGS
169     AC_CHECK_LIB(guile, gh_scm2doubles,
170       [LIBS="`echo $GUILE_LDFLAGS | sed -e 's/-L[[/-_a-zA-Z0-9]]\+ //g'` $LIBS"
171       AC_DEFINE(HAVE_LIBGUILE)], , $GUILE_LDFLAGS dnl
172     )
173     if test "$ac_cv_lib_guile_gh_scm2doubles" != yes ; then
174         AC_STEPMAKE_WARN(You should install guile 1.3 or newer)
175     fi
176 ])
177
178 AC_DEFUN(AC_STEPMAKE_INIT, [
179
180     . $srcdir/VERSION
181     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
182     if test x$MY_PATCH_LEVEL != x; then
183         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
184     fi
185
186     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
187     changequote(<<, >>)dnl
188     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
189     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
190     changequote([, ])dnl
191
192     # No versioning on directory names of sub-packages 
193     # urg, urg
194     stepmake=${datadir}/stepmake
195     presome=${prefix}
196     if test "$prefix" = "NONE"; then
197             presome=${ac_default_prefix}
198     fi
199     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
200
201     if test "x$PACKAGE" = "xSTEPMAKE"; then
202         echo Stepmake package!
203         (cd stepmake; rm -f stepmake; ln -s ../stepmake .)
204         (cd stepmake; rm -f bin; ln -s ../bin .)
205         AC_CONFIG_AUX_DIR(bin)
206         stepmake=stepmake
207     else
208         echo Package: $PACKAGE
209         # Check for installed stepmake
210         if test -d $stepmake; then
211             echo Using installed stepmake: $stepmake
212         else
213             stepmake='$(depth)'/stepmake
214             echo Using local stepmake: $datadir/stepmake not found
215         fi
216         AC_CONFIG_AUX_DIR(\
217           $HOME/usr/local/share/stepmake/bin\
218           $HOME/usr/local/lib/stepmake/bin\
219           $HOME/usr/share/stepmake/bin\
220           $HOME/usr/lib/stepmake/bin\
221           /usr/local/share/stepmake/bin\
222           /usr/local/lib/stepmake/bin\
223           /usr/share/stepmake/bin\
224           /usr/lib/stepmake/bin\
225           stepmake/bin\
226         )
227     fi
228
229     AC_SUBST(stepmake)
230     AC_SUBST(package)
231     AC_SUBST(PACKAGE)
232     AC_SUBST(PACKAGE_NAME)
233     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
234     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
235
236     if test "$package_depth" = "" ; then
237         package_depth="."
238     else
239         package_depth="../$package_depth"
240     fi
241     export package_depth
242     AC_SUBST(package_depth)
243
244     AUTOGENERATE="This file was automatically generated by configure"
245     AC_SUBST(AUTOGENERATE)
246     absolute_builddir="`pwd`"
247     AC_SUBST(absolute_builddir)
248
249     STATE_VECTOR=`ls make/STATE-VECTOR 2>/dev/null`
250     if test "x$STATE_VECTOR" != "x"; then
251         STATE_VECTOR="\$(depth)/$STATE_VECTOR"
252     fi
253     AC_SUBST(STATE_VECTOR)
254
255     CONFIGSUFFIX=
256     AC_ARG_ENABLE(config,
257     [  enable-config=FILE      put configure settings in config-FILE.make],
258     [CONFIGSUFFIX=$enableval])
259
260     if test "$CONFIGSUFFIX" != "" ; then
261         CONFIGFILE=config-$CONFIGSUFFIX
262     else
263         CONFIGFILE=config
264     fi
265     AC_SUBST(CONFIGSUFFIX)
266      
267     AC_CANONICAL_HOST
268     AC_CHECK_PROGS(MAKE, gmake make, error)
269     AC_CHECK_PROGS(FIND, find, error)
270
271 dnl system supplied INSTALL is unsafe; use our own install.
272 dnl    AC_PROG_INSTALL
273 dnl    if test "$INSTALL" = "bin/install-sh"; then
274 dnl     export INSTALL="\$\(depth\)/bin/install-sh"
275 dnl    fi
276
277     AC_CHECK_PROGS(TAR, tar, error)
278     AC_CHECK_PROGS(BASH, bash, /bin/sh)
279
280     AC_PATH_PROG(PYTHON, ${PYTHON:-python}, -echo no python)
281     AC_SUBST(PYTHON)
282
283     if test $MAKE != "error" ; then
284         $MAKE -v 2> /dev/null | grep GNU > /dev/null
285         if test "$?" = 1
286         then
287                 AC_STEPMAKE_WARN(Please install *GNU* make) 
288         fi
289     fi 
290
291     AC_CHECK_SEARCH_RESULT($PYTHON, python, You should install Python)
292
293     if test "x$OSTYPE" = "xcygwin32" || test "x$OSTYPE" = "xWindows_NT"; then
294         LN=cp # hard link does not work under cygnus-nt
295         LN_S='cp -r' # symbolic link does not work for native nt
296         ZIP="zip -r -9" #
297         DOTEXE=.exe
298         # urg
299         # DIRSEP='\\'
300         # PATHSEP=';'
301         #
302         # cygwin fixes all these things.  
303         # it seems these were used because of dos-style TEXINPUTS and
304         # MFINPUTS needed for miktex.
305         # but this breaks parsing of all other cygwin/unix style paths.
306         #
307         # if your (mik)tex breaks, make a:
308         #    /usr/local/bin/tex:
309         #    #!/bin/sh
310         #    TEXINPUTS=`cygpath -pw $TEXINPUTS` /texmf/miktex/bin/tex $*
311         #
312         # and
313         #
314         #    /usr/local/bin/mf:
315         #    #!/bin/sh
316         #    MFINPUTS=`cygpath -pw $MFINPUTS` /texmf/miktex/bin/mf $*
317         #
318         # this way, you may have buildscripts/out/lilypond-profile 
319         # 'automatically' sourced from /usr/etc/profile.d/ too.
320         #
321         DIRSEP='/'
322         PATHSEP=':'
323         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
324     else
325         DIRSEP='/'
326         PATHSEP=':'
327         LN=ln
328         LN_S='ln -s'
329         ZIP="zip -r -9"
330         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
331     fi
332     AC_SUBST(DOTEXE)
333     AC_SUBST(ZIP)
334     AC_SUBST(LN)
335     AC_SUBST(LN_S)
336     AC_SUBST(INSTALL)
337     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
338     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
339     AC_SUBST(PATHSEP)
340     AC_SUBST(DIRSEP)
341   
342    
343     AC_STEPMAKE_DATADIR
344 ])
345
346 AC_DEFUN(AC_STEPMAKE_LEXYACC, [
347     # ugh, automake: we want (and check for) bison
348     AC_PROG_YACC
349     # ugh, automake: we want (and check for) flex
350     # AC_PROG_LEX
351     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
352
353     # AC_DECL_YYTEXT
354     # ugh, ugh
355     ac_cv_prog_lex_root=lex.yy
356
357     AC_CHECK_PROGS(BISON, bison, error)
358     AC_CHECK_PROGS(FLEX, flex, error)
359     AC_CHECK_SEARCH_RESULT($BISON, bison,  Please install Bison, 1.25 or newer)
360     AC_CHECK_SEARCH_RESULT($FLEX,  flex, Please install Flex, 2.5 or newer)
361
362     if test $BISON != "error"; then
363         bison_version=`$BISON --version | sed 's/^.*version 1.//g'`
364         if test `echo $bison_version | sed 's/\..*$//g'` -lt 25; then
365             AC_STEPMAKE_WARN(Your bison is a bit old (1.$bison_version). You might have to install 1.25)
366         fi      
367     fi
368
369     AC_SUBST(BISON)
370     AC_SUBST(FLEX)
371 ])
372
373 AC_DEFUN(AC_STEPMAKE_LIB, [
374     AC_CHECK_PROGS(AR, ar, error)
375     AC_PROG_RANLIB
376
377     AC_SUBST(AR)
378     AC_SUBST(RANLIB)
379 ])
380
381 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
382     # libtool.info ...
383     # **Never** try to set library version numbers so that they correspond
384     # to the release number of your package.  This is an abuse that only
385     # fosters misunderstanding of the purpose of library versions.
386
387     REVISION=$PATCH_LEVEL
388     # CURRENT=$MINOR_VERSION
389     CURRENT=`expr $MINOR_VERSION + 1`
390     # AGE=$(expr $MAJOR_VERSION + 1)
391     AGE=$MAJOR_VERSION
392     AC_SUBST(CURRENT)
393     AC_SUBST(REVISION)
394     AC_SUBST(AGE)
395 ])
396
397 AC_DEFUN(AC_STEPMAKE_LOCALE, [
398     lang=English
399     ALL_LINGUAS="en nl"
400
401     # with/enable ??
402     AC_ARG_WITH(localedir,
403     [  with-localedir=LOCALE   use LOCALE as locale dir. Default: PREFIX/share/locale ],
404     localedir=$with_localedir,
405     localedir='${prefix}/share/locale')
406
407     AC_ARG_WITH(lang,
408     [  with-lang=LANG          use LANG as language to emit messages],
409     language=$with_lang,
410     language=English)
411
412     AC_MSG_CHECKING(language)    
413     case "$language" in
414       En* | en* | Am* | am* | US* | us*)
415             lang=English;;
416       NL | nl | Du* | du* | Ned* | ned*)
417             lang=Dutch;;
418       "")
419             lang=English;;
420       *)
421             lang=unknown;;
422     esac
423     AC_MSG_RESULT($lang)
424
425     if test "$lang" = "unknown" ; then
426         AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
427     fi
428
429 ])
430
431 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
432     DIR_LOCALEDIR=${localedir}
433     presome=${prefix}
434     if test "$prefix" = "NONE"; then
435             presome=${ac_default_prefix}
436     fi
437     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
438     AC_SUBST(localedir)
439     AC_SUBST(DIR_LOCALEDIR)
440     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
441
442     AC_CHECK_LIB(intl, gettext)
443     AC_CHECK_FUNCS(gettext)
444 ])
445
446 AC_DEFUN(AC_STEPMAKE_MAN, [
447     AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
448     AC_CHECK_PROGS(TROFF, troff, -echo no troff)
449     AC_CHECK_PROGS(TBL, tbl, cat)
450 ])
451
452 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
453     # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
454     AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
455     AC_MSG_CHECKING(whether msgfmt accepts -o)
456     msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
457     if test "$msgfmt_output" = ""; then
458         AC_MSG_RESULT(yes)
459     else
460         # urg
461         MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
462         AC_MSG_RESULT(no)
463         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
464     fi
465     if test ! -n "$MSGFMT"; then
466         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
467     fi
468 ])
469
470 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
471     AC_ARG_ENABLE(tex-prefix,
472     [  enable-tex-prefix=DIR   set the tex-directory to find TeX subdirectories. (default: PREFIX)],
473     [TEXPREFIX=$enableval],
474     [TEXPREFIX=auto] )
475     
476     AC_ARG_ENABLE(tex-dir,
477     [  enable-tex-dir=DIR      set the directory to put $PACKAGE_NAME TeX files in. ],
478     [TEXDIR=$enableval],
479     [TEXDIR=auto] )
480
481     AC_ARG_ENABLE(mf-dir,
482     [  enable-mf-dir=DIR       set the directory to put $PACKAGE_NAME MetaFont files in. ],
483     [MFDIR=$enableval],
484     [MFDIR=auto])
485
486     if test "x$TEXPREFIX" = xauto ; then
487         AC_TEX_PREFIX(TEXPREFIX)
488     else
489      find_texprefix=$TEXPREFIX
490     fi
491
492     if test "x$MFDIR" = xauto; then
493         AC_MF_SUBDIR(MFDIR)
494     fi
495         
496     if test "x$TEXDIR" = xauto ; then
497         AC_TEX_SUBDIR(TEXDIR)
498     fi
499     AC_SUBST(TEXPREFIX)
500     AC_SUBST(TEXDIR)
501     AC_SUBST(MFDIR)
502 ])
503
504 AC_DEFUN(AC_STEPMAKE_TEXMF, [
505     # urg, never know what names these teTeX guys will think up
506     AC_CHECK_PROGS(METAFONT, mf, no)
507     if test "x$METAFONT" = "xno"; then
508         AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
509         METAFONT=$MFONT
510     fi
511
512     AC_CHECK_PROGS(METAPOST, mp, no)
513     if test "x$METAPOST" = "xno"; then
514         AC_CHECK_PROGS(MPOST, mpost, -echo no mp or mpost)
515         METAPOST=$MPOST
516     fi
517
518     AC_SUBST(METAFONT)
519     AC_SUBST(METAPOST)
520 ])
521
522 AC_DEFUN(AC_STEPMAKE_WARN, [
523     AC_MSG_WARN($1)
524     warn_b=yes
525 ])
526
527 AC_DEFUN(AC_STEPMAKE_YODL, [
528     if test "x$YODL" = "x"; then 
529         AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
530         AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
531         AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
532         AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
533         AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
534         AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
535         AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
536         AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
537         YODL2LESS_DIR='$(bindir)/'
538     else
539         AC_SUBST(STRIPROFF)
540         AC_SUBST(YODL)
541         AC_SUBST(YODL2HTML)
542         AC_SUBST(YODL2LATEX)
543         AC_SUBST(YODL2LESS_DIR)
544         AC_SUBST(YODL2MAN)
545         AC_SUBST(YODL2MSLESS)
546         AC_SUBST(YODL2TEXINFO)
547         AC_SUBST(YODL2TXT)
548         export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
549     fi
550     if test "x$YODL" = "-echo no yodl"; then
551         AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
552     fi    
553 ])
554
555 dnl should cache result.
556 dnl should  look in $prefix first.
557 dnl should probably assume TDS
558
559 AC_DEFUN(AC_TEX_PREFIX, [
560     
561
562     AC_MSG_CHECKING(TeX/MF root dir directory)    
563
564     find_root_prefix="$prefix"
565     
566
567     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
568     find_texpostfix="";
569     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
570         find_texprefix="$find_root_prefix$postfix"
571         if test -d $find_texprefix; then
572             find_texpostfix=$postfix
573             break;
574         fi
575     done
576     
577     if test "x$find_texpostfix" = x; then
578         find_texpostfix='/lib/texmf/tex'
579         AC_STEPMAKE_WARN(Cannot determine the TeX-directory. Please use --enable-tex-prefix)
580     fi
581
582     find_texprefix="$find_root_prefix/$find_texpostfix"
583
584     # only assign if variablename not empty
585     if test x != "x[$]$1"; then
586         $1='${prefix}'/"$find_texpostfix"
587     fi
588     AC_MSG_RESULT($find_texprefix)
589
590 ])
591  
592
593 # find a directory inside a prefix, 
594 # $1 the prefix (expanded version)
595 # $2 variable to assign
596 # $3 the directory name 
597 # $4 description
598 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
599     
600     AC_MSG_CHECKING($4 directory)    
601     find_dirdir=`(cd $1; 
602       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
603     
604
605     if test "x$find_dirdir" = x; then
606        find_dirdir="/$3";
607        AC_STEPMAKE_WARN(Cannot determine $4 subdirectory. Please set from command-line)
608         true
609     fi
610     $2=$find_dirdir
611     AC_MSG_RESULT($1/$find_dirdir)
612 ])
613
614 # ugh.  this is hopeless
615 AC_DEFUN(AC_KPSE_TEX_DIR, [
616         kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
617         kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
618         echo $kpse_paths
619         if test -w "$kpse_syspaths";
620         then
621                 dir=`echo $kpse_syspaths | head -1`
622         else
623                 dir=`echo $kpse_paths | grep -v '!'| head -1`
624         fi
625         if test "$prefix" = "NONE"; then
626                 local_prefix=$ac_default_prefix
627                 local_prefix_quote='${prefix}'
628
629         else
630                 local_prefix=$prefix
631                 local_prefix_quote=$prefix
632         fi
633         echo $local_prefix_quote = $local_prefix
634         echo $dir
635         echo $dir  | sed 's!'$local_prefix'!\$local_prefix_quote!g'
636 ])
637
638 AC_DEFUN(AC_TEX_SUBDIR, [
639 dnl    AC_REQUIRE([AC_TEX_PREFIX])
640     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
641     $1="$TEXPREFIX/$$1"
642 ])
643
644 AC_DEFUN(AC_MF_SUBDIR, [
645 dnl     AC_REQUIRE([AC_TEX_PREFIX])
646     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
647     $1="$TEXPREFIX/$$1"
648 ])
649
650 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
651         result="`echo \"$1\" | grep echo`"
652         if test "x$1" = "xerror" -o "x$result" != "x"; then
653                 AC_STEPMAKE_WARN(can\'t find $2. $3)
654         fi
655 ])
656
657 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
658 dnl
659 dnl   This macro runs the `guile-config' script, installed with Guile,
660 dnl   to find out where Guile's header files and libraries are
661 dnl   installed.  It sets two variables, marked for substitution, as
662 dnl   by AC_SUBST.
663 dnl   
664 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
665 dnl             code that uses Guile header files.  This is almost
666 dnl             always just a -I flag.
667 dnl   
668 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
669 dnl             program against Guile.  This includes `-lguile' for
670 dnl             the Guile library itself, any libraries that Guile
671 dnl             itself requires (like -lqthreads), and so on.  It may
672 dnl             also include a -L flag to tell the compiler where to
673 dnl             find the libraries.
674
675 AC_DEFUN([GUILE_FLAGS],[
676 ## The GUILE_FLAGS macro.
677   ## First, let's just see if we can find Guile at all.
678   AC_MSG_CHECKING(for Guile)
679   guile-config link > /dev/null || {
680     echo "configure: cannot find guile-config; is Guile installed?" 1>&2
681     exit 1
682   }
683   GUILE_CFLAGS="`guile-config compile`"
684   GUILE_LDFLAGS="`guile-config link`"
685   AC_SUBST(GUILE_CFLAGS)
686   AC_SUBST(GUILE_LDFLAGS)
687   AC_MSG_RESULT(yes)
688 ])
689
690
691 # Configure paths for GTK+
692 # Owen Taylor     97-11-3
693
694 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
695 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
696 dnl
697 AC_DEFUN(AM_PATH_GTK,
698 [dnl 
699 dnl Get the cflags and libraries from the gtk-config script
700 dnl
701   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
702   min_gtk_version=ifelse([$1], ,1.1.1,$1)
703   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
704   no_gtk=""
705   if test "$GTK_CONFIG" != "no" ; then
706     GTK_CFLAGS=`$GTK_CONFIG --cflags`
707     GTK_LIBS=`$GTK_CONFIG --libs`
708     ac_save_CFLAGS="$CFLAGS"
709     ac_save_LIBS="$LIBS"
710     ac_save_CXXFLAGS="$CXXFLAGS"
711     CFLAGS="$CFLAGS $GTK_CFLAGS"
712     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
713     LIBS="$LIBS $GTK_LIBS"
714 dnl
715 dnl Now check if the installed GTK is sufficiently new. (Also sanity
716 dnl checks the results of gtk-config to some extent)
717 dnl
718     AC_TRY_RUN([
719 #include <gtk/gtk.h>
720 #include <stdio.h>
721
722 int 
723 main ()
724 {
725   int major, minor, micro;
726
727   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
728      printf("%s, bad version string\n", "$min_gtk_version");
729      exit(1);
730    }
731
732    return !((gtk_major_version > major) ||
733             ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
734             ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
735 }
736 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
737      CFLAGS="$ac_save_CFLAGS"
738      CXXFLAGS="$ac_save_CXXFLAGS"
739      LIBS="$ac_save_LIBS"
740   else
741      no_gtk=yes
742   fi
743   if test "x$no_gtk" = x ; then
744      AC_MSG_RESULT(yes)
745      ifelse([$2], , :, [$2])     
746   else
747      AC_MSG_RESULT(no)
748      GTK_CFLAGS=""
749      GTK_LIBS=""
750      ifelse([$3], , :, [$3])
751   fi
752   CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
753   AC_SUBST(CXXFLAGS)
754   AC_SUBST(GTK_CFLAGS)
755   AC_SUBST(GTK_LIBS)
756 ])
757
758
759 # Configure paths for GTK--
760 # Erik Andersen 30 May 1998
761 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
762
763 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
764 dnl   to be used as follows:
765 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
766 dnl
767
768 dnl Get the cflags and libraries from the gtkmm-config script
769 dnl
770 AC_ARG_WITH(gtkmm-prefix,[  --with-gtkmm-prefix=PREFIX
771                           Prefix where GTK-- is installed (optional)],
772             gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
773 AC_ARG_WITH(gtkmm-exec-prefix,[  --with-gtkmm-exec-prefix=PREFIX
774                           Exec prefix where GTK-- is installed (optional)],
775             gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
776 AC_ARG_ENABLE(gtkmmtest, [  --disable-gtkmmtest     Do not try to compile and run a test GTK-- program],
777                     , enable_gtkmmtest=yes)
778
779   if test x$gtkmm_config_exec_prefix != x ; then
780      gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
781      if test x${GTKMM_CONFIG+set} != xset ; then
782         GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
783      fi
784   fi
785   if test x$gtkmm_config_prefix != x ; then
786      gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
787      if test x${GTKMM_CONFIG+set} != xset ; then
788         GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
789      fi
790   fi
791
792
793 AC_DEFUN(AM_PATH_GTKMM,
794 [dnl 
795
796 dnl
797 dnl Check if the installed GTK-- is sufficiently new.
798 dnl
799   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
800   min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
801
802   AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
803   no_gtkmm=""
804   if test "$GTKMM_CONFIG" = "no" ; then
805     no_gtkmm=yes
806   else
807     AC_LANG_SAVE
808     AC_LANG_CPLUSPLUS
809
810     GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
811     GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
812     gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
813            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
814     gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
815            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
816     gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
817            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
818     if test "x$enable_gtkmmtest" = "xyes" ; then
819       ac_save_CXXFLAGS="$CXXFLAGS"
820       ac_save_LIBS="$LIBS"
821       CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
822       LIBS="$LIBS $GTK___LIBS"
823 dnl
824 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
825 dnl checks the results of gtkmm-config to some extent
826 dnl
827       rm -f conf.gtkmmtest
828       AC_TRY_RUN([
829 #include <gtk--.h>
830 #include <stdio.h>
831 #include <stdlib.h>
832
833 int 
834 main ()
835 {
836   int major, minor, micro;
837   char *tmp_version;
838
839   system ("touch conf.gtkmmtest");
840
841   /* HP/UX 0 (%@#!) writes to sscanf strings */
842   tmp_version = g_strdup("$min_gtkmm_version");
843   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
844      printf("%s, bad version string\n", "$min_gtkmm_version");
845      exit(1);
846    }
847
848   if ((gtkmm_major_version != $gtkmm_config_major_version) ||
849       (gtkmm_minor_version != $gtkmm_config_minor_version) ||
850       (gtkmm_micro_version != $gtkmm_config_micro_version))
851     {
852       printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", 
853              $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
854              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
855       printf ("*** was found! If gtkmm-config was correct, then it is best\n");
856       printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
857       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
858       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
859       printf("*** required on your system.\n");
860       printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
861       printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
862       printf("*** before re-running configure\n");
863     } 
864 /* GTK-- does not have the GTKMM_*_VERSION constants */
865 /* 
866   else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
867            (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
868            (gtkmm_micro_version != GTKMM_MICRO_VERSION))
869     {
870       printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
871              GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
872       printf("*** library (version %d.%d.%d)\n",
873              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
874     }
875 */
876   else
877     {
878       if ((gtkmm_major_version > major) ||
879         ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
880         ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
881       {
882         return 0;
883        }
884      else
885       {
886         printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
887                gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
888         printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
889                major, minor, micro);
890         printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
891         printf("***\n");
892         printf("*** If you have already installed a sufficiently new version, this error\n");
893         printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
894         printf("*** being found. The easiest way to fix this is to remove the old version\n");
895         printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
896         printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
897         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
898         printf("*** so that the correct libraries are found at run-time))\n");
899       }
900     }
901   return 1;
902 }
903 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
904        CXXFLAGS="$ac_save_CXXFLAGS"
905        LIBS="$ac_save_LIBS"
906      fi
907   fi
908   if test "x$no_gtkmm" = x ; then
909      AC_MSG_RESULT(yes)
910      ifelse([$2], , :, [$2])     
911   else
912      AC_MSG_RESULT(no)
913      if test "$GTKMM_CONFIG" = "no" ; then
914        echo "*** The gtkmm-config script installed by GTK-- could not be found"
915        echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
916        echo "*** your path, or set the GTK_CONFIG environment variable to the"
917        echo "*** full path to gtk-config."
918        echo "*** The gtkmm-config script was not available in GTK-- versions"
919        echo "*** prior to 0.9.12. Perhaps you need to update your installed"
920        echo "*** version to 0.9.12 or newer"
921      else
922        if test -f conf.gtkmmtest ; then
923         :
924        else
925           echo "*** Could not run GTK-- test program, checking why..."
926           CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
927           LIBS="$LIBS $GTK___LIBS"
928           AC_TRY_LINK([
929 #include <gtk--.h>
930 #include <stdio.h>
931 ],      [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
932         [ echo "*** The test program compiled, but did not run. This usually means"
933           echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
934           echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
935           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
936           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
937           echo "*** is required on your system"
938           echo "***"
939           echo "*** If you have an old version installed, it is best to remove it, although"
940           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
941         [ echo "*** The test program failed to compile or link. See the file config.log for the"
942           echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
943           echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
944           echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
945           CXXFLAGS="$ac_save_CXXFLAGS"
946           LIBS="$ac_save_LIBS"
947        fi
948      fi
949      GTK___CFLAGS=""
950      GTK__LIBS=""
951      ifelse([$3], , :, [$3])
952      AC_LANG_RESTORE
953   fi
954   AC_SUBST(GTK___CFLAGS)
955   AC_SUBST(GTK___LIBS)
956   rm -f conf.gtkmmtest
957 ])
958
959 # Configure paths for GTK--DRAW
960 # Derek Quinn Wyatt   98-08-21  (adapted from Jan Nieuwenhuizen's code)
961
962 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
963 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
964 dnl
965 AC_DEFUN(AM_PATH_GTK__DRAW,
966 [dnl 
967 dnl Get the cflags and libraries from the gtk__-config script
968 dnl
969   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
970   min_gtk___version=ifelse([$1], ,0.0.5,$1)
971   AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
972   no_gtk__=""
973   if test "$GTKMM_CONFIG" != "no" ; then
974     GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
975     GTK___LIBS=`$GTKMM_CONFIG --libs`
976     GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
977     GTK___LIBS="$GTK___DLIBS"
978     ac_save_CFLAGS="$CFLAGS"
979     ac_save_LIBS="$LIBS"
980     ac_save_CXXFLAGS="$CXXFLAGS"
981     CFLAGS="$CFLAGS $GTK___CFLAGS"
982     CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
983     LIBS="$LIBS $GTK___LIBS"
984 dnl
985 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
986 dnl checks the results of gtk__-config to some extent)
987 dnl
988     AC_TRY_RUN([
989 #include <gtk--.h>
990 #include <stdio.h>
991
992 int 
993 main ()
994 {
995   // urg
996   return 0;
997 }
998 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
999      CFLAGS="$ac_save_CFLAGS"
1000      CXXFLAGS="$ac_save_CXXFLAGS"
1001      LIBS="$ac_save_LIBS"
1002   else
1003      no_gtk__=yes
1004   fi
1005   if test "x$no_gtk__" = x ; then
1006      AC_MSG_RESULT(yes)
1007      ifelse([$2], , :, [$2])     
1008   else
1009      AC_MSG_RESULT(no)
1010      GTK___CFLAGS=""
1011      GTK___LIBS=""
1012      ifelse([$3], , :, [$3])
1013   fi
1014   CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1015   AC_SUBST(CXXFLAGS)
1016   AC_SUBST(GTK___CFLAGS)
1017   AC_SUBST(GTK___LIBS)
1018 ])
1019
1020 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
1021 dnl
1022 dnl   This macro runs the `guile-config' script, installed with Guile,
1023 dnl   to find out where Guile's header files and libraries are
1024 dnl   installed.  It sets two variables, marked for substitution, as
1025 dnl   by AC_SUBST.
1026 dnl   
1027 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
1028 dnl             code that uses Guile header files.  This is almost
1029 dnl             always just a -I flag.
1030 dnl   
1031 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
1032 dnl             program against Guile.  This includes `-lguile' for
1033 dnl             the Guile library itself, any libraries that Guile
1034 dnl             itself requires (like -lqthreads), and so on.  It may
1035 dnl             also include a -L flag to tell the compiler where to
1036 dnl             find the libraries.
1037
1038 AC_DEFUN([GUILE_FLAGS],[
1039 ## The GUILE_FLAGS macro.
1040   ## First, let's just see if we can find Guile at all.
1041   AC_MSG_CHECKING(for Guile)
1042   guile-config link > /dev/null || {
1043     echo "configure: cannot find guile-config; is Guile installed?" 1>&2
1044     exit 1
1045   }
1046   GUILE_CFLAGS="`guile-config compile`"
1047   GUILE_LDFLAGS="`guile-config link`"
1048   AC_SUBST(GUILE_CFLAGS)
1049   AC_SUBST(GUILE_LDFLAGS)
1050   AC_MSG_RESULT(yes)
1051 ])
1052