forked from avxsynth/avxsynth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
500 lines (461 loc) · 14.2 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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# This autoconf file was written against Autoconf 2.68
# Automake files were written against Automake 1.11.3 and libtool 2.4.2
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([avxutils/src/AvxTextRender.cpp])
AC_INIT([avxsynth], [4.0])
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall parallel-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) # Automake 1.11 is required for silent build.
# Check for required programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AM_PROG_AR
LT_INIT([dlopen disable-static])
PKG_PROG_PKG_CONFIG
# Create options for plugins and avxedit. Always build avxFrameServer.
AC_ARG_ENABLE([all],
[AS_HELP_STRING(
[--enable-all],
[enable all optional components (individual switches override)]
)]
)
AC_ARG_ENABLE([autocrop],
[AS_HELP_STRING(
[--enable-autocrop],
[build autocrop plugin (default yes)]
)]
)
AC_ARG_ENABLE([framecapture],
[AS_HELP_STRING(
[--enable-framecapture],
[build framecapture plugin (default yes, requires libjpeg)]
)]
)
AC_ARG_ENABLE([subtitle],
[AS_HELP_STRING(
[--enable-subtitle],
[build subtitle plugin (default yes)]
)]
)
AC_ARG_ENABLE([ffms2],
[AS_HELP_STRING(
[--enable-ffms2],
[build ffms2 plugin (default yes, requires ffms2 and libav/ffmpeg)]
)]
)
AC_ARG_ENABLE([avxedit],
[AS_HELP_STRING(
[--enable-avxedit],
[build AVXEdit program (default yes, requires Qt4)]
)]
)
AC_ARG_WITH([jpeg],
[AS_HELP_STRING(
[--with-jpeg=DIR],
[specify libjpeg installation prefix]
)]
)
# Handle enable_all .
if test "x$enable_all" = "xyes"; then
test "x$enable_autocrop" = "x" && enable_autocrop="yes"
test "x$enable_framecapture" = "x" && enable_framecapture="yes"
test "x$enable_subtitle" = "x" && enable_subtitle="yes"
test "x$enable_ffms2" = "x" && enable_ffms2="yes"
test "x$enable_avxedit" = "x" && enable_avxedit="yes"
elif test "x$enable_all" = "xno"; then
test "x$enable_autocrop" = "x" && enable_autocrop="no"
test "x$enable_framecapture" = "x" && enable_framecapture="no"
test "x$enable_subtitle" = "x" && enable_subtitle="no"
test "x$enable_ffms2" = "x" && enable_ffms2="no"
test "x$enable_avxedit" = "x" && enable_avxedit="no"
fi
# Handle disable_shared here in case libtool decides it can't build shared libs.
AS_IF(
[test "x$enable_shared" = "xno"],
[
AC_MSG_WARN([plugins can not be built as static libraries])
if
test "x$enable_autocrop" = "xyes" || \
test "x$enable_framecapture" = "xyes" || \
test "x$enable_subtitle" = "xyes" || \
test "x$enable_ffms2" = "xyes";
then
AC_MSG_ERROR([plugins are enabled but shared libraries are not])
else
AC_MSG_WARN([disabling all plugins])
fi
enable_autocrop="no"
enable_framecapture="no"
enable_subtitle="no"
enable_ffms2="no"
]
)
# Library tests follow. Where supported, pkg-config is used to guess
# the appropriate includes and libs. However, pkg-config does not
# make any claim regarding functionality, so we check all results.
AC_DEFUN([SAVE_COMPILER_FLAGS],
[
_SAVED_CFLAGS="$CFLAGS" _SAVED_CXXFLAGS="$CXXFLAGS"
_SAVED_LIBS="$LIBS" _SAVED_LDFLAGS="$LDFLAGS"
]
)
AC_DEFUN([RESTORE_COMPILER_FLAGS],
[
CFLAGS="$_SAVED_CFLAGS" CXXFLAGS="$_SAVED_CXXFLAGS"
LIBS="$_SAVED_LIBS" LDFLAGS="$_SAVED_LDFLAGS"
]
)
# libtool can find these automatically, but not if the user requests
# a completely static executable.
AC_SEARCH_LIBS([dlopen], [dl dld],
[], [AC_MSG_ERROR([unable to find dlopen() function])]
)
AC_SEARCH_LIBS([cos], [m],
[], [AC_MSG_ERROR([unable to find cos() function])]
)
AC_LANG([C++])
PKG_CHECK_MODULES([log4cpp], [log4cpp])
SAVE_COMPILER_FLAGS
CXXFLAGS="$CXXFLAGS $log4cpp_CFLAGS" LIBS="$LIBS $log4cpp_LIBS"
AC_MSG_CHECKING([if log4cpp works])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <log4cpp/SimpleLayout.hh>],
[log4cpp::Layout* dummy = new log4cpp::SimpleLayout()]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([log4cpp does not work, see config.log])]
)
RESTORE_COMPILER_FLAGS
AC_LANG([C])
PKG_CHECK_MODULES([pangocairo], [pangocairo])
SAVE_COMPILER_FLAGS
CFLAGS="$CFLAGS $pangocairo_CFLAGS" LIBS="$LIBS $pangocairo_LIBS"
AC_MSG_CHECKING([if pangocairo works])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <pango/pangocairo.h>],
[pango_cairo_font_map_get_default()]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([pangocairo does not work, see config.log])]
)
RESTORE_COMPILER_FLAGS
# Tests for optional components follow.
# The tests work as follows:
#
# If the component is either enabled or unset, check for the required
# library X and set HAVE_X to either yes or no. In a separate statement,
# check HAVE_X and either enable or disable the component. If HAVE_X was
# not set, that means the user originally disabled the component and
# hence we disable it.
# These require no tests.
test "x$enable_autocrop" = "x" && enable_autocrop="yes"
test "x$enable_subtitle" = "x" && enable_subtitle="yes"
# Framecapture plugin requires libjpeg.
AC_LANG([C])
AS_IF(
[test "x$enable_framecapture" = "xyes" || test "x$enable_framecapture" = "x"],
[
SAVE_COMPILER_FLAGS
JPEG_PREFIX="$with_jpeg"
if
test ! "x$with_jpeg" = "xyes" && \
test ! "x$with_jpeg" = "xno" && \
test ! "x$with_jpeg" = "x";
then
jpeg_CFLAGS="-I\"$with_jpeg/include\""
jpeg_LIBS="-L\"$with_jpeg/lib\""
fi
SAVE_COMPILER_FLAGS
CFLAGS="$CFLAGS $jpeg_CFLAGS" LIBS="$LIBS $jpeg_LIBS"
AC_CHECK_HEADER([jpeglib.h], [AC_SUBST([jpeg_CFLAGS])], [HAVE_JPEG="no"])
AC_SEARCH_LIBS(
[jpeg_destroy_compress], [jpeg],
[
if test "x$ac_cv_search_jpeg_destroy_compress" = "xnone required"; then
jpeg_LIBS=""
else
jpeg_LIBS="$ac_cv_search_jpeg_destroy_compress"
fi
AC_SUBST([jpeg_LIBS])
],
[HAVE_JPEG="no"]
)
test ! "x$HAVE_JPEG" = "xno" && HAVE_JPEG="yes"
RESTORE_COMPILER_FLAGS
]
)
AS_IF(
[test "x$HAVE_JPEG" = "xno"],
[
if test "x$enable_framecapture" = "xyes"; then
AC_MSG_ERROR([libjpeg required for framecapture plugin])
elif test "x$enable_framecapture" = "x"; then
AC_MSG_WARN([libjpeg not found, disabling framecapture plugin])
enable_framecapture="no"
fi
],
[test "x$HAVE_JPEG" = "xyes"],
[enable_framecapture="yes"],
[enable_framecapture="no"]
)
# ffms2 plugin requires libav and ffms2. We check for each part of libav
# separately to provide the user with more useful information.
AC_LANG([C])
AS_IF(
[test "x$enable_ffms2" = "xyes" || test "x$enable_ffms2" = "x"],
[
# We add -shared to the LDFLAGS for checking to prevent turtles-all-the-way-down issues.
# This has the unfortunate side effect of preventing symbol checking from working.
# Note that when compiling we will need to link ffms2 before libav.
PKG_CHECK_MODULES([ffms2], [ffms2], [], [true])
SAVE_COMPILER_FLAGS
CFLAGS="$CFLAGS $lt_prog_compiler_pic $ffms2_CFLAGS" LIBS="$LIBS $ffms2_LIBS"
LDFLAGS="$LDFLAGS $lt_prog_compiler_pic -shared"
AC_MSG_CHECKING([if ffms2 works])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <ffms.h>],
[FFMS_GetEnabledSources()]
)],
[HAVE_FFMS2="yes"], [HAVE_FFMS2="no"]
)
AC_MSG_RESULT([$HAVE_FFMS2])
RESTORE_COMPILER_FLAGS
# The order is important -- ffms2 -> avformat -> avcodec -> swscale -> avutil.
# Specifying the wrong order will cause undefined symbols when linking to static libs.
PKG_CHECK_MODULES([libav], [libavformat libavcodec libswscale libavutil], [], [true])
# On x86_64, linking with static libav requires -Wl,-Bsymbolic
SAVE_COMPILER_FLAGS
CFLAGS="$CFLAGS $lt_prog_compiler_pic $libav_CFLAGS" LIBS="$LIBS $libav_LIBS"
LDFLAGS="$LDFLAGS $lt_prog_compiler_pic -shared"
AC_MSG_CHECKING([if libav works])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>
],
[
avcodec_close(NULL);
avformat_close_input(NULL);
avutil_license();
sws_freeContext(NULL);
]
)],
[without_Bsymbolic="yes"], [without_Bsymbolic="no"]
)
AC_MSG_RESULT([$without_Bsymbolic])
if test "x$without_Bsymbolic" = "xno"; then
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
AC_MSG_CHECKING([if libav works with -Wl,-Bsymbolic])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>
],
[
avcodec_close(NULL);
avformat_close_input(NULL);
avutil_license();
sws_freeContext(NULL);
]
)],
[with_Bsymbolic="yes"], [with_Bsymbolic="no"]
)
AC_MSG_RESULT([$with_Bsymbolic])
fi
RESTORE_COMPILER_FLAGS
if test "x$without_Bsymbolic" = "xyes"; then
HAVE_LIBAV="yes"
elif test "x$with_Bsymbolic" = "xyes"; then
libav_BSYMBOLIC="-Wl,-Bsymbolic" HAVE_LIBAV="yes"
else
HAVE_LIBAV="no"
fi
AC_SUBST([libav_BSYMBOLIC])
]
)
AS_IF(
[test "x$HAVE_LIBAV" = "xno" || test "x$HAVE_FFMS2" = "xno"],
[
if test "x$enable_ffms2" = "xyes"; then
AC_MSG_ERROR([ffmpeg/libav and ffms2 required for ffms2 plugin])
elif test "x$enable_ffms2" = "x"; then
AC_MSG_WARN([ffmpeg/libav and/or ffms2 not found, disabling ffms2 plugin])
enable_ffms2="no"
fi
],
[test "x$HAVE_LIBAV" = "xyes" && test "x$HAVE_FFMS2" = "xyes"],
[enable_ffms2="yes"],
[enable_ffms2="no"]
)
# AVXEdit requires Qt. We must check for required Qt compilers as well as libs.
# This example adapted from http://qtnode.net/wiki/Qt_with_autotools .
AC_LANG([C++])
AS_IF(
[test "x$enable_avxedit" = "xyes" || test "x$enable_avxedit" = "x"],
[
PKG_CHECK_MODULES([Qt], [QtCore QtGui >= 4],
[
test "x$MOC" = "x" && MOC=$("$PKG_CONFIG" --variable=moc_location QtCore)
test "x$RCC" = "x" && RCC=$("$PKG_CONFIG" --variable=rcc_location QtCore)
Qt_CFLAGS=$($PKG_CONFIG --cflags QtGui)
Qt_LIBS=$($PKG_CONFIG --libs QtGui)
],
[true]
)
AC_PATH_PROGS([MOC], [moc-qt4 moc], [moc])
AC_PATH_PROG([RCC], [rcc])
# There's no way sane way to check rcc function, so we only test moc.
cat > myqt.h << EOF
#include <QObject>
class Test : public QObject
{
Q_OBJECT
public:
Test() {}
~Test() {}
public slots:
void receive() {}
signals:
void send();
};
EOF
SAVED_CXXFLAGS="$CXXFLAGS" SAVED_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $Qt_CFLAGS" LIBS="$LIBS $Qt_LIBS"
AC_MSG_CHECKING([if $MOC works])
if "$MOC" myqt.h -o moc_myqt.cpp 2>&AS_MESSAGE_LOG_FD; then
HAVE_MOC="yes"; else HAVE_MOC="no"
fi
AC_MSG_RESULT([$HAVE_MOC])
AC_MSG_CHECKING([if moc'd headers can be compiled])
if "$CXX" $CXXFLAGS -c -o moc_myqt.o moc_myqt.cpp 2>&AS_MESSAGE_LOG_FD; then
HAVE_MOC="yes"; else HAVE_MOC="no"
fi
AC_MSG_RESULT([$HAVE_MOC])
# The other checks are for user diagnostics only.
LIBS="moc_myqt.o $LIBS"
AC_MSG_CHECKING([if Qt applications can be compiled])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
#include "myqt.h"
#include <QApplication>
],
[
int argc=0;
QApplication app(argc, 0);
Test t;
QObject::connect(&t, SIGNAL(send()), &t, SLOT(receive()));
]
)],
[HAVE_QT="yes"], [HAVE_QT="no"]
)
AC_MSG_RESULT([$HAVE_QT])
CXXFLAGS="$SAVED_CXXFLAGS" LIBS="$SAVED_LIBS"
rm -f moc_myqt.cpp moc_myqt.o myqt.h
]
)
AS_IF(
[test "x$HAVE_QT" = "xno" || test "x$RCC" = "x"],
[
if test "x$enable_avxedit" = "xyes"; then
AC_MSG_ERROR([Qt4 libraries and moc+rcc are required for AVXEdit])
elif test "x$enable_avxedit" = "x"; then
AC_MSG_WARN([Required Qt4 libraries and tools not found, disabling AVXEdit])
enable_avxedit="no"
fi
],
[test "x$HAVE_QT" = "xyes" && test ! "x$RCC" = "x"],
[enable_avxedit="yes"],
[enable_avxedit="no"]
)
# Test harness programs check.
AC_CHECK_PROGS([PYTHON], [python2.7 python3 python2 python], [python])
AS_IF(
[test ! "x$PYTHON" = "xpython2.7"],
[AC_MSG_WARN([detected python not python2.7, test suite may not work])]
)
# Record enabled features
AM_CONDITIONAL([OPT_autocrop], [test "x$enable_autocrop" = "xyes"])
AM_CONDITIONAL([OPT_framecapture], [test "x$enable_framecapture" = "xyes"])
AM_CONDITIONAL([OPT_subtitle], [test "x$enable_subtitle" = "xyes"])
AM_CONDITIONAL([OPT_ffms2], [test "x$enable_ffms2" = "xyes"])
AM_CONDITIONAL([OPT_avxedit], [test "x$enable_avxedit" = "xyes"])
AC_CONFIG_FILES(
[
Makefile
avxutils/Makefile
avxsynth/Makefile
include/Makefile
plugins/autocrop/Makefile
plugins/avxffms2/Makefile
plugins/avxframecapture/Makefile
plugins/avxsubtitle/Makefile
apps/avxframeserver/Makefile
apps/AVXEdit/Makefile
test/Makefile
test/common.avsi
avxsynth.pc
avxutils.pc
]
)
AC_OUTPUT
cat << EOF
Configure completed successfully.
Build settings:
CXXFLAGS: $CXXFLAGS
CPPFLAGS: $CPPFLAGS
LDFLAGS: $LDFLAGS
LIBS: $LIBS
Library specific build settings:
log4cpp:
CFLAGS: $log4cpp_CFLAGS
LIBS: $log4cpp_LIBS
pangocairo:
CFLAGS: $pangocairo_CFLAGS
LIBS: $pangocairo_LIBS
jpeg:
CFLAGS: $jpeg_CFLAGS
LIBS: $jpeg_LIBS
ffms2:
CFLAGS: $ffms2_CFLAGS
LIBS: $ffms2_LIBS
libav:
CFLAGS: $libav_CFLAGS
LIBS: $libav_LIBS
Qt:
moc: $MOC
rcc: $RCC
CFLAGS: $Qt_CFLAGS
LIBS: $Qt_LIBS
Enabled optional components:
autocrop: $enable_autocrop
avxframecapture: $enable_framecapture
avxsubtitle: $enable_subtitle
avxffms2: $enable_ffms2
AVXEdit: $enable_avxedit
Has a library not been detected?
Review config.log and set relevant environment variables.
Library linking style:
Shared libraries: $enable_shared
Static libraries: $enable_static
To compile program, run:
make
To install, run:
make [[DESTDIR=...]] install
Remember to run ldconfig after installing libraries to their
final destination. Additionally, DESTDIR-installed libraries
require "libtool --finish <dir>" after their final install.
Other valid targets:
check dist clean distclean
EOF