summaryrefslogtreecommitdiff
path: root/community-testing/motion/ffmpeg-compat.patch
blob: 278166e186e88ce248832498f0ad00fe450b69d1 (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
diff -wbBur motion-3.2.12/configure.in motion-3.2.12.q/configure.in
--- motion-3.2.12/configure.in	2010-06-01 10:48:23.000000000 +0400
+++ motion-3.2.12.q/configure.in	2012-06-20 13:51:42.000000000 +0400
@@ -290,163 +290,11 @@
 fi
 
 
-#
-# Check for libavcodec and libavformat from ffmpeg
-#
-FFMPEG_DIR="yes"
-FFMPEG_OK="no_found"
-FFMPEG_OBJ=""
-AC_ARG_WITH(ffmpeg,
-[  --with-ffmpeg[=DIR]       Specify the prefix for the install path for
-                          libavcodec/libavformat (part of ffmpeg) be able to 
-                          encode mpeg movies realtime.
-                          If this is not specified motion will try to find
-                          the libraries in /usr and /usr/local.
-                          ],
-FFMPEG_DIR="$withval"
-)
-#
-# --without-ffmpeg or with-ffmpeg=no
-#
-if test "${FFMPEG_DIR}" = "no"; then
-	AC_MSG_CHECKING(for ffmpeg)
-	AC_MSG_RESULT(skipping)
-#
-# with-ffmpeg=<dir> or nothing
-#
-else if test "${FFMPEG_DIR}" = "yes"; then
-	# AUTODETECT STATIC/SHARED LIB 
-	AC_MSG_CHECKING(for ffmpeg autodetecting)
-
-	if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then
-		AC_MSG_RESULT(found in /usr/lib64)
-		FFMPEG_OK="found"
-		FFMPEG_LIB="/usr/lib64"
-		FFMPEG_DIR="/usr"
-	elif test -f /usr/lib/libavcodec.a -o -f /usr/lib/libavcodec.so && test -f /usr/lib/libavformat.a -o -f /usr/lib/libavformat.so ; then
-		AC_MSG_RESULT(found in /usr/lib)
-		FFMPEG_OK="found"
-		FFMPEG_LIB="/usr/lib"
-		FFMPEG_DIR="/usr"
-	elif test -f /usr/local/lib/libavcodec.a -o -f /usr/local/lib/libavcodec.so && test -f /usr/local/lib/libavformat.a -o -f /usr/local/lib/libavformat.so ; then
-		AC_MSG_RESULT(found in /usr/local/lib)
-		FFMPEG_OK="found"
-		FFMPEG_LIB="/usr/local/lib"
-		FFMPEG_DIR="/usr/local"
-	else
-		AC_MSG_RESULT(not found)
-		echo ""
-		echo "**********************************************"
-		echo "* libavcodec.a or libavcodec.so or           *"
-		echo "* libavformat.a or libavformat.so not found: *"
-		echo "*    ALL FFMPEG FEATURES DISABLED            *"
-		echo "*                                            *"
-		echo "* Please read the Motion Guide for help:     *"
-		echo "* http://motion.sourceforge.net              *"
-		echo "**********************************************"
-		echo ""		
-	fi 
-else
-	AC_MSG_CHECKING(for ffmpeg in -> [${FFMPEG_DIR}] <-)
-	if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then
-		AC_MSG_RESULT(found)
-		FFMPEG_OK="found"
-		FFMPEG_LIB="${FFMPEG_DIR}/lib"
-	elif test -f ${FFMPEG_DIR}/libavcodec.a -o -f ${FFMPEG_DIR}/libavcodec.so && test -f ${FFMPEG_DIR}/libavformat.a -o -f ${FFMPEG_DIR}/libavformat.so ; then
-		AC_MSG_RESULT(found)
-		FFMPEG_LIB="${FFMPEG_DIR}"
-		FFMPEG_OK="found"
-	else
-		AC_MSG_RESULT(not found)
-		if test "${FFMPEG_OK}" != "found"; then
-			echo ""
-			echo "**********************************************"
-			echo "* libavcodec.a or libavcodec.so or           *"
-			echo "* libavformat.a or libavformat.so not found: *"
-			echo "*    ALL FFMPEG FEATURES DISABLED            *"
-			echo "*                                            *"
-			echo "* Please read the Motion Guide for help:     *"
-			echo "* http://motion.sourceforge.net              *"
-			echo "**********************************************"
-			echo ""
-		fi
-	fi
-fi
-
-#
-# Now check for ffmpeg headers ( avformat.h ) if ffmpeg libs were found
-#
-
-if test "${FFMPEG_OK}" = "found"; then
-	AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_DIR})
-	
-	if test -f ${FFMPEG_DIR}/include/avformat.h; then
-		AC_MSG_RESULT(found ${FFMPEG_DIR}/include/avformat.h)
-		FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include"
-	elif test -f ${FFMPEG_DIR}/avformat.h; then
-		AC_MSG_RESULT(found ${FFMPEG_DIR}/avformat.h)
-		FFMPEG_CFLAGS="-I${FFMPEG_DIR}"
-	elif test -f ${FFMPEG_DIR}/include/ffmpeg/avformat.h; then
-		AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/avformat.h)
-		FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg"
-	elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then
-		AC_MSG_RESULT(found ${FFMPEG_DIR}/include/libavformat/avformat.h)
-		FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES"
-    elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then
-        AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h)
-        FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" 
-	else
-		AC_MSG_RESULT(not found)
-		FFMPEG_OK="no_found"
-		echo "**********************************************"
-		echo "*       avformat.h not found:                *"
-		echo "*    ALL FFMPEG FEATURES DISABLED            *"
-		echo "*                                            *"
-		echo "* Please read the Motion Guide for help:     *"
-		echo "* http://motion.sourceforge.net              *"
-		echo "**********************************************"
-		echo ""
-	fi
-
-#
-# If ffmpeg libs and headers have been found 
-#
-
-	if  test "${FFMPEG_OK}" = "found"; then	
-		TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} -lavformat -lavcodec -lavutil -lm -lz"
-		TEMP_LDFLAGS="${TEMP_LDFLAGS} -L${FFMPEG_LIB}"
-		TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG ${FFMPEG_CFLAGS}"
-
-		FFMPEG_OBJ="ffmpeg.o"
-		AC_SUBST(FFMPEG_OBJ)
-
-		AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?])
-		saved_CFLAGS=$CFLAGS
-		saved_LIBS=$LIBS
-		CFLAGS="${FFMPEG_CFLAGS}"
-		LIBS="$TEMP_LIBS"
-		
-		AC_COMPILE_IFELSE(
-			[
-			#include <avformat.h>
-			URLProtocol test_file_protocol;
-			int main(void){
-				test_file_protocol.url_read  = file_protocol.url_read;
-				return 0;
-			}
-			],
-			[AC_MSG_RESULT(yes)],
-			[
-				AC_MSG_RESULT(no)
-				TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_NEW"
-			]
-		)
-		CFLAGS=$saved_CFLAGS
-		LIBS=$saved_LIBS	
-	fi
-fi	
-fi
-
+TEMP_CFLAGS+=" `pkg-config --cflags libavformat libavcodec` -DHAVE_FFMPEG -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW"
+TEMP_LIBS+=" `pkg-config --libs libavformat libavcodec` -lavutil -Wl,-rpath /usr/lib/ffmpeg-compat"
+FFMPEG_OK=found
+FFMPEG_OBJ="ffmpeg.o"
+AC_SUBST(FFMPEG_OBJ)
 
 #
 # Check Mysql