dvitomp fix from Akira
[mplib] / src / texk / kpathsea / withenable.ac
1 dnl withenable.ac: --with and --enable options.
2
3 dnl --enable-maintainer-mode as implemented in automake.
4 AM_MAINTAINER_MODE
5
6 dnl These are standard among *NIX systems, but not when cross-compiling
7 AC_DEFUN([CF_SUBST],
8 [AC_MSG_CHECKING(for $1 (symbol $2))
9 AC_CACHE_VAL(cf_cv_subst_$2,[
10 test -z "[$]$2" && $2=$3
11 cf_cv_subst_$2=[$]$2])
12 $2=${cf_cv_subst_$2}
13 AC_MSG_RESULT([$]$2)
14 AC_SUBST($2)
15 ])dnl
16 CF_SUBST(loader,LD,ld)
17 CF_SUBST(archiver,AR,ar)
18 CF_SUBST(archiver options,ARFLAGS,rc)
19
20 AC_ARG_WITH([mktexmf-default],
21 [  --without-mktexmf-default    do not run mktexmf if MF source missing],
22   , [with_mktexmf_default=yes])
23 AC_ARG_WITH([mktexpk-default],
24 [  --without-mktexpk-default    do not run mktexpk if PK font missing],
25   , [with_mktexpk_default=yes])
26 AC_ARG_WITH([mktextfm-default],
27 [  --without-mktextfm-default   do not run mktextfm if TFM file missing],
28    , [with_mktextfm_default=yes])
29 AC_ARG_WITH([mkocp-default],
30 [  --without-mkocp-default      do not run mkocp if OCP file missing],
31    , [with_mkocp_default=yes])
32 AC_ARG_WITH([mkofm-default],
33 [  --without-mkofm-default      do not run mkofm if OFM file missing],
34    , [with_mkofm_default=yes])
35 AC_ARG_WITH([mktexfmt-default],
36 [  --with-mktexfmt-default      run mktexfmt if format file missing])
37 AC_ARG_WITH([mktextex-default],
38 [  --with-mktextex-default      run mktextex if TeX source missing],
39   [with_mktextex_default=yes], [with_mktextex_default=no])
40
41 dnl Check whether we can find a texmf tree.  Look at the most common spots.
42 dnl Not a switch, but something that must be included everywhere, even at
43 dnl at the top level, so putting it in common.ac is not enough.
44 AC_MSG_CHECKING(where the main texmf tree is located)
45 case $prefix in
46   */) prefix=`echo "$prefix" | sed 's@/*$@@'`;;
47 esac
48 texmfmain=
49 if test "x$datadir" != 'x${prefix}/share'; then
50   # First case, datadir is defined...
51   eval p=\"$datadir\"
52   # Unconditionally set the directory, but...
53   texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'`
54   # ... do complain if it wasn't found.
55   if test -d "$texmfmain"; then
56     AC_MSG_RESULT("$texmfmain")
57   else
58     true # be silent dnl AC_MSG_RESULT([not found])
59   fi
60 else
61   # Second case, datadir is default...
62   if test "x$prefix" = "xNONE"; then
63     p="$ac_default_prefix"
64   else
65     eval p=\"$prefix\"
66   fi
67   for e in share/texmf lib/texmf texmf; do
68     if test -d "$p/$e"; then
69       texmfmain='${prefix}'/"$e"
70       break
71     fi
72   done
73   if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then
74      # Still no texmfmain found, no prefix set, perhaps kpsewhich is
75      # installed and can help us out.
76      texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null
77   fi
78   texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'`
79   if test -n "$texmfmain"; then
80     AC_MSG_RESULT("$texmfmain")
81   else
82     eval texmfmain="$datadir/texmf"
83     # (be silent) dnl AC_MSG_RESULT([not found])
84   fi
85 fi
86 AC_SUBST(texmfmain)