-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.ac
280 lines (254 loc) · 8.71 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
268
269
270
271
272
273
274
275
276
277
278
279
280
# Process this file with autoconf to create configure.
AC_PREREQ([2.65])
# ====================
# Version informations
# ====================
AC_INIT([braille-printer-app], [2.0b1], [https://github.com/OpenPrinting/braille-printer-app/issues], [braille-printer-app], [https://github.com/OpenPrinting/braille-printer-app/])
braille_printer_app_version="AC_PACKAGE_VERSION"
braille_printer_app_version_major="`echo AC_PACKAGE_VERSION | awk -F. '{print $1}'`"
braille_printer_app_version_major="`echo AC_PACKAGE_VERSION | awk -F. '{printf("%d\n",$2);}'`"
# =============
# Automake init
# =============
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/ac_define_dir.m4])
m4_include([m4/ax_compare_version.m4])
m4_include([m4/basic-directories.m4])
AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2 subdir-objects foreign])
AM_SILENT_RULES([yes])
AC_LANG([C])
AC_CONFIG_HEADERS([config.h])
# Extra defines for the config.h
AH_BOTTOM([
#ifdef HAVE_LONG_LONG
# define CUPS_LLFMT "%lld"
# define CUPS_LLCAST (long long)
#else
# define CUPS_LLFMT "%ld"
# define CUPS_LLCAST (long)
#endif /* HAVE_LONG_LONG */
#ifdef HAVE_ARC4RANDOM
# define CUPS_RAND() arc4random()
# define CUPS_SRAND(v) arc4random_stir()
#elif defined(HAVE_RANDOM)
# define CUPS_RAND() random()
# define CUPS_SRAND(v) srandom(v)
#elif defined(HAVE_LRAND48)
# define CUPS_RAND() lrand48()
# define CUPS_SRAND(v) srand48(v)
#else
# define CUPS_RAND() rand()
# define CUPS_SRAND(v) srand(v)
#endif /* HAVE_ARC4RANDOM */
])
# ===========================
# Find required base packages
# ===========================
AC_PROG_CC
AM_PROG_CC_C_O
AM_ICONV
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
LT_INIT
PKG_PROG_PKG_CONFIG([0.20])
AM_GNU_GETTEXT_VERSION([0.18.3])
AM_GNU_GETTEXT([external])
# ================================
# Find CUPS internals (no pc file)
# ================================
AC_ARG_WITH([cups-config],
[AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])],
[with_cups_config="$withval"],
[with_cups_config=system]
)
AS_IF([test "x$with_cups_config" != "xsystem"], [
CUPSCONFIG=$with_cups_config
], [
AC_PATH_TOOL(CUPSCONFIG, [cups-config])
])
AS_IF([test -z "$CUPSCONFIG" -o "$CUPSCONFIG" = no ], [
if ! $PKG_CONFIG --atleast-version 2.5 cups ; then
AC_MSG_ERROR([Missing cups-config or cups >= 2.5])
fi
CUPS_CFLAGS=`$PKG_CONFIG --cflags cups`
CUPS_LIBS=`$PKG_CONFIG --libs cups`
CUPS_VERSION=`$PKG_CONFIG --modversion cups`
CUPS_DATADIR=`$PKG_CONFIG --variable=cups_datadir cups`
CUPS_SERVERBIN=`$PKG_CONFIG --variable=cups_serverbin cups`
], [
CUPS_CFLAGS=`$CUPSCONFIG --cflags`
CUPS_LIBS=`$CUPSCONFIG --image --libs`
CUPS_VERSION=`$CUPSCONFIG --version`
AC_SUBST(CUPS_CFLAGS)
AC_SUBST(CUPS_LIBS)
CUPS_DATADIR="`$CUPSCONFIG --datadir`"
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir])
AC_SUBST(CUPS_DATADIR)
CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`"
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN", [Path to CUPS binaries dir])
AC_SUBST(CUPS_SERVERBIN)
])
PKG_CHECK_MODULES([LIBCUPSFILTERS], [libcupsfilters])
if ! $PKG_CONFIG --atleast-version 2.0 libcupsfilters ; then
AC_MSG_ERROR([libcupsfilters needs to be at least version 2.0])
fi
PKG_CHECK_MODULES([PAPPL], [pappl])
# ======================
# Check system functions
# ======================
AC_CHECK_FUNCS(sigaction)
AC_CHECK_FUNCS(waitpid wait3)
AC_CHECK_FUNCS(strtoll)
AC_CHECK_FUNCS(open_memstream)
AC_CHECK_FUNCS(getline,[],AC_SUBST([GETLINE],['bannertopdf-getline.$(OBJEXT)']))
AC_CHECK_FUNCS(strcasestr,[],AC_SUBST([STRCASESTR],['pdftops-strcasestr.$(OBJEXT)']))
AC_SEARCH_LIBS(pow, m)
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup strlcat strlcpy)
if test "$host_os_name" = "hp-ux" -a "$host_os_version" = "1020"; then
echo Forcing snprintf emulation for HP-UX.
else
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
# ========================
# Check for system headers
# ========================
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([zlib.h])
AC_CHECK_HEADERS([endian.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
# ===================================
# Check for large files and long long
# ===================================
AC_SYS_LARGEFILE
LARGEFILE=""
AS_IF([test x"$enable_largefile" != "xno"], [
LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
AS_IF([test x"$ac_cv_sys_large_files" = "x1"], [LARGEFILE="$LARGEFILE -D_LARGE_FILES"])
AS_IF([test x"$ac_cv_sys_file_offset_bits" = "x64"], [LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"])
])
AC_SUBST(LARGEFILE)
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
AS_IF([test x"$long_long_found" = "xyes"], [
AC_DEFINE([HAVE_LONG_LONG], [], [Platform supports long long type])
])
# ================
# Check for CFLAGS
# ================
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development.])],
[enable_werror="$enableval"],
[enable_werror=no]
)
AS_IF([test x"$enable_werror" = "xyes"], [
CFLAGS="$CFLAGS -Werror"
])
AS_IF([test x"$GCC" = "xyes"], [
# Be tough with warnings and produce less careless code
CFLAGS="$CFLAGS -Wall -std=gnu11"
CXXFLAGS="$CXXFLAGS -Wall " # -Weffc++" # TODO: enable when it does not print 1MB of warnings
])
CFLAGS="$CFLAGS -D_GNU_SOURCE"
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
# ==========================
# Braille embossing/liblouis
# ==========================
AC_ARG_ENABLE(braille, AS_HELP_STRING([--enable-braille],[enable Braille embosing filters, requires liblouis]),
enable_braille=$enableval,enable_braille=yes)
AC_MSG_CHECKING(for liblouis)
PKG_CHECK_EXISTS([liblouis], [
AC_MSG_RESULT(yes)
if test "x$enable_braille" = xyes; then
TABLESDIR=`$PKG_CONFIG --variable=tablesdir liblouis`
else
TABLESDIR=/usr/share/liblouis/tables
fi
], [
AC_MSG_RESULT(no)
TABLESDIR=/usr/share/liblouis/tables
])
AM_CONDITIONAL(ENABLE_BRAILLE, test "x$enable_braille" = xyes)
AC_SUBST(TABLESDIR)
PKG_CHECK_MODULES([LIBLOUISUTDML], [liblouisutdml], [
AC_DEFINE([HAVE_LIBLOUISUTDML], [1], [Define to 1 if you have the liblouisutdml library.])
])
# ================
# musicxml support
# ================
AC_ARG_ENABLE(musicxml, AS_HELP_STRING([--enable-musicxml],[enable musicxml file support, requires Freedots and lou_translate]),
enable_musicxml=$enableval,enable_musicxml=no)
if test "x$enable_musicxml" = "xyes"
then
MUSICXML_CONV="application/vnd.recordare.musicxml+xml application/vnd.cups-brf 30 musicxmltobrf"
MUSICXML_TYPE="application/vnd.recordare.musicxml+xml xml contains(0,1000,\"<score-partwise\")"
MUSICXML_FILTER="filter/musicxmltobrf"
fi
AM_CONDITIONAL(ENABLE_MUSICXML, test "x$enable_musicxml" = "xyes")
AC_SUBST(MUSICXML_CONV)
AC_SUBST(MUSICXML_TYPE)
# ====================
# Supports for filters
# ====================
#
PKG_CHECK_MODULES([LIBMAGIC], [libmagic])
# ===================
# Systemd integration
# ===================
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != xno; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
# =====================
# Prepare all .in files
# =====================
AC_CONFIG_FILES([
Makefile
driver/index/indexv4.sh
driver/index/indexv3.sh
driver/index/index.sh
driver/index/textbrftoindexv3
driver/index/imageubrltoindexv3
driver/index/imageubrltoindexv4
driver/generic/brftoembosser
filter/cups-braille.sh
filter/imagetobrf
filter/texttobrf
filter/brftopagedbrf
filter/vectortopdf
filter/vectortobrf
${MUSICXML_FILTER}
filter/liblouis1.defs.gen
mime/braille.convs
mime/braille.types
])
AC_CONFIG_COMMANDS([executable-scripts], [
chmod +x filter/liblouis1.defs.gen
])
AC_OUTPUT
# ==============================================
# Display final informations about configuration
# ==============================================
AC_MSG_NOTICE([
==============================================================================
Environment settings:
CFLAGS: ${CFLAGS}
CXXFLAGS: ${CXXFLAGS}
LDFLAGS: ${LDFLAGS}
Build configuration:
cups-config: ${with_cups_config}
braille: ${enable_braille}
braille tables: ${TABLESDIR}
musicxml support: ${enable_musicxml}
werror: ${enable_werror}
==============================================================================
])