summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/withenable.ac
blob: b0010cd7a3b0289c97129656d90bbfb1614f7e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
dnl withenable.ac: --with and --enable options.

dnl --enable-maintainer-mode as implemented in automake.
AM_MAINTAINER_MODE

dnl These are standard among *NIX systems, but not when cross-compiling
AC_DEFUN([CF_SUBST],
[AC_MSG_CHECKING(for $1 (symbol $2))
AC_CACHE_VAL(cf_cv_subst_$2,[
test -z "[$]$2" && $2=$3
cf_cv_subst_$2=[$]$2])
$2=${cf_cv_subst_$2}
AC_MSG_RESULT([$]$2)
AC_SUBST($2)
])dnl
CF_SUBST(loader,LD,ld)
CF_SUBST(archiver,AR,ar)
CF_SUBST(archiver options,ARFLAGS,rc)

AC_ARG_WITH([mktexmf-default],
[  --without-mktexmf-default    do not run mktexmf if MF source missing],
  , [with_mktexmf_default=yes])
AC_ARG_WITH([mktexpk-default],
[  --without-mktexpk-default    do not run mktexpk if PK font missing],
  , [with_mktexpk_default=yes])
AC_ARG_WITH([mktextfm-default],
[  --without-mktextfm-default   do not run mktextfm if TFM file missing],
   , [with_mktextfm_default=yes])
AC_ARG_WITH([mkocp-default],
[  --without-mkocp-default      do not run mkocp if OCP file missing],
   , [with_mkocp_default=yes])
AC_ARG_WITH([mkofm-default],
[  --without-mkofm-default      do not run mkofm if OFM file missing],
   , [with_mkofm_default=yes])
AC_ARG_WITH([mktexfmt-default],
[  --with-mktexfmt-default      run mktexfmt if format file missing])
AC_ARG_WITH([mktextex-default],
[  --with-mktextex-default      run mktextex if TeX source missing],
  [with_mktextex_default=yes], [with_mktextex_default=no])

dnl Check whether we can find a texmf tree.  Look at the most common spots.
dnl Not a switch, but something that must be included everywhere, even at
dnl at the top level, so putting it in common.ac is not enough.
AC_MSG_CHECKING(where the main texmf tree is located)
case $prefix in
  */) prefix=`echo "$prefix" | sed 's@/*$@@'`;;
esac
texmfmain=
if test "x$datadir" != 'x${prefix}/share'; then
  # First case, datadir is defined...
  eval p=\"$datadir\"
  # Unconditionally set the directory, but...
  texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'`
  # ... do complain if it wasn't found.
  if test -d "$texmfmain"; then
    AC_MSG_RESULT("$texmfmain")
  else
    AC_MSG_RESULT([not found])
    AC_MSG_WARN([No texmf tree found at $texmfmain.
  *****************************************************************
  * Error: The main texmf tree was not found.                     *
  * If you do not have the files, you should be able to them from *
  * the same place you got these sources from, or from one of the *
  * CTAN hosts.                                                   *
  *****************************************************************
  Winging it.])
  fi
else
  # Second case, datadir is default...
  if test "x$prefix" = "xNONE"; then
    p="$ac_default_prefix"
  else
    eval p=\"$prefix\"
  fi
  for e in share/texmf lib/texmf texmf; do
    if test -d "$p/$e"; then
      texmfmain='${prefix}'/"$e"
      break
    fi
  done
  if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then
     # Still no texmfmain found, no prefix set, perhaps kpsewhich is
     # installed and can help us out.
     texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null
  fi
  texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'`
  if test -n "$texmfmain"; then
    AC_MSG_RESULT("$texmfmain")
  else
    eval texmfmain="$datadir/texmf"
    AC_MSG_RESULT([not found])
    AC_MSG_WARN([The main texmf tree was not found at $texmfmain.
  *****************************************************************
  * Error: The main texmf tree was not found.                     *
  * Use the --datadir option to specify its parent directory.     *
  * If you do not have the files, you should be able to them from *
  * the same place you got these sources from, or from one of the *
  * CTAN hosts.                                                   *
  *****************************************************************
  Winging it by pretending $texmfmain is correct.])
  fi
fi
AC_SUBST(texmfmain)