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