forked from sackmotion/motion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1364 lines (1192 loc) · 35 KB
/
configure.in
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Process this file with autoconf to produce a configure script
AC_INIT(motion, esyscmd(['./version.sh']))
AC_CONFIG_SRCDIR([motion.c])
AC_CONFIG_HEADERS(config.h)
AC_PROG_CC
THREAD_CFLAGS=""
THREAD_CHECK="/usr/include/pthread.h"
Darwin=""
FreeBSD=""
LINUXTHREADS="no"
AC_ARG_WITH(linuxthreads,
[ --with-linuxthreads Use linuxthreads in BSD instead of native pthreads
]
,
LINUXTHREADS="$withval"
)
PWCBSD="no"
AC_ARG_WITH(pwcbsd,
[ --with-pwcbsd Use pwcbsd based webcams ( only BSD )
]
,
PWCBSD="$withval"
)
AC_MSG_CHECKING(for Darwin)
Darwin=`uname -a | grep "Darwin"`
if test "${Darwin}" = ""; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for *BSD)
FreeBSD=`uname -a | grep "BSD"`
if test "${FreeBSD}" = ""; then
AC_MSG_RESULT(no)
VIDEO="video.o video2.o video_common.o"
else
AC_MSG_RESULT(yes)
if test "${LINUXTHREADS}" = "no"; then
AC_MSG_CHECKING(Linuxthreads)
AC_MSG_RESULT(skipping)
else
THREAD_CHECK="/usr/local/include/pthread/linuxthreads/pthread.h"
THREAD_LIB_CHECK="/usr/local/lib/liblthread.so"
fi
if test "${PWCBSD}" != "no"; then
VIDEO="video.o video2.o video_common.o"
TEMP_CFLAGS="${CFLAGS} -I/usr/local/include -DPWCBSD"
else
VIDEO="video_freebsd.o"
TEMP_CFLAGS="${CFLAGS} -I/usr/local/include"
fi
TEMP_LDFLAGS="${LDFLAGS} -L/usr/local/lib"
TEMP_LIBS="-L/usr/local/lib"
AC_MSG_RESULT(Build with PWCBSD support $PWCBSD)
fi
else
TEMP_CFLAGS="${CFLAGS} -I/sw/include"
TEMP_LDFLAGS="${LDFLAGS} -L/sw/lib"
TEMP_LIBS="-L/sw/lib"
VIDEO="video_freebsd.o"
FINK_LIB="-L/sw/lib"
Darwin="yes"
V4L="no"
AC_MSG_RESULT($Darwin)
fi
AC_SUBST(VIDEO)
# Checks for programs.
AC_PROG_CC
TEMP_LIBS="-lm ${TEMP_LIBS}"
TEMP_CFLAGS="${TEMP_CFLAGS} ${CFLAGS}"
TEMP_LDFLAGS="${TEMP_LDFLAGS} ${LDFLAGS}"
if test "${FreeBSD}" != "" && test "${PWCBSD}" = "no"; then
AC_MSG_CHECKING(bktr headers in /usr/include/dev/bktr)
if test -f /usr/include/dev/bktr/ioctl_meteor.h && test -f /usr/include/dev/bktr/ioctl_bt848.h; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
TEMP_CFLAGS="${TEMP_CFLAGS} -DOLD_BKTR"
fi
#
# Check to Exclude BKTR
#
BKTR="yes"
AC_ARG_WITH(bktr,
[ --without-bktr Exclude to use bktr subsystem , that usually useful
for devices as network cameras ( ONLY used in *BSD).
]
,
BKTR="$withval"
)
if test "${BKTR}" = "no"; then
TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L"
fi
else
#
# Check to Exclude V4L
#
V4L="yes"
AC_ARG_WITH(v4l,
[ --without-v4l Exclude using v4l (video4linux) subsystem.
Makes Motion so it only supports network cameras.
],
V4L="$withval"
)
fi
if test "${V4L}" = "no"; then
TEMP_CFLAGS="${TEMP_CFLAGS} -DWITHOUT_V4L"
fi
if test "${FreeBSD}" != "" && test "${LINUXTHREADS}" != "no" ; then
AC_MSG_CHECKING(for linuxthreads)
#
# Check for thread header
#
if test -f "${THREAD_CHECK}"; then
HEADERS_THREAD_CFLAGS="-I/usr/local/include/pthread/linuxthreads"
THREADS="yes"
else
THREADS="no"
fi
#
# Check for thread lib
#
if test -f "${THREAD_LIB_CHECK}" ; then
THREADS="yes"
LIB_THREAD="-llthread -llgcc_r"
else
THREADS="no"
fi
# Checks for Library linuxthreads for FreeBSD
#
# linuxthreads on freeBSD, ports collection
# /usr/local/include/pthreads/linuxthreads/pthread.h
# #include <linuxthreads/pthread.h>
# /usr/local/lib/libpthread.so
#
if test "${THREADS}" = "yes"; then
TEMP_CFLAGS="${HEADERS_THREAD_CFLAGS} $TEMP_CFLAGS -DWITH_LINUXTREADS"
TEMP_LIBS="$TEMP_LIBS ${LIB_THREAD}"
THREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_SUPPORT="yes"
AC_MSG_RESULT($THREADS)
else
PTHREAD_SUPPORT="no"
AC_MSG_RESULT($THREADS)
echo
echo "You do not have linuxthread installed"
echo
fi
elif test -f "${THREAD_CHECK}"; then
AC_MSG_CHECKING(threads)
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[PTHREAD_LIB=yes])
if test x$PTHREAD_LIB != xyes; then
if test "${FreeBSD}" != ""; then
TEMP_LIBS="$TEMP_LIBS -pthread"
TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
else
TEMP_LIBS="$TEMP_LIBS -lpthread"
TEMP_CFLAGS="${TEMP_CFLAGS} -D_REENTRANT"
fi
PTHREAD_SUPPORT="yes"
fi
AC_MSG_RESULT($PTHREAD_SUPPORT)
else
echo
echo "You do not have threads support"
echo
fi
#
# Check for sdl library
#
SDL_SUPPORT="no"
AC_ARG_WITH(sdl,
[ --without-sdl Compile without sdl support to get stream in SDL window.
],
[],
[])
AC_MSG_CHECKING(for sdl)
if test "x$withval" = "xno"; then
AC_MSG_RESULT(skipped)
else
if test "${FreeBSD}" != ""; then
CONFIG_SDL='sdl11-config'
else
CONFIG_SDL='sdl-config'
fi
if test -z "`($CONFIG_SDL --version) 2>/dev/null`" ;then
AC_MSG_RESULT(no)
if test "$withval" = "yes"; then
echo ""
echo "****************************************************"
echo "* sdl-config could not be found. Please install it *"
echo "* and remove the --with-sdl configure argument. *"
echo "* libSDL can be found at http://www.libsdl.org *"
echo "****************************************************"
echo ""
fi
else
AC_MSG_RESULT(yes)
SDL_SUPPORT="yes"
TEMP_LIBS="$TEMP_LIBS `${CONFIG_SDL} --libs`"
TEMP_CFLAGS="${TEMP_CFLAGS} `${CONFIG_SDL} --cflags`"
AC_DEFINE([HAVE_SDL],1,[Define to 1 if you have SDL support])
SDL_OBJ="sdl.o"
AC_SUBST(SDL_OBJ)
fi
fi
#
# Check for the libjpeg-turbo library
#
JPEG_TURBO="no"
JPEG_TURBO_OK="not_found"
AC_ARG_WITH(jpeg-turbo,
[ --with-jpeg-turbo[=DIR] Specify the prefix for the install path for
jpeg-turbo for optimized jpeg handling (optional).
],
JPEG_TURBO="$withval"
)
if test "${JPEG_TURBO}" = "no"; then
AC_MSG_CHECKING(for libjpeg-turbo)
AC_MSG_RESULT(skipping)
else
AC_MSG_CHECKING(for libjpeg-turbo in -> [${JPEG_TURBO}] <-)
if test -f ${JPEG_TURBO}/lib/libjpeg.a ; then
AC_MSG_RESULT(found)
JPEG_TURBO_OK="found"
else
AC_MSG_RESULT(not found)
fi
fi
if test "${JPEG_TURBO_OK}" = "found"; then
saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="-L${JPEG_TURBO}/lib"
CFLAGS="$CFLAGS -I${JPEG_TURBO}/include"
LIBS="$LIBS -L${JPEG_TURBO}/lib -ljpeg"
AC_CHECK_LIB(jpeg, jpeg_start_compress,
[ TEMP_LIBS="$LIBS"
TEMP_CFLAGS="${CFLAGS}"
TEMP_LDFLAGS="$TEMP_LDFLAGS $LDFLAGS"
JPEG_SUPPORT="yes"],,)
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
LDFLAGS="$saved_LDFLAGS"
JPEG_SUPPORT_TURBO="yes"
fi
#
# Check for the special mmx accelerated jpeg library
#
JPEG_MMX="no"
JPEG_MMX_OK="not_found"
AC_ARG_WITH(jpeg-mmx,
[ --with-jpeg-mmx[=DIR] Specify the prefix for the install path for
jpeg-mmx for optimized jpeg handling (optional).
If this is not specified motion will try to find
the library /usr/lib/libjpeg-mmx.a /usr/local/lib/libjpeg-mmx.a.
],
JPEG_MMX="$withval"
)
#
# --without-jpeg-mmx or with-jpeg-mmx=no
#
if test "${JPEG_MMX}" = "no" || test x$JPEG_SUPPORT != xyes; then
AC_MSG_CHECKING(for libjpeg-mmx)
AC_MSG_RESULT(skipping)
elif test "${JPEG_MMX}" = "yes"; then
# AUTODETECT STATIC LIB
AC_MSG_CHECKING(for libjpeg-mmx autodetecting)
if test -f /usr/lib/libjpeg-mmx.a ; then
AC_MSG_RESULT(found)
JPEG_MMX_OK="found"
JPEG_MMX="/usr/lib"
elif test -f /usr/local/lib/libjpeg-mmx.a ; then
AC_MSG_RESULT(found)
JPEG_MMX_OK="found"
JPEG_MMX="/usr/local/lib"
else
AC_MSG_RESULT(not found)
fi
else
AC_MSG_CHECKING(for libjpeg-mmx in -> [${JPEG_MMX}] <-)
if test -f ${JPEG_MMX}/libjpeg-mmx.a ; then
AC_MSG_RESULT(found)
JPEG_MMX_OK="found"
else
AC_MSG_RESULT(not found)
fi
fi
if test "${JPEG_MMX_OK}" = "found"; then
saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
CFLAGS="$CFLAGS -I${JPEG_MMX}"
LIBS="$LIBS -L${JPEG_MMX}"
AC_CHECK_LIB(jpeg-mmx, jpeg_start_compress,
[ TEMP_LIBS="$TEMP_LIBS -ljpeg-mmx"
TEMP_CFLAGS="${TEMP_CFLAGS} -I${JPEG_MMX}"
JPEG_SUPPORT="yes"],,)
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
JPEG_SUPPORT_MMX="yes"
fi
#
# Look for _a_ jpeg lib that will work.
#
if test x$JPEG_SUPPORT != xyes ; then
# Checks for libraries
LDFLAGS=$TEMP_LDFLAGS
AC_CHECK_LIB(jpeg, jpeg_set_defaults, [
TEMP_LIBS="$TEMP_LIBS -ljpeg"
JPEG_SUPPORT="yes"
], [
echo
echo "You do not have libjpeg installed"
echo
]
)
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"
)
#
# ffmpeg headers custom location
#
FFMPEG_HEADERS_DIR="yes"
AC_ARG_WITH(ffmpeg_headers,
[ --with-ffmpeg-headers[=DIR] Specify the prefix for ffmpeg headers.
],
FFMPEG_HEADERS_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 libraries)
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"
elif test -f /usr/lib/x86_64-linux-gnu/libavcodec.a -o -f /usr/lib/x86_64-linux-gnu/libavcodec.so && test /usr/lib/x86_64-linux-gnu/libavformat.a -o -f /usr/lib/x86_64-linux-gnu/libavformat.so ; then
AC_MSG_RESULT(found in /usr/lib/x86_64-linux-gnu)
FFMPEG_OK="found"
FFMPEG_LIB="/usr/lib/x86_64-linux-gnu"
FFMPEG_DIR="/usr"
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 libraries 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
if test "${FFMPEG_HEADERS_DIR}" = "yes"; then
AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_DIR})
else
AC_MSG_CHECKING(for ffmpeg headers in ${FFMPEG_HEADERS_DIR})
FFMPEG_DIR="${FFMPEG_HEADERS_DIR}"
fi
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"
AVFORMAT="-I${FFMPEG_DIR}/include/libavformat"
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"
AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat"
elif test -f ${FFMPEG_DIR}/libavformat/avformat.h; then
AC_MSG_RESULT(found ${FFMPEG_DIR}/libavformat/avformat.h)
FFMPEG_CFLAGS="-I${FFMPEG_DIR} -DFFMPEG_NEW_INCLUDES"
AVFORMAT="-I{FFMPEG_DIR}/libavformat"
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)
RTPS_OBJ="netcam_rtsp.o"
AC_SUBST(RTPS_OBJ)
AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?])
saved_CFLAGS=$CFLAGS
saved_LIBS=$LIBS
CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}"
LIBS="$TEMP_LIBS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
[
#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
#
# Check SQLITE3
#
SQLITE3_SUPPORT="no"
AC_ARG_WITH(sqlite3,
[ --without-sqlite3 Disable sqlite3 support in motion.
],
SQLITE3="$withval"
# if not given argument, assume standard
)
if test "${SQLITE3}" = "no"; then
AC_MSG_CHECKING(for sqlite3)
AC_MSG_RESULT(skipping)
else
saved_CFLAGS=$CFLAGS
saved_LIBS=$LIBS
AC_CHECK_LIB(sqlite3, sqlite3_open,
[
TEMP_LIBS="$TEMP_LIBS -lsqlite3"
SQLITE3_SUPPORT="yes"
AC_DEFINE([HAVE_SQLITE3],1,[Define to 1 if you have SQLITE3 support])
]
)
CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS
fi
#
# Check Mysql
#
MYSQL="yes"
MYSQL_SUPPORT="no"
MYSQL_HEADERS="yes"
MYSQL_LIBS="yes"
AC_MSG_CHECKING(for mysql support)
AC_ARG_WITH(mysql,
[ --without-mysql Disable mysql support in motion.
],
MYSQL="$withval"
# if not given argument, assume standard
)
AC_ARG_WITH(mysql-lib,
[ --with-mysql-lib[=DIR] Normally, configure will scan all possible default
installation paths for mysql libs. When it fails, use
this command to tell configure where mysql libs
installation root directory is.
],
MYSQL_LIBS="$withval"
# if not given argument, assume standard
)
AC_ARG_WITH(mysql-include,
[ --with-mysql-include[=DIR] Normally, configure will scan all possible default
installation paths for mysql include. When it fails, use
this command to tell configure where mysql include
installation root directory is.
],
MYSQL_HEADERS="$withval"
# if not given argument, assume standard
)
if test "${MYSQL}" = "no"; then
AC_MSG_RESULT(skipped)
else
AC_MSG_RESULT(testing)
# ******* Search mysql headers *******
if test "${MYSQL_HEADERS}" = "yes"; then
AC_MSG_CHECKING(autodect mysql headers)
# Autodetect
for w in /usr/include /usr/local/include /usr/mysql /usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do
# check for plain setups
if test -f $w/mysql.h; then
MYSQL_INCDIR=$w
break
fi
# check for "/usr/include/<packagename>" type setups
if test -f $w/mysql/mysql.h; then
MYSQL_INCDIR=$w/mysql
break
fi
# check for "/usr/<packagename>/include" type setups
if test -f $w/mysql/include/mysql.h; then
MYSQL_INCDIR=$w/mysql/include
break
fi
done
elif test "${MYSQL_HEADERS}" = "no"; then
AC_MSG_CHECKING(for mysql headers)
AC_MSG_RESULT(skipped)
else
AC_MSG_CHECKING(for mysql headers in $MYSQL_HEADERS)
# Manual detection for <withval>
if test -f $MYSQL_HEADERS/mysql.h; then
MYSQL_INCDIR=$MYSQL_HEADERS
fi
fi
if test -z "$MYSQL_INCDIR" ; then
MYSQL_HEADERS="no"
AC_MSG_RESULT(not found)
echo "Invalid MySQL directory - unable to find mysql.h."
else
AC_MSG_RESULT($MYSQL_INCDIR yes)
MYSQL_HEADERS="yes"
fi
if test "${MYSQL_HEADERS}" = "yes"; then
# ******* Search mysql libs *********
if test "${MYSQL_LIBS}" = "yes"; then
AC_MSG_CHECKING(autodect mysql libs)
# Autodetect
for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql /usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql /usr/lib/x86_64-linux-gnu; do
# check for plain setups
if test -f $w/libmysqlclient.a -o -f $w/libmysqlclient.so; then
MYSQL_LIBDIR=$w
break
fi
# check for "/usr/lib/<packagename>" type setups
if test -f $w/mysql/libmysqlclient.a -o -f $w/mysql/libmysqlclient.so; then
MYSQL_LIBDIR=$w/mysql
break
fi
# check for "/usr/<packagename>/lib" type setups
if test -f $w/mysql/lib/libmysqlclient.a -o -f $w/mysql/lib/libmysqlclient.so; then
MYSQL_LIBDIR=$w/mysql/lib
break
fi
done
elif test "${MYSQL_LIBS}" = "no"; then
AC_MSG_CHECKING(for mysql libs)
AC_MSG_RESULT(skipped)
else
AC_MSG_CHECKING(for mysql libs in $MYSQL_LIBS)
# Manual detection for <withval>
if test -f $MYSQL_LIBS/libmysqlclient.a -o -f $MYSQL_LIBS/libmysqlclient.so; then
MYSQL_LIBDIR=$MYSQL_LIBS
fi
fi
if test -z "$MYSQL_LIBDIR" ; then
AC_MSG_RESULT(not found)
echo "Invalid MySQL directory - unable to find libmysqlclient.a or libmysqlclient.so."
else
AC_MSG_RESULT($MYSQL_LIBDIR)
#LDFLAGS="-L$MYSQL_LIBDIR"
saved_CFLAGS=$CFLAGS
saved_LIBS=$LIBS
CFLAGS="-I$MYSQL_INCDIR"
LIBS="-L$MYSQL_LIBDIR"
AC_CHECK_LIB(mysqlclient,mysql_init,[
TEMP_LIBS="$TEMP_LIBS -L$MYSQL_LIBDIR -lmysqlclient -lz"
TEMP_CFLAGS="$TEMP_CFLAGS -I$MYSQL_INCDIR"
MYSQL_SUPPORT="yes"
AC_DEFINE([HAVE_MYSQL],1,[Define to 1 if you have MySQL support])
],
AC_MSG_ERROR(MySQL support can't build without MySQL libraries))
CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS
fi
# end mysql-include , mysql-libs
fi
# end Mysql detection
fi
#
# Check PostgreSQL
#
PGSQL="yes"
PGSQL_SUPPORT="no"
PGSQL_HEADERS="yes"
PGSQL_LIBS="yes"
AC_DEFUN(PGSQL_INC_CHK,[if test -r $i$1/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i$1])
AC_ARG_WITH(pgsql,
[ --without-pgsql Disable PostgreSQL support in motion.
],
PGSQL="$withval"
# if not given argument, assume standard
)
AC_ARG_WITH(pgsql-lib,
[ --with-pgsql-lib[=DIR] Normally, configure will scan all possible default
installation paths for pgsql libs. When it fails, use
this command to tell configure where pgsql libs
installation root directory is.
],
PGSQL_LIBS="$withval"
# if not given argument, assume standard
)
AC_ARG_WITH(pgsql-include,
[ --with-pgsql-include[=DIR] Normally, configure will scan all possible default
installation paths for pgsql include. When it fails, use
this command to tell configure where pgsql include
installation root directory is.
],
PGSQL_HEADERS="$withval"
# if not given argument, assume standard
)
AC_MSG_CHECKING(for PostgreSQL)
if test "${PGSQL}" = "no"; then
AC_MSG_RESULT(skipped)
else
AC_MSG_RESULT(testing)
# ******* Search pgsql headers *******
if test "${PGSQL_HEADERS}" = "yes"; then
AC_MSG_CHECKING(autodect pgsql headers)
# Autodetect
for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
PGSQL_INC_CHK(/include)
el[]PGSQL_INC_CHK(/include/pgsql)
el[]PGSQL_INC_CHK(/include/postgresql)
fi
done
elif test "${PGSQL_HEADERS}" = "no"; then
AC_MSG_CHECKING(for pgsql headers)
AC_MSG_RESULT(skipped)
else
AC_MSG_CHECKING(for pgsql headers in $PGSQL_HEADERS)
# Manual detection for <withval>
if test -f $PGSQL_HEADERS/libpq-fe.h; then
PGSQL_INCDIR=$PGSQL_HEADERS
fi
fi
if test -z "$PGSQL_INCDIR" ; then
PGSQL_HEADERS="no"
AC_MSG_RESULT(not found)
echo "Invalid PostgreSQL directory - unable to find libpq-fe.h."
else
AC_MSG_RESULT(yes [$PGSQL_INCDIR])
PGSQL_HEADERS="yes"
fi
if test "${PGSQL_HEADERS}" = "yes"; then
# ******* Search pgsql libs *********
if test "${PGSQL_LIBS}" = "yes"; then
AC_MSG_CHECKING(autodect pgsql libs)
# Autodetect
PGSQL_INCLUDE="-I$PGSQL_INCDIR"
PGSQL_LIBDIR=$PGSQL_DIR/lib
if test -f /usr/lib64/libpq.so ; then
PGSQL_LIBDIR=/usr/lib64
elif test -f $PGSQL_DIR/lib/pgsql/libpq.so ; then
PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
elif test -f $PGSQL_DIR/lib/postgresql/libpq.so ; then
PGSQL_LIBDIR=$PGSQL_DIR/lib/postgresql
elif test -f $PGSQL_DIR/lib/libpq.so ; then
PGSQL_LIBDIR=$PGSQL_DIR/lib
else
PGSQL_LIBDIR=""
fi
AC_MSG_RESULT($PGSQL_LIBDIR)
elif test "${PGSQL_LIBS}" = "no"; then
AC_MSG_CHECKING(for pgsql libs)
AC_MSG_RESULT(skipped)
else
AC_MSG_CHECKING(for pgsql libs in $PGSQL_LIBS)
# Manual detection for <withval>
if test -f $PGSQL_LIBS/libpq.a -o -f $PGSQL_LIBS/libpq.so; then
PGSQL_LIBDIR=$PGSQL_LIBS
fi
fi
if test -z "$PGSQL_LIBDIR" ; then
AC_MSG_RESULT(not found)
echo "Invalid PostgreSQL directory [$PGSQL_LIBDIR] - unable to find libpq.a or libpq.so."
else
#LDFLAGS="$TEMP_LDFLAGS -L$PGSQL_LIBDIR"
saved_CFLAGS=$CFLAGS
saved_LIBS=$LIBS
CFLAGS="-I$PGSQL_INCDIR"
LIBS="-L$PGSQL_LIBDIR"
AC_CHECK_LIB(pq, PQconnectStart, [
PGSQL_SUPPORT="yes"
TEMP_LIBS="$TEMP_LIBS -L$PGSQL_LIBDIR -lpq"
TEMP_CFLAGS="$TEMP_CFLAGS -I$PGSQL_INCDIR"
AC_DEFINE([HAVE_PGSQL],1,[Define to 1 if you have PostgreSQL support])
],
AC_MSG_ERROR(PostgreSQL support can't build without PostgreSQL libraries))
LDFLAGS=""
CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS
fi
fi # end pgsql-include , pgsql-libs
# end PostgreSQL detection
fi
#Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h)
AC_CHECK_FUNCS(get_current_dir_name)
# Check if v4l2 is available
SUPPORTED_V4L2=false
SUPPORTED_V4L2_old=false
if test "${V4L}" = "no"; then
AC_MSG_CHECKING(for V42L support)
AC_MSG_RESULT(skipping)
else
AC_CHECK_TYPE([struct v4l2_buffer],
[SUPPORTED_V4L2=true],
[SUPPORTED_V4L2=false],
[#include <sys/time.h>
#include <linux/videodev.h>])
AC_MSG_CHECKING(for V42L support)
if test x$SUPPORTED_V4L2 = xtrue; then
AC_MSG_RESULT(yes)
TEMP_CFLAGS="${TEMP_CFLAGS} -DMOTION_V4L2"
else
AC_MSG_RESULT(no)
fi
# linux/videodev.h doesn't include videodev2.h
if test x$SUPPORTED_V4L2 = xfalse; then
AC_MSG_CHECKING(for V42L *old* support)
AC_MSG_RESULT(testing)
AC_CHECK_HEADERS(linux/videodev2.h,[SUPPORTED_V4L2_old=true],[], [#include <asm/types.h>])
fi
if test x$SUPPORTED_V4L2_old = xtrue; then
TEMP_CFLAGS="${TEMP_CFLAGS} -DMOTION_V4L2 -DMOTION_V4L2_OLD"
SUPPORTED_V4L2=true
fi
fi
# Check sizes of integer types
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long int)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(int *)
AC_CHECK_SIZEOF(void *)
if test "$ac_cv_sizeof_short" = "4"; then
TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"short\""
else
if test "$ac_cv_sizeof_int" = "4"; then
TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"int\""
else
if test "$ac_cv_sizeof_long_int" = "4"; then
TEMP_CFLAGS="${TEMP_CFLAGS} -DTYPE_32BIT=\"long int\""
fi
fi
fi
OPTIMIZECPU="yes"
AC_ARG_WITH(optimizecpu,
[ --without-optimizecpu Exclude autodetecting platform and cpu type.
This will disable the compilation of gcc
optimizing code by platform and cpu.
],
OPTIMIZECPU="$withval"
)
DEVELOPER_FLAGS="no"
AC_ARG_WITH(developer-flags,
[ --with-developer-flags Causes practically all of the possible gcc
warning flags to be set. This may produce
a large amount of warnings.],
DEVELOPER_FLAGS="$withval"
)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
if test "${FreeBSD}" != ""; then
OPTIMIZECPU=""
fi
if test "${OPTIMIZECPU}" = "yes"; then
# Try to autodetect cpu type
CPU_NAME="unknown"
CPU_TYPE="unknown"
if test -e "/proc/cpuinfo" ; then
intel[[30]]="-march=i386"
intel[[32]]="-march=i386"
intel[[34]]="-march=i386"
intel[[40]]="-march=i486"
intel[[41]]="-march=i486"
intel[[42]]="-march=i486"
intel[[43]]="-march=i486"
intel[[44]]="-march=i486"
intel[[45]]="-march=i486"
intel[[47]]="-march=i486"
intel[[48]]="-march=i486"
intel[[51]]="-march=pentium"
intel[[52]]="-march=pentium"
intel[[54]]="-march=pentium-mmx"
intel[[56]]="-march=pentium-mmx"
intel[[61]]="-march=pentiumpro"
intel[[63]]="-march=pentium2"
intel[[65]]="-march=pentium2"