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