forked from sile-typesetter/sile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
267 lines (224 loc) · 9.24 KB
/
configure.ac
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
264
265
266
267
AC_PREREQ([2.69])
AC_INIT([sile], [m4_esyscmd(build-aux/git-version-gen .tarball-version)], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign tar-pax dist-xz dist-zip no-dist-gzip color-tests subdir-objects])
AM_SILENT_RULES([yes])
AM_CONDITIONAL([IS_SDIST], [test ! -e .gitignore])
# Checks for programs.
AC_PROG_CC
AC_PROG_OBJC
AC_PROG_AWK
AC_PROG_GREP
AC_PROG_SED
AX_PROGVAR([cmp])
AX_PROGVAR([git])
AX_PROGVAR([find])
LT_PREREQ([2.2])
LT_INIT([dlopen])
AC_CANONICAL_HOST
AC_ARG_ENABLE([dependency-checks],
AS_HELP_STRING([--disable-dependency-checks],
[Disable dependency checks]))
AM_CONDITIONAL([DEPENDENCY_CHECKS], [test "x$enable_dependency_checks" != "xno"])
AC_ARG_ENABLE([developer],
AS_HELP_STRING([--enable-developer],
[Check for and enable tooling required only for developers]))
AM_CONDITIONAL([DEVELOPER], [test "x$enable_developer" = "xyes"])
AC_ARG_ENABLE([font-variations],
AS_HELP_STRING([--disable-font-variations],
[Disable support for OpenType variations and variable fonts that requires HarfBuzz subsetter library]))
AM_CONDITIONAL([FONT_VARIATIONS], [test "x$enable_font_variations" != "xno"])
AC_ARG_ENABLE([linklua],
AS_HELP_STRING([--disable-linklua],
[Don’t link lua library with dylibs]))
AM_CONDITIONAL([LINKLUA], [test "x$enable_linklua" != "xno"])
# TODO: Refactor fontconfig check to allow Appkit/DirectWrite as alternatives, maybe default to off on Darwin
# AC_ARG_WITH([fontconfig],
# AS_HELP_STRING([--without-fontconfig],
# [Compile without fontconfig font manager support]))
AM_CONDITIONAL([FONTCONFIG], [test "x$with_fontconfig" != "xno"])
AC_ARG_WITH([harfbuzz],
AS_HELP_STRING([--without-harfbuzz],
[Compile without HarfBuzz support used as default shaping backend]))
AM_CONDITIONAL([HARFBUZZ], [test "x$with_harfbuzz" != "xno"])
AC_ARG_WITH([system-libtexpdf],
AS_HELP_STRING([--with-system-libtexpdf],
[Don’t bundle libtexpdf, use system provided version]))
AM_CONDITIONAL([SYSTEM_LIBTEXPDF], [test "x$with_system_libtexpdf" = "xyes"])
AC_ARG_WITH([system-luarocks],
AS_HELP_STRING([--with-system-luarocks],
[Don’t bundle LuaRocks, use system provided versions]))
AM_CONDITIONAL([SYSTEM_LUAROCKS], [test "x$with_system_luarocks" = "xyes"])
AC_SUBST([SYSTEM_LUAROCKS])
AC_ARG_WITH([luajit],
AS_HELP_STRING([--with-luajit],
[Run under LuaJIT instead of Lua]))
AM_CONDITIONAL([LUAJIT], [test "x$with_luajit" = "xyes"])
AC_ARG_WITH([manual],
AS_HELP_STRING([--with-manual],
[Rebuild manual and install to system’s PDF documentation directory]))
AM_CONDITIONAL([MANUAL], [test "x$with_manual" = "xyes"])
AM_CONDITIONAL([FONT_DOWNLOAD_TOOLS], [test -z ${DEVELOPER_TRUE} || (test -z ${MANUAL_TRUE} && test -z ${IS_SDIST_FALSE})])
AC_SUBST([FONT_DOWNLOAD_TOOLS])
AM_COND_IF([DEPENDENCY_CHECKS], [
AX_FONT(Gentium Plus)
AM_COND_IF([MANUAL], [
AC_PATH_PROG([DOT], [dot])
AC_PATH_PROG([GS], [gs])
])
AC_PATH_PROG([PDFINFO], [pdfinfo])
AC_MSG_CHECKING([for OS X])
have_appkit=no
case $host_os in
darwin*)
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for AppKit works])
save_LIBS="$LIBS"
LIBS="$LIBS -framework AppKit -fmodules"
AC_LANG_PUSH([Objective C])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[@import AppKit;]],[[]])],
[
have_appkit=yes
AC_MSG_RESULT([yes])
], [
have_appkit=no
AC_MSG_RESULT([no])
])
AC_LANG_POP([Objective C])
LIBS="$save_LIBS"
;;
*)
AC_MSG_RESULT([no])
;;
esac
AM_COND_IF([FONTCONFIG],
[PKG_CHECK_MODULES(FONTCONFIG, [fontconfig],
[],
[AC_MSG_FAILURE([Fontconfig package not found])])])
AM_COND_IF([HARFBUZZ],
[PKG_CHECK_MODULES(HARFBUZZ, [harfbuzz >= 2.7.4],
[],
[AC_MSG_FAILURE([--with-harfbuzz was given, but harfbuzz not found])]) ])
AM_COND_IF([FONT_VARIATIONS],
[PKG_CHECK_MODULES(HARFBUZZ_SUBSET, [harfbuzz-subset >= 6.0.0],
[AC_DEFINE(HAVE_HARFBUZZ_SUBSET, [1], [Have harfbuzz-subset library])],
[AC_MSG_FAILURE([--enable-font-variations was given, but harfbuzz version not new enough to include required subset library functions])])])
AM_COND_IF([SYSTEM_LIBTEXPDF],
[AC_CHECK_LIB([texpdf], [texpdf_doc_set_verbose],
[],
[AC_MSG_FAILURE([--with-system-libtexpdf was given, but test for libtexpdf failed])])],
[AC_CONFIG_SUBDIRS([libtexpdf])])
PKG_CHECK_MODULES(ICU, icu-uc icu-io, [
with_icu=yes
],[
AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
AC_MSG_CHECKING([for ICU by using icu-config fallback])
if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
ICU_LIBS=`icu-config --ldflags-libsonly --ldflags-icuio`
ICU_CFLAGS=`icu-config --cppflags`
with_icu=yes
AC_MSG_RESULT([yes])
else
AC_MSG_FAILURE([Required ICU library not found])
fi
])
AX_PROG_LUA([5.1])
AX_LUA_HEADERS
AX_LUA_LIBS
AM_COND_IF([SYSTEM_LUAROCKS], [
AS_IF([test "$LUA_SHORT_VERSION" -lt 52], [
AM_COND_IF([LUAJIT], [], [
AX_LUA_MODULE([bit32], [bit32])
])
])
AX_LUA_MODULE([cassowary], [cassowary])
AS_IF([test "$LUA_SHORT_VERSION" -lt 53],
AX_LUA_MODULE([compat53], [compat53])
)
AX_LUA_MODULE([cosmo], [cosmo])
AX_LUA_MODULE([cldr], [cldr])
AX_LUA_MODULE([fluent], [fluent])
AX_LUA_MODULE([linenoise], [linenoise])
AX_LUA_MODULE([loadkit], [loadkit])
AX_LUA_MODULE([lpeg], [lpeg])
AX_LUA_MODULE([zlib], [lua-zlib])
AX_LUA_MODULE([cliargs], [lua_cliargs])
AX_LUA_MODULE([epnf], [luaepnf])
AX_LUA_MODULE([lxp], [luaexpat])
AX_LUA_MODULE([lfs], [luafilesystem])
AX_LUA_MODULE([repl], [luarepl])
AX_LUA_MODULE([ssl], [luasec])
AX_LUA_MODULE([socket], [luasocket])
AX_LUA_MODULE([lua-utf8], [luautf8])
AX_LUA_MODULE([pl], [penlight])
AX_LUA_MODULE([vstruct], [vstruct])
], [
AX_PROGVAR([luarocks])
])
# Required for downloading fonts for the manual and for tests
# Since the source tarball includes a prebuilt manual we only need this for Git source builds
AM_COND_IF([FONT_DOWNLOAD_TOOLS], [
AX_PROGVAR([curl])
AX_PROGVAR([bsdtar])
])
AM_COND_IF([DEVELOPER], [
AX_PROGVAR([busted])
AX_PROGVAR([luacheck])
AX_PROGVAR([luarocks])
AX_PROGVAR([nix])
AX_PROGVAR([perl])
])
])
AM_CONDITIONAL([APPKIT], [test "x$have_appkit" = "xyes"])
AM_CONDITIONAL([ICU], [test "x$with_icu" = "xyes"])
AC_SUBST([APPKIT_TRUE])
AC_SUBST([FONTCONFIG_TRUE])
AC_SUBST([FONT_VARIATIONS_TRUE])
AC_SUBST([HARFBUZZ_TRUE])
AC_SUBST([HARFBUZZ_CFLAGS])
AC_SUBST([HARFBUZZ_LIBS])
AC_SUBST([HARFBUZZ_SUBSET_CFLAGS])
AC_SUBST([HARFBUZZ_SUBSET_LIBS])
AC_SUBST([ICU_TRUE])
AC_SUBST([ICU_CFLAGS])
AC_SUBST([ICU_LIBS])
case $host_os in
darwin*)
LUAROCKSARGS="EXPAT_DIR=/usr/local/opt/expat OPENSSL_DIR=/usr/local/opt/openssl ZLIB_DIR=/usr/local/opt/zlib"
SHARED_LIB_EXT="so"
;;
cygwin*|mingw*)
SHARED_LIB_EXT="dll"
;;
*)
SHARED_LIB_EXT="so"
;;
esac
AC_SUBST([SHARED_LIB_EXT])
AC_SUBST([LUAROCKSARGS])
AX_SUBST_TRANSFORMED_PACKAGE_NAME
# Avoid need for `--datarootdir=$(cd ..; pwd)` hack to run locally for
# tests/manual build when developer mode is enabled
AM_COND_IF([DEVELOPER], [
adl_RECURSIVE_EVAL(["$(pwd)"], [SILE_PATH])
datarootdir="$(cd ..; pwd)"
],[
adl_RECURSIVE_EVAL(["${datadir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_PATH])
])
AC_DEFINE_UNQUOTED([SILE_PATH],["${SILE_PATH}"],[Path for SILE packages and classes])
AC_SUBST([SILE_PATH])
adl_RECURSIVE_EVAL(["${libdir}/${TRANSFORMED_PACKAGE_NAME}"], [SILE_LIB_PATH])
AC_DEFINE_UNQUOTED([SILE_LIB_PATH],["${SILE_LIB_PATH}"],[Path for SILE libraries])
AC_SUBST([SILE_LIB_PATH])
AC_SUBST([ROCKSPECWARNING], ["DO NOT EDIT! Modify template sile.rockspec.in"])
AC_SUBST([ROCKREV], [1])
AX_SUBST_MAN_DATE
AC_CONFIG_FILES([build-aux/list-dist-files.sh], [chmod +x build-aux/list-dist-files.sh])
AC_CONFIG_FILES([Makefile src/Makefile sile.1 core/features.lua core/pathsetup.lua core/version.lua])
AC_CONFIG_FILES([sile tests/regressions.pl], [chmod +x sile tests/regressions.pl])
AC_CONFIG_FILES([sile-dev-1.rockspec:sile.rockspec.in])
AC_ARG_PROGRAM
AC_OUTPUT
AC_MSG_NOTICE([monkey-patching configure to ignore core directory])
m4_esyscmd_s([build-aux/decore-automake.sh])