forked from FFMS/ffms2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
166 lines (137 loc) · 4.63 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
AC_PREREQ([2.58])
AC_INIT([ffms2],[esyscmd([sh version.sh])])
AC_CONFIG_SRCDIR([src/core/ffms.cpp])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 subdir-objects])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE([disable])
VERSION_INFO="5:0:0"
AC_MSG_CHECKING([if debug build is enabled])
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug],
[Enable debug build. [default=no]])],
[enable_debug=yes],
[enable_debug=no]
)
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" = yes; then
OPT_FLAGS="-O0 -g3 -fno-inline -fno-omit-frame-pointer -fvar-tracking -fvar-tracking-assignments"
else
OPT_FLAGS="-O3"
fi
if test -z "$CFLAGS"; then
CFLAGS="$OPT_FLAGS -Wall -Wextra"
fi
if test -z "$CXXFLAGS"; then
CXXFLAGS="$OPT_FLAGS -Wall -Wextra"
fi
AC_ARG_ENABLE([avisynth],
[AC_HELP_STRING([--enable-avisynth],
[Enable AviSynth+ plugin. [default=no]])],
[enable_avisynth=yes],
[enable_avisynth=no]
)
AC_MSG_RESULT([$enable_avisynth])
AM_CONDITIONAL([AVISYNTH], [test "x$enable_avisynth" != "xno"])
AC_CONFIG_HEADERS([src/config/config.h])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_CANONICAL_HOST
AS_CASE([$host],
[*mingw* | *cygwin*], [
AC_ENABLE_STATIC
AC_DISABLE_SHARED
], [
AC_ENABLE_SHARED
AC_DISABLE_STATIC])
AC_PROG_LIBTOOL
if echo "$host" | $GREP "cygwin" >/dev/null 2>&1 && test "$enable_shared" = "yes"; then
AC_MSG_ERROR([Shared build is broken on cygwin.
Please remove --enable-shared from your configure options or build with another --host.])
fi
dnl Workaround for a bug in libtool
dnl The windows libtool uses a file magic checking method that only accepts
dnl dynamic libraries. Change it for libtool's alternative checking method.
if test "$lt_cv_file_magic_cmd" = "func_win32_libid" ; then
deplibs_check_method='file_magic file format pei*-(i386|x86-64)|(.*architecture: i386)?'
file_magic_cmd='$OBJDUMP -f'
fi
FFMS_VERSION="$(sh $(dirname -- "$0")/version.sh)"
AC_SUBST([FFMS_VERSION])
CHECK_ZLIB
dnl Save CFLAGS and LIBS for later, as anything else we add will be from pkg-config
dnl and thus should be separate in our .pc file.
_CFLAGS="$CFLAGS"
_CPPFLAGS="$CPPFLAGS"
_LIBS="$LIBS"
PKG_PROG_PKG_CONFIG([0.22])
pkgconfigdir="\$(libdir)/pkgconfig"
AC_SUBST(pkgconfigdir)
PKG_CHECK_MODULES(FFMPEG, [libavformat-if >= 53.20.0 libavcodec-if >= 53.24.0 libswscale-if >= 0.7.0 libavutil-if >= 51.21.0 libswresample-if >= 1.0.0])
dnl As of 0eec06ed8747923faa6a98e474f224d922dc487d ffmpeg only adds -lrt to lavc's
dnl LIBS, but lavu needs it, so move it to the end if it's present
FFMPEG_LIBS=$(echo $FFMPEG_LIBS | sed 's/\(.*\)-lrt \(.*\)/\1\2 -lrt/')
AC_SUBST([FFMPEG_CFLAGS])
AC_SUBST([FFMPEG_LIBS])
CPPFLAGS="$CPPFLAGS -D__STDC_CONSTANT_MACROS"
CFLAGS="$_CFLAGS $FFMPEG_CFLAGS"
AC_DEFUN([TEST_FFMPEG],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
]],[[
avformat_network_init();
swscale_version();
]])], [eval $1=yes], [eval $1=no])
])
AC_MSG_CHECKING([whether FFmpeg works])
LIBS="$_LIBS $FFMPEG_LIBS"
TEST_FFMPEG([FFMPEG_WORKS])
AC_MSG_RESULT([$FFMPEG_WORKS])
if test "$FFMPEG_WORKS" = no; then
AC_MSG_FAILURE([cannot link with FFmpeg])
fi
src_core_libffms2_la_LDFLAGS=""
AC_MSG_CHECKING([whether -Wl,-Bsymbolic is needed])
if test "$enable_shared" = yes; then
_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -shared $lt_prog_compiler_pic"
TEST_FFMPEG([no_bsymbolic])
if test "$no_bsymbolic" = "no"; then
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
TEST_FFMPEG([bsymbolic])
if test "$bsymbolic" = "yes"; then
src_core_libffms2_la_LDFLAGS="$src_core_libffms2_la_LDFLAGS -Wl,-Bsymbolic"
else
AC_MSG_RESULT($bsymbolic)
AC_MSG_FAILURE([cannot build ffms2 as a shared library])
fi
else
bsymbolic=no
fi
LDFLAGS="$_LDFLAGS"
src_core_libffms2_la_LDFLAGS="$src_core_libffms2_la_LDFLAGS -version-info $VERSION_INFO"
else
bsymbolic=no
fi
if echo "$host" | $GREP "mingw" >/dev/null 2>&1; then
src_index_core_LDFLAGS="$src_core_ffmsindex_LDFLAGS -municode"
fi
AC_SUBST([src_core_libffms2_la_LDFLAGS])
CFLAGS="$_CFLAGS"
CPPFLAGS="$_CPPFLAGS"
LIBS="$_LIBS"
AC_MSG_RESULT($bsymbolic)
if echo "$host" | $GREP "mingw" >/dev/null 2>&1; then
LTUNDEF="-no-undefined"
src_index_ffmsindex_LDFLAGS="$src_index_ffmsindex_LDFLAGS -municode"
fi
AC_SUBST([LTUNDEF])
AC_SUBST([src_index_ffmsindex_LDFLAGS])
AC_CONFIG_FILES([
Makefile
ffms2.pc
])
AC_OUTPUT