summaryrefslogtreecommitdiff
path: root/fonts/thai/fonts-tlwg/configure.ac
blob: 4f4979e94c9aeb8a6cff69f6a5951e870ae1b0a1 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
AC_PREREQ(2.59)
AC_INIT(fonts-tlwg,
        m4_esyscmd([build-aux/git-version-gen]),
        [https://github.com/tlwg/fonts-tlwg/issues])
AC_CONFIG_SRCDIR([nf/Garuda.sfd])

AM_INIT_AUTOMAKE(dist-xz no-dist-gzip -Wno-portability)

FONTFORGE_MIN_VER=20190801

LATEX_PACKAGE="fonts-tlwg"
AC_SUBST(LATEX_PACKAGE)

dnl
dnl Check options
dnl
AC_ARG_ENABLE(ttf,
              [AC_HELP_STRING([--enable-ttf],
                              [enable TTF generation])],
              , enable_ttf="no")
if test "x$enable_ttf" = "xyes"; then
  dnl TTF generation requires "fontforge" python module
  AM_PATH_PYTHON([3.7])
  AX_PYTHON_MODULE([fontforge],[fatal])

  dnl Check TTF installation dir
  AC_ARG_WITH(ttfdir,
    [AC_HELP_STRING([--with-ttfdir=DIR],
                    [font directory in DIR [PREFIX/share/fonts/truetype/thai]])],
    [ttfdir="$withval"], [ttfdir=\$\{prefix\}/share/fonts/truetype/thai])
  AC_MSG_CHECKING(--with-ttfdir)
  AC_MSG_RESULT("$ttfdir")

  AC_SUBST(ttfdir)
fi

AC_ARG_ENABLE(pfb,
              [AC_HELP_STRING([--enable-pfb],
                              [enable Type1 PFB generation])],
              , enable_pfb="no")
if test "x$enable_pfb" = "xyes"; then
  AC_ARG_WITH(type1dir,
    [AC_HELP_STRING([--with-type1dir=DIR],
                    [font directory in DIR [PREFIX/share/fonts/type1/thai]])],
    [type1dir="$withval"], [type1dir=\$\{prefix\}/share/fonts/type1/thai])
  AC_MSG_CHECKING(--with-type1dir)
  AC_MSG_RESULT("$type1dir")

  AC_SUBST(type1dir)
fi

AC_ARG_ENABLE(otf,
              [AC_HELP_STRING([--disable-otf],
                              [disable OTF generation])],
              , enable_otf="yes")
if test "x$enable_otf" = "xyes"; then
  AC_ARG_WITH(otfdir,
    [AC_HELP_STRING([--with-otfdir=DIR],
                    [font directory in DIR [PREFIX/share/fonts/opentype/thai]])],
    [otfdir="$withval"], [otfdir=\$\{prefix\}/share/fonts/opentype/thai])
  AC_MSG_CHECKING(--with-otfdir)
  AC_MSG_RESULT("$otfdir")

  AC_SUBST(otfdir)
fi

AC_ARG_ENABLE(woff,
              [AC_HELP_STRING([--enable-woff],
                              [enable Web Open Font Format generation])],
              , enable_woff="no")
if test "x$enable_woff" = "xyes"; then
  AC_ARG_WITH(woffdir,
    [AC_HELP_STRING([--with-woffdir=DIR],
                    [font directory in DIR [PREFIX/share/fonts/woff/thai]])],
    [woffdir="$withval"], [woffdir=\$\{prefix\}/share/fonts/woff/thai])
  AC_MSG_CHECKING(--with-woffdir)
  AC_MSG_RESULT("$woffdir")

  AC_SUBST(woffdir)
fi

AC_ARG_ENABLE(testfont,
              [AC_HELP_STRING([--enable-testfont],
                              [enable font generation with prefix {TTF,OTF,PS}])],
              , enable_testfont="no")
if test "x$enable_testfont" = "xyes"; then
  dnl Test TTF generation requires "fontforge" python module
  AM_PATH_PYTHON([3.7])
  AX_PYTHON_MODULE([fontforge],[fatal])

  AC_ARG_WITH(testfontdir,
    [AC_HELP_STRING([--with-testfontdir=DIR],
                    [font directory in DIR [$HOME/.fonts/testfont]])],
    [testfontdir="$withval"], [testfontdir=\$\{HOME\}/.fonts/testfont])
  AC_MSG_CHECKING(--with-testfontdir)
  AC_MSG_RESULT("$testfontdir")

  AC_SUBST(testfontdir)
fi


AC_ARG_ENABLE(xfontsdir,
              [AC_HELP_STRING([--enable-xfontsdir],
                              [enable X font index generation])],
              , enable_xfontsdir="no")

AC_ARG_ENABLE(latex,
              [AC_HELP_STRING([--enable-latex],
                              [enable LaTeX fonts generation])],
              , enable_latex="no")

AM_CONDITIONAL(INCLUDE_TTF,test $enable_ttf = "yes")
AM_CONDITIONAL(INCLUDE_PFB,test $enable_pfb = "yes")
AM_CONDITIONAL(INCLUDE_OTF,test $enable_otf = "yes")
AM_CONDITIONAL(INCLUDE_WOFF,test $enable_woff = "yes")
AM_CONDITIONAL(INCLUDE_TESTFONT,test $enable_testfont = "yes")

AM_CONDITIONAL(INCLUDE_XFONTSDIR,test $enable_xfontsdir = "yes")

AM_CONDITIONAL(INCLUDE_LATEX,test $enable_latex = "yes")

dnl
dnl Check Programs
dnl
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_SED
AC_CHECK_PROGS(RMDIR,rmdir,no)

AC_CHECK_PROGS(FONTFORGE,fontforge,no)

if test "x$FONTFORGE" = "xno"; then
  AC_MSG_ERROR([You need fontforge to generate fonts.])
else
  AC_MSG_CHECKING([for Fontforge >= $FONTFORGE_MIN_VER])
  FONTFORGE_VER=$($FONTFORGE --version 2>/dev/null | grep '^fontforge' | sed 's/fontforge //')
  FONTFORGE_VER=$(TZ=UTC date -d "$FONTFORGE_VER" "+%Y%m%d")
  if test $FONTFORGE_VER -lt $FONTFORGE_MIN_VER; then
    AC_MSG_ERROR([Requires Fontforge >= $FONTFORGE_MIN_VER but $FONTFORGE_VER was found)])
  fi
  AC_MSG_RESULT([$FONTFORGE_VER found, ok])
fi

if test "x$enable_xfontsdir" = "xno"; then
  AC_MSG_NOTICE([X fonts dir not enabled, skipping checks for X fonts utils])
else
  dnl
  dnl Begin checking X fonts utils
  dnl

  dnl prefer mkfontscale over ttmkfdir
  AC_CHECK_PROG(MKFONTSCALE,mkfontscale,mkfontscale)

  # xorg or xfree86?
  if test "x$MKFONTSCALE" = "xmkfontscale"; then
    if $MKFONTSCALE -n >/dev/null 2>&1; then
      # xorg's mkfontscale
      MKFONTSCALE="mkfontscale -a tis620-0 -a tis620-2"
      rm -f fonts.scale encodings.dir
    else
      # xfree86's mkfontscale
      MKFONTSCALE="mkfontscale -e tis620-0 -e tis620-2"
    fi
  fi

  if test "x$enable_ttf" = "xyes"; then
    if test "x$MKFONTSCALE" = "x"; then
      AC_CHECK_PROG(TTMKFDIR,ttmkfdir,ttmkfdir)
      if test "x$TTMKFDIR" = "x"; then
        AC_MSG_ERROR([You need mkfontscale or ttmkfdir])
      else
        if (ttmkfdir -h 2>&1 | grep -- --encoding >/dev/null); then
          # ttmkfdir 2
          TTMKFDIR="ttmkfdir -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir -o fonts.scale"
        else
          # ttmkfdir 1
          TTMKFDIR="ttmkfdir > fonts.scale"
        fi
      fi
    else
      TTMKFDIR="$MKFONTSCALE"
    fi
    AC_MSG_RESULT([Will create fonts.scale for TTF using $TTMKFDIR])
  fi

  if test "x$enable_pfb" = "xyes"; then
    if test "x$MKFONTSCALE" = "x"; then
      AC_CHECK_PROG(TYPE1INST,type1inst,type1inst)
      if test "x$TYPE1INST" = "x"; then
        AC_MSG_ERROR([You need mkfontscale or type1inst])
      fi
    else
      TYPE1INST="$MKFONTSCALE"
    fi
    AC_MSG_RESULT([Will create fonts.scale for Type1 using $TYPE1INST])
  fi

  dnl Check for mkfontdir and encoding path
  AC_CHECK_PROG(MKFONTDIR,mkfontdir,mkfontdir)
  ENCPATH="/usr/share/fonts/X11/encodings \
           /usr/X11R6/lib/X11/fonts/encodings"
  ENCDIR=
  for dir in $ENCPATH; do
    if test -d $dir; then
      ENCDIR=$dir
      break
    fi
  done
  if test "x$MKFONTDIR" = "xmkfontdir" && test "x$ENCDIR" != "x"; then
    MKFONTDIR="$MKFONTDIR -e $ENCDIR"
  fi
  AC_MSG_RESULT([Will create fonts.dir using $MKFONTDIR])

  AC_CHECK_PROG(FCCACHE,fc-cache,[fc-cache])

  dnl
  dnl End checking X fonts utils
  dnl
fi

if test "x$enable_latex" = "xyes"; then
  AC_CHECK_PROGS(AFM2TFM,afm2tfm,no)
  if test "x$AFM2TFM" = "xno" ; then
    AC_MSG_ERROR([You need afm2tfm (from texlive distribution)])
  fi
  AC_CHECK_PROGS(VPTOVF,vptovf,no)
  if test "x$VPTOVF" = "xno" ; then
    AC_MSG_ERROR([You need vptovf (from texlive distribution)])
  fi

  AC_ARG_WITH(texmfdir,
    [AC_HELP_STRING([--with-texmfdir=DIR],
                    [texmf directory in DIR [PREFIX/share/texmf]])],
    [texmfdir="$withval"], [texmfdir=${datarootdir}/texmf])
  AC_MSG_CHECKING(--with-texmfdir)
  AC_MSG_RESULT("$texmfdir")                                                                                                           
  AC_SUBST(texmfdir)

  AC_PATH_PROGS(UPDMAP,[updmap-sys updmap],no)
  if test "x$UPDMAP" = "xno" ; then
    AC_MSG_ERROR([You need updmap-sys or updmap (from texlive distribution)])
  fi

  AC_PATH_PROG(TEXHASH,[mktexlsr texhash],no)
  if test "x$TEXHASH" = "xno" ; then
    AC_MSG_ERROR([You need mktexlsr or texhash (from texlive distribution)])
  fi
fi


AC_OUTPUT(
  Makefile
  nf/Makefile
  nectec/Makefile
  sipa/Makefile
  tlwg/Makefile
  scripts/Makefile
  fontconfig/Makefile
  latex/Makefile
  latex/examples/Makefile
  tests/Makefile
)