forked from CESNET/UltraGrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
3255 lines (2811 loc) · 107 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
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT([UltraGrid], [1.5], [[email protected]])
configure_flags="$*"
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([1.10])
AC_PREREQ(2.61)
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_MACRO_DIR([m4])
PARENT=`echo $PWD | sed -e 's%/[[^/]]*$%%'`
AC_DEFINE_UNQUOTED([CONFIG_FLAGS], ["$configure_flags"], [Flags passed to configure])
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_HEADER_STDC
AC_C_CONST
AC_TYPE_SIZE_T
AC_C_BIGENDIAN
AC_C_CHAR_UNSIGNED
AC_HEADER_STDBOOL
AH_BOTTOM([
#ifndef __cplusplus
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#else
# ifndef HAVE__BOOL
# ifdef __cplusplus
typedef bool _Bool;
# else
# define _Bool signed char
# endif
# endif
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
#endif
#endif // ! defined __cplusplus
])
AC_CHECK_HEADERS(stropts.h sys/filio.h sys/wait.h)
# -------------------------------------------------------------------------------------------------
POST_COMPILE_MSG=""
CFLAGS="$CFLAGS -I$srcdir"
CPPFLAGS="$CPPFLAGS -I$srcdir"
CXXFLAGS="$CXXFLAGS -I$srcdir -std=gnu++11"
LIB_MODULES=
AC_SUBST(INC)
AC_SUBST(LIBS)
AC_SUBST(OBJS)
AC_SUBST(POST_COMPILE_MSG)
AC_SUBST(COMMON_FLAGS)
AC_CHECK_SIZEOF([int *])
AC_C_BIGENDIAN(
AC_DEFINE([WORDS_BIGENDIAN], 1, [This is big endian system]),
AC_DEFINE([WORDS_SMALLENDIAN], 1, [This is little endian system])
)
if test "$ac_cv_prog_cc_c99" = no
then
AC_MSG_ERROR([Your compiler does not accept C99.])
fi
AC_CHECK_SIZEOF([size_t])
if test $ac_cv_sizeof_size_t -eq 8
then
WORD_LEN=64
else
WORD_LEN=32
fi
AC_DEFUN([HM_VERSION_WARNING], [
AC_MSG_WARN([If you still want to try with unsupported version of dependency,
you may want to try --disable-depends-version-check option.
If you find out that some unsupported version is working,
please let us know at [email protected].
])
])
m4_defun([MY_CHECK_FRAMEWORK],
[AC_CACHE_CHECK([if -framework ]$1[ works],[my_cv_framework_]$1,
[save_LIBS="$LIBS"
LIBS="$LIBS -framework ]$1["
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[my_cv_framework_]$1[=yes],
[my_cv_framework_]$1[=no])
])
LIBS="$save_LIBS"
if test "$my_cv_framework_]$1["="yes"; then
AC_DEFINE(AS_TR_CPP([HAVE_FRAMEWORK_]$1),1,
[Define if you have the ] $1 [ framework])
AS_TR_CPP([FRAMEWORK_]$1)="-framework ]$1["
AC_SUBST([FRAMEWORK_]AS_TR_CPP($1))
fi])
AC_MSG_CHECKING([GIT presence])
if which git
then
AC_MSG_CHECKING([checking GIT branch ])
git_branch=`git name-rev --name-only HEAD`
if test "$git_branch"; then
AC_DEFINE_UNQUOTED([GIT_BRANCH], "$git_branch", [Current GIT branch])
AC_MSG_RESULT($git_branch);
else
AC_MSG_RESULT(no);
fi
AC_MSG_CHECKING([checking GIT revision ])
git_rev=`git rev-parse --short HEAD`
if test "$git_rev"; then
AC_DEFINE_UNQUOTED([GIT_REV], "$git_rev", [Current GIT revision])
AC_MSG_RESULT($git_rev);
else
AC_MSG_RESULT(no);
fi
fi
AC_MSG_CHECKING([OS family])
if expr "$host_os" : ".*darwin.*" > /dev/null; then
system=MacOSX
AC_DEFINE([HAVE_MACOSX], [1], [This is Mac X OS])
elif expr "$host_os" : ".*mingw32.*" > /dev/null || expr "$host_os" : ".*msys.*" > /dev/null; then
system=Windows
AC_DEFINE([WIN32], [1], [This is an Windows OS])
else
system=Linux
AC_DEFINE([HAVE_LINUX], [1], [This is Linux])
fi
AC_MSG_RESULT($system);
AC_SUBST(system)
if test $build != $host; then
cross_compile=yes
else
cross_compile=no
fi
AC_MSG_CHECKING([OS kernel version (major)])
os_version_major=`uname -r |cut -d . -f 1`
AC_MSG_RESULT($os_version_major);
AC_MSG_CHECKING([OS kernel version (minor)])
os_version_minor=`uname -r |cut -d . -f 2`
AC_MSG_RESULT($os_version_minor);
if test $system = Linux; then
LDFLAGS="$LDFLAGS -Wl,--dynamic-list-data"
fi
if test $system = MacOSX; then
COMMON_OSX_FLAGS="-iframework data/redists -mmacosx-version-min=10.7 -stdlib=libc++"
CFLAGS="$CFLAGS $COMMON_OSX_FLAGS"
CPPFLAGS="$CPPFLAGS $COMMON_OSX_FLAGS"
CXXFLAGS="$CXXFLAGS $COMMON_OSX_FLAGS"
if test $WORD_LEN = 32; then
CUDA_FLAGS="$CUDA_FLAGS -Xcompiler -Wno-error=unused-command-line-argument-hard-error-in-future"
fi
LDFLAGS="$LDFLAGS $COMMON_OSX_FLAGS -headerpad_max_install_names"
OBJS="$OBJS src/utils/autorelease_pool.o"
fi
if test $system = Windows; then
NET_LIBS="-lsetupapi -lws2_32 -liphlpapi -loleaut32"
LIBS="$LIBS $NET_LIBS"
AC_CHECK_FUNCS(SetThreadDescription)
fi
AC_SUBST(NET_LIBS)
LINKER=$CXX
AC_SUBST(LINKER)
AC_SUBST(LDFLAGS)
AC_SUBST(CXXFLAGS)
AC_ARG_ENABLE(depends-version-check,
AS_HELP_STRING([--disable-depends-version-check], [Disable libraries version check]),
[version_check=$enableval],
[version_check=yes]
)
build_default=auto
AC_ARG_ENABLE(all,
AS_HELP_STRING([--enable-all], [Enable or disable all features (default is auto)]),
[build_default=$enableval],
[build_default=auto]
)
if test $system = MacOSX -a \( $os_version_major -lt 11 \) -a $version_check = yes
then
AC_MSG_WARN([*** Only OS X versions 10.7 and higher are supported.])
HM_VERSION_WARNING
AC_MSG_ERROR([Exiting due to unsatisfied dependency.])
fi
if test $system = MacOSX -o $system = Linux
then
CFLAGS="$CFLAGS -fPIC"
CXXFLAGS="$CXXFLAGS -fPIC"
CUDA_FLAGS="$CUDA_FLAGS -Xcompiler -fPIC"
CU_OBJ_SUFFIX="cu.o"
else # Windows
if test $WORD_LEN = 32; then
CUDA_FLAGS="-m32"
fi
CU_OBJ_SUFFIX="cu.lib"
fi
AC_SUBST(CUDA_FLAGS)
AC_ARG_VAR([ARCH], [Architecture to build for])
if test $target_cpu = x86_64 -o $target_cpu = i686
then
test -z "$ARCH" && ARCH="-msse4"
fi
CFLAGS="$CFLAGS $ARCH"
CXXFLAGS="$CXXFLAGS $ARCH"
AC_CHECK_HEADERS([termios.h])
AH_BOTTOM([
/*
* Mac OS X Snow Leopard does not have posix_memalign
* so supplying a fake one (Macs allocate always aligned pointers
* to a 16 byte boundry.
*/
#if defined HAVE_MACOSX
#include <Availability.h>
#ifndef __MAC_10_9
#include <errno.h>
#include <stdlib.h>
#ifndef POSIX_MEMALIGN
#define POSIX_MEMALIGN
static inline int posix_memalign(void **memptr, size_t alignment, size_t size);
static inline int posix_memalign(void **memptr, size_t alignment, size_t size)
{
if(!alignment || (alignment & (alignment - 1)) || alignment > 16) return EINVAL;
*memptr=malloc(size);
if(!*memptr) return ENOMEM;
return 0;
}
#endif // POSIX_MEMALIGN
#endif // !defined __MAC_10_9
#endif // defined HAVE_MACOSX
#undef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#undef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
])
# @param $1 name of the module
function MODULE_NAME() {
echo "lib/ultragrid/ultragrid_"$1".so"
}
# Adds the module to UltraGrid build system.
# @param $1 name of the module, should be in format <class>_<name> unless
# sure that the modular build won't take place
# @param $2 object files
# @param $3 libraries
# @param $4 static libraries (?)
AC_DEFUN([ADD_MODULE], [
TARGET=$(MODULE_NAME "$1")
LIB_OBJS=$LIB_OBJS" "$2
LIB_MODULES=$LIB_MODULES" "$3
AM_CONDITIONAL([IS_TARGET], [test x$1 != x])
AM_COND_IF([IS_TARGET],
[
MODULES="$MODULES $TARGET"
TARGETS="$TARGETS
$TARGET: "$2" $4
\$(MKDIR_P) lib/ultragrid
\$(LINKER) \$(LDFLAGS) -shared -Wl,-soname,ultragrid_"$1.so" "$2" -o lib/ultragrid/ultragrid_"$1".so "$3" $4
"
])
])
# -------------------------------------------------------------------------------------------------
# Additional macros
# -------------------------------------------------------------------------------------------------
AC_DEFUN([CUDA_MESSAGE], [
if test -z "$cuda_msg_defined"; then
POST_COMPILE_MSG="$POST_COMPILE_MSG\n***\nYou have compiled in sort of CUDA code.\nIn order to use use it compression and \
decompression, you will need to have CUDA libraries visible to your OS.\n\
If not done so, you can accomplish this by adding line:\n\
export LD_LIBRARY_PATH=$CUDA_LIB_PATH:\\\$\$LD_LIBRARY_PATH\n\
to your .bashrc file (in home directory). To take effect immediatelly, you will need to enter:\n\
exec bash\n***\n"
cuda_msg_defined=yes
fi
])
AC_DEFUN([DEFINE_CUDA], [
if test -z "$cuda_var_defined"; then
AC_DEFINE([HAVE_CUDA], [1], [CUDA is present on the system])
if test $system = Windows; then
# It is twice by intent - as an object to force dependency
# (== build the object), as a lib to be at the end of the
# link list (it is a library) in MSW. TODO: make it prettier
# somehow. The same applies also for other CUDA objs/libs.
CUDA_COMMON_OBJ=src/cuda_wrapper.$CU_OBJ_SUFFIX
CUDA_COMMON_LIB=src/cuda_wrapper.$CU_OBJ_SUFFIX
DLL_LIBS="$DLL_LIBS src/cuda_wrapper.cu.dll"
else
CUDA_COMMON_OBJ=src/cuda_wrapper.$CU_OBJ_SUFFIX
CUDA_COMMON_LIB=
fi
cuda_var_defined=yes
fi
])
AC_SUBST(DLL_LIBS)
if test $system = Windows
then
AC_MSG_CHECKING([if_nametoindex])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <windows.h>
#include <iphlpapi.h>
]], [[
if_nametoindex("eth");]]
)], HAVE_IF_NAMETOINDEX=yes, HAVE_IF_NAMETOINDEX=no)
AC_MSG_RESULT([$HAVE_IF_NAMETOINDEX])
if test $HAVE_IF_NAMETOINDEX = yes; then
AC_DEFINE([HAVE_IF_TONAMEINDEX], 1, [Function if_nametoindex is present.])
fi
else
AC_CHECK_FUNCS(if_nametoindex)
fi
AC_CHECK_FUNCS(strtok_r)
AC_CHECK_FUNCS(drand48)
if test $ac_cv_func_drand48 = no
then
AC_DEFINE([NEED_DRAND48], 1, [We need custom implementation of drand48.])
fi
# -------------------------------------------------------------------------------------------------
# Check for standard size types. The defaults are only valid on some
# systems so we hope that <inttypes.h> exists when they're wrong.
AC_CHECK_TYPE(int8_t, signed char)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(int32_t, long)
AC_CHECK_TYPE(int64_t, long long)
# Some systems have these in <stdint.h>, just to be difficult...
AC_CACHE_CHECK(for uint8_t in <stdint.h>, ucl_cv_uint8_t_in_stdint_h,
AC_EGREP_HEADER(uint8_t,
stdint.h,
ucl_cv_uint8_t_in_stdint_h=yes,
ucl_cv_uint8_t_in_stdint_h=no))
if test $ucl_cv_uint8_t_in_stdint_h = "no"
then
AC_CHECK_TYPE(uint8_t, unsigned char)
fi
AC_CACHE_CHECK(for uint16_t in <stdint.h>, ucl_cv_uint16_t_in_stdint_h,
AC_EGREP_HEADER(uint16_t,
stdint.h,
ucl_cv_uint16_t_in_stdint_h=yes,
ucl_cv_uint16_t_in_stdint_h=no))
if test $ucl_cv_uint16_t_in_stdint_h = "no"
then
AC_CHECK_TYPE(uint16_t, unsigned short)
fi
AC_CACHE_CHECK(for uint32_t in <stdint.h>, ucl_cv_uint32_t_in_stdint_h,
AC_EGREP_HEADER(uint32_t,
stdint.h,
ucl_cv_uint32_t_in_stdint_h=yes,
ucl_cv_uint32_t_in_stdint_h=no))
if test $ucl_cv_uint32_t_in_stdint_h = "no"
then
AC_CHECK_TYPE(uint32_t, unsigned int)
fi
# -------------------------------------------------------------------------------------------------
# GCC-specific warning flags
if test "$GCC" = yes
then
CFLAGS="$CFLAGS -pipe -W -Wcast-qual -Wcast-align -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations"
CXXFLAGS="$CXXFLAGS -pipe -W -Wcast-qual -Wcast-align -Wmissing-declarations"
fi
# ------------------------------------------------------------------------------------------------
# Dynamic libraries stuff
#
build_libraries=no
AC_ARG_ENABLE(plugins, AS_HELP_STRING([--enable-plugins], [build modules as libraries (default is off)]),
[build_libraries=$enableval])
if test "$build_libraries" = yes
then
if test "$system" = "Linux"
then
LIBS="$LIBS -ldl"
LDFLAGS="$LDFLAGS -rdynamic"
else
AC_MSG_WARN([*** Building libraries is not supported with other system than Linux])
build_libraries=no
fi
AC_DEFINE([BUILD_LIBRARIES], [1], [Build drivers as a standalone libraries])
fi
# -------------------------------------------------------------------------------------------------
# Check for libraries
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(inet_addr, nsl)
AC_CHECK_LIB(rt, timer_create)
AC_CHECK_FUNC(sin, MATHLIBS="", MATHLIBS="-lm")
AC_CHECK_LIB(ieee, main, [MATHLIBS="-lieee $MATHLIBS"])
AC_SUBST(MATHLIBS)
# -------------------------------------------------------------------------------------------------
# See if this system supports sched_setscheduler()
AC_CHECK_FUNCS(sched_setscheduler)
use_rt=no
AC_ARG_ENABLE(rt,
AS_HELP_STRING([--enable-rt], [enable RT priority]),
[use_rt=$enableval])
if test "$use_rt" = "yes"; then
AC_DEFINE([USE_RT], [1], [We use RT priority])
fi
# -------------------------------------------------------------------------------------------------
# Try to find the pthread library...
case "$host" in
*-*-freebsd4*)
CFLAGS="$CFLAGS -pthread"
;;
*)
AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread", AC_MSG_ERROR([Require POSIX thread]))
;;
esac
# -------------------------------------------------------------------------------------------------
debug_output=no
profile=no
ipv6=yes
AC_ARG_ENABLE(profile,
[ --enable-profile enable profiling],
[if test $enableval = yes
then
if test "$GCC" = yes
then
CFLAGS="$CFLAGS -pg"
profile=yes
else
AC_MSG_ERROR([Do not know how to enable profiling for $CC])
fi
fi])
AC_ARG_ENABLE(debug,
[ --enable-debug enable debug messages and code],
[if test $enableval = yes
then
AC_DEFINE([DEBUG], [1], [We build with debug messages])
debug_output=yes
DEBUG_FLAGS="-Werror -Wno-error=cast-qual -Wno-error=cast-align -Wno-error=strict-aliasing"
CFLAGS="$CFLAGS $DEBUG_FLAGS"
CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
fi])
AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--disable-ipv6], [disable ipv6]),
[if test $enableval = no
then
ipv6=no
fi])
if test "$ipv6" != no
then
AC_DEFINE([HAVE_IPv6], [1], [Enable IPv6 support])
fi
# ----------------------------------------------------------------------
# environment variables
# ----------------------------------------------------------------------
AC_ARG_VAR([AJA_DIRECTORY], [Directory to AJA NTV2 SDK.])
AC_ARG_VAR([BLUE_LATEST_SDK], [Placement of Bluefish444 SDK.])
AC_ARG_VAR([CINEFORM_DIRECTORY], [Directory to Cineform SDK.])
AC_ARG_VAR([CUDA_PATH], [Directory of your Nvidia toolkit instalation.])
AC_ARG_VAR([DELTACAST_DIRECTORY], [Placement of VideoMasterHD directory (Deltacast).])
AC_ARG_VAR([DVS_DIRECTORY], [Path to DVS installation.])
AC_ARG_VAR([GENICAM_GENTL64_PATH], [XIMEA SDK library path])
AC_ARG_VAR([NTV2_ROOT], [Directory to AJA NTV2 SDK (ends with ntv2projects).])
AC_ARG_VAR([SAGE_DIRECTORY], [Directory of your SAGE installation.])
# -------------------------------------------------------------------------------------------------
# GL common
# -------------------------------------------------------------------------------------------------
OPENGL=no
SAVED_LIBS=$LIBS
AC_CHECK_HEADER(GL/gl.h)
AC_CHECK_HEADER(GL/glew.h)
AC_CHECK_HEADER(GL/glx.h)
AC_CHECK_LIB(GL, glBindTexture)
AC_CHECK_LIB(GL, glXCreateNewContext)
AC_CHECK_LIB(GLEW, glewInit)
AC_CHECK_LIB(glew32, glewInit)
AC_CHECK_LIB(X11, XCreateWindow)
LIBS=$SAVED_LIBS
GL_COMMON_OBJ="src/gl_context.o"
# Linux
if test "$system" = Linux -a \
"$ac_cv_header_GL_gl_h" = yes -a \
"$ac_cv_header_GL_glew_h" = yes -a \
"$ac_cv_header_GL_glx_h" = yes -a \
"$ac_cv_lib_GL_glBindTexture" = yes -a \
"$ac_cv_lib_GL_glXCreateNewContext" = yes -a \
"$ac_cv_lib_GLEW_glewInit" = yes -a \
"$ac_cv_lib_X11_XCreateWindow" = yes
then
OPENGL=yes
OPENGL_LIB="-lGLEW -lGL -lX11"
GL_COMMON_OBJ="$GL_COMMON_OBJ src/glx_common.o src/x11_common.o"
fi
# Mac
if test "$system" = MacOSX
then
OPENGL=yes
OPENGL_LIB="-framework OpenGL -framework Cocoa"
GL_COMMON_OBJ="$GL_COMMON_OBJ src/mac_gl_common.o"
fi
# Win32
if test "$system" = Windows -a "$ac_cv_lib_glew32_glewInit" = yes -a \
"$ac_cv_header_GL_glew_h" = yes
then
OPENGL=yes
GL_COMMON_OBJ="$GL_COMMON_OBJ src/win32_gl_common.o"
OPENGL_LIB="-lopengl32 -lglew32 -lgdi32"
fi
# -------------------------------------------------------------------------------------------------
# Do we have FireWire/DV support?
case "$host_os" in
*freebsd*)
AC_CHECK_HEADER(dev/firewire/firewire.h,[
AC_DEFINE([HAVE_FIREWIRE_DV_FREEBSD], [1], [We have Firewire DV])
])
;;
esac
# This should be conditional on finding libdv
AC_DEFINE([HAVE_DV_CODEC], [1], [We have libdv])
# -------------------------------------------------------------------------------------------------
# Try to find the SDK for the DVS cards
dvs=no
dvs_req=$build_default
AC_ARG_ENABLE(dvs,
[ --disable-dvs disable DVS (default is auto)]
[ Requires: DVS_SDK],
[dvs_req=$enableval])
case "$system" in
MacOSX)
DVS_SDK_SUBDIR="universal"
;;
Linux)
DVS_SDK_SUBDIR="linux-x86_64"
;;
Windows)
DVS_SDK_SUBDIR="win32"
;;
esac
if test -n "$DVS_DIRECTORY"
then
DVS_HDR_PATH=$DVS_DIRECTORY/development/header
DVS_LIB=$DVS_DIRECTORY/${DVS_SDK_SUBDIR}/lib
else
DVS_HDR_PATH=sdk4.0.1.17/development/header
DVS_LIB=sdk4.0.1.17/${DVS_SDK_SUBDIR}/lib
fi
AC_ARG_WITH(dvs,
[ --with-dvs=DIR specify location of DVS SDK],
[DVS_HDR_PATH=$withval/development/header
DVS_LIB=$withval/${DVS_SDK_SUBDIR}/lib],
)
SAVED_CFLAGS=$CFLAGS
SAVED_CPPFLAGS=$CPPFLAGS
CFLAGS="$CFLAGS -I${DVS_HDR_PATH}"
CPPFLAGS="$CPPFLAGS -I${DVS_HDR_PATH}"
AC_CHECK_HEADER(dvs_clib.h, FOUND_DVS_H=yes, FOUND_DVS_H=no)
CFLAGS=$SAVED_CFLAGS
CPPFLAGS=$SAVED_CPPFLAGS
SAVED_LIBS=$LIBS
if test $system = MacOSX
then
LIBS="$LIBS -framework IOKit"
fi
AC_CHECK_LIB(dvsoem, sv_open, FOUND_DVS_L=yes, FOUND_DVS_L=no, -L${DVS_LIB})
LIBS=$SAVED_LIBS
if test $dvs_req != no -a $FOUND_DVS_H = yes -a $FOUND_DVS_L = yes
then
DVS_INC=-I${DVS_HDR_PATH}
DVS_LIB="-L${DVS_LIB} -ldvsoem"
if test $system = Linux; then
DVS_LIB="$DVS_LIB -ldl"
fi
DVS_CAP_OBJ="src/video_capture/dvs.o"
DVS_DISP_OBJ="src/video_display/dvs.o"
AC_DEFINE([HAVE_DVS], [1], [Build with DVS support])
DVS_LIB="$DVS_LIB"
if test $system = MacOSX
then
DVS_LIB="$DVS_LIB -framework IOKit"
fi
ADD_MODULE("vidcap_dvs", "$DVS_CAP_OBJ", "$DVS_LIB")
ADD_MODULE("display_dvs", "$DVS_DISP_OBJ", "$DVS_LIB")
INC="$INC $DVS_INC"
dvs=yes
fi
if test $dvs_req = yes -a $dvs = no; then
AC_MSG_ERROR([DVS not found.])
fi
# -------------------------------------------------------------------------------------------------
# Blackmagic stuff
DECKLINK_OBJ=
DECKLINK_INC=
DECKLINK_LIB=
DECKLINK_PATH=
decklink=no
decklink_req=$build_default
AC_ARG_ENABLE(decklink,
[ --disable-decklink disable DeckLink (default is auto)]
[ Requires: DesktopVideo],
[decklink_req=$enableval])
DECKLINK_INC=
case "$system" in
MacOSX)
if test -z $DECKLINK_INC; then
DECKLINK_INC=$srcdir/DeckLink/Mac
fi
OLD_LIBS=$LIBS
LIBS="$LIBS -framework CoreFoundation"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "DeckLink/Mac/DeckLinkAPI.h"
]],
[[IDeckLinkIterator *deckLinkIter = CreateDeckLinkIteratorInstance();]])],FOUND_DECKLINK=yes,FOUND_DECKLINK=no)
LIBS=$OLD_LIBS
if test $FOUND_DECKLINK = yes; then
DECKLINK_LIB="$DECKLINK_LIB -framework CoreFoundation"
fi
AC_LANG_POP(C++)
;;
Windows)
if test -z $DECKLINK_INC; then
DECKLINK_INC=$srcdir/DeckLink/Windows
fi
SAVED_LIBS=$LIBS
LIBS="$LIBS -lole32"
AC_LANG_PUSH(C++)
AC_MSG_CHECKING([DeckLink usability])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "DeckLink/Windows/DeckLinkAPI_h.h"
#include "DeckLink/Windows/DeckLinkAPIVersion.h"
#include <objbase.h>
]],
[[IDeckLinkIterator *deckLinkIter; CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void **) deckLinkIter);]])],FOUND_DECKLINK=yes,FOUND_DECKLINK=no)
LIBS=$SAVED_LIBS
if test $FOUND_DECKLINK = yes; then
DECKLINK_LIB="$DECKLINK_LIB -lole32"
fi
AC_MSG_RESULT([$FOUND_DECKLINK])
AC_LANG_POP(C++)
;;
*)
if test -z $DECKLINK_INC; then
DECKLINK_INC=$srcdir/DeckLink/Linux
fi
AC_CHECK_FILE(${DECKLINK_INC}/DeckLinkAPI.h, FOUND_DECKLINK_H=yes, FOUND_DECKLINK_H=no)
AC_CHECK_FILE(${DECKLINK_INC}/DeckLinkAPIDispatch.cpp, FOUND_DECKLINK_SRC=yes, FOUND_DECKLINK_SRC=no)
AC_CHECK_LIB(DeckLinkAPI, main, FOUND_DECKLINK_L=yes, FOUND_DECKLINK_L=no)
#if test $FOUND_DECKLINK_H = yes -a $FOUND_DECKLINK_SRC = yes -a $FOUND_DECKLINK_L = yes; then
if test $FOUND_DECKLINK_H = yes -a $FOUND_DECKLINK_SRC = yes; then
FOUND_DECKLINK=yes
DECKLINK_LIB="$DECKLINK_LIB -ldl"
else
FOUND_DECKLINK=no
fi
;;
esac
if test $decklink_req != no -a $FOUND_DECKLINK = yes
then
DECKLINK_PATH=${DECKLINK_INC}
DECKLINK_INC=-I${DECKLINK_INC}
DECKLINK_CAP_OBJ="src/blackmagic_common.o src/video_capture/decklink.o"
DECKLINK_DISP_OBJ="src/blackmagic_common.o src/video_display/decklink.o"
DECKLINK_SOUND_PLAY_OBJ="src/blackmagic_common.o src/audio/playback/decklink.o"
if test $system = "Windows"; then
OBJS="$OBJS src/video_capture/DeckLinkAPI_i.o"
else
OBJS="$OBJS src/video_capture/DeckLinkAPIDispatch.o"
fi
AC_DEFINE([HAVE_DECKLINK], [1], [Build with DeckLink support])
ADD_MODULE("vidcap_decklink", "$DECKLINK_CAP_OBJ", "$DECKLINK_LIB")
ADD_MODULE("display_decklink", "$DECKLINK_DISP_OBJ", "$DECKLINK_LIB")
ADD_MODULE("aplay_decklink", "$DECKLINK_SOUND_PLAY_OBJ", "$DECKLINK_LIB")
decklink=yes
INC="$INC $DECKLINK_INC"
else
DECKLINK_PATH=
fi
if test $decklink_req = yes -a $decklink = no; then
AC_MSG_ERROR([DeckLink not found.])
fi
AC_SUBST(DECKLINK_PATH)
# -------------------------------------------------------------------------------------------------
# Bluefish444 stuff
# -------------------------------------------------------------------------------------------------
BLUEFISH444_PATH=
BLUEFISH444_CAP_OBJ=
BLUEFISH444_DISP_OBJ=
BLUEFISH444_INC=
BLUEFISH444_LIB=
bluefish444=no
blue_audio=no
AC_ARG_ENABLE(bluefish444,
[ --disable-bluefish444 disable Bluefish444 suppport (default is auto)]
[ Requires: bluefish444_SDK],
[bluefish444_req=$enableval],
[bluefish444_req=$build_default]
)
AC_ARG_ENABLE(blue-audio,
AS_HELP_STRING([--disable-blue-audio], [disable Bluefish444 audio suppport (default is auto)]),
[blue_audio_req=$enableval],
[blue_audio_req=$build_default]
)
BLUEFISH444_PATH=$BLUE_LATEST_SDK
AC_ARG_WITH(bluefish444,
[ --with-bluefish444=DIR specify location of Bluefish444],
[BLUEFISH444_PATH=$withval
])
SAVED_LIBS=$LIBS
SAVED_CXXFLAGS=$CXXFLAGS
SAVED_CPPFLAGS_SAVE=$CPPFLAGS
if test -n "$BLUEFISH444_PATH"; then
if test $system = Linux; then
BLUEFISH444_INC="-I$BLUEFISH444_PATH/release/driver/inc"
else
BLUEFISH444_INC="-I$BLUEFISH444_PATH/Inc -IBlueVelvetC/BlueVelvetC"
fi
CXXFLAGS="$CXXFLAGS $BLUEFISH444_INC "
CPPFLAGS="$CPPFLAGS $BLUEFISH444_INC"
if test $system = Windows; then
BLUEFISH444_LIB="-L$BLUEFISH444_PATH/Lib -LBlueVelvetC/Release $BLUEFISH444_LIB"
fi
LIBS="$LIBS $BLUEFISH444_LIB"
fi
AC_LANG_PUSH(C++)
BLUE_L=no
BLUE_H=no
if test $system = Windows
then
AC_CHECK_HEADERS([BlueVelvetC_UltraGrid.h],
[BLUE_H=yes], [BLUE_H=no],
[[
#include <objbase.h>
]]
)
if test $WORD_LEN -eq 64; then
BLUE_AUDIO_LIB="BlueHancUtils64"
BLUEFISH444_LIB_NAME=BlueVelvetC64
BLUE_AUX=BlueVelvet64
else
BLUE_AUDIO_LIB="BlueHancUtils"
BLUEFISH444_LIB_NAME=BlueVelvetC_UltraGrid
BLUE_AUX=BlueVelvet3
fi
AC_CHECK_LIB($BLUEFISH444_LIB_NAME, bfcFactory, [BLUE_L=yes],
[BLUE_L=no])
BLUEFISH444_LIB="$BLUEFISH444_LIB -l$BLUE_AUX -l$BLUEFISH444_LIB_NAME"
else
if test $system = Linux
then
AC_CHECK_HEADERS([BlueVelvet.h], [BLUE_H=yes], [BLUE_H=no])
if test $WORD_LEN -eq 64; then
AC_CHECK_LIB(BlueVelvet64, BlueVelvetFactory, [BLUE_L=yes], [BLUE_L=no])
BLUE_AUDIO_LIB="BlueANCUtils64"
BLUEFISH444_LIB="$BLUEFISH444_LIB -lBlueVelvet64"
else
AC_CHECK_LIB(BlueVelvet, BlueVelvetFactory, [BLUE_L=yes], [BLUE_L=no])
BLUE_AUDIO_LIB="BlueANCUtils"
BLUEFISH444_LIB="$BLUEFISH444_LIB -lBlueVelvet"
fi
fi
fi
if test $system = Windows -o $system = Linux;then
AC_CHECK_LIB($BLUE_AUDIO_LIB, hanc_decoder_ex, [HAVE_BLUE_AUDIO_L=yes],
[HAVE_BLUE_AUDIO_L=no])
if test $HAVE_BLUE_AUDIO_L = yes -a $blue_audio_req != no; then
BLUEFISH444_LIB="$BLUEFISH444_LIB -l$BLUE_AUDIO_LIB"
blue_audio=yes
fi
fi
if test $BLUE_H = yes -a $BLUE_L = yes -a $bluefish444_req != no
then
BLUEFISH444_CAP_OBJ="src/video_capture/bluefish444.o"
BLUEFISH444_DISP_OBJ="src/video_display/bluefish444.o"
AC_DEFINE([HAVE_BLUEFISH444], [1], [Build with Bluefish444 support])
ADD_MODULE("vidcap_bluefish444", "$BLUEFISH444_CAP_OBJ", "$BLUEFISH444_LIB")
ADD_MODULE("display_bluefish444", "$BLUEFISH444_DISP_OBJ", "$BLUEFISH444_LIB")
if test x$blue_audio = xyes; then
AC_DEFINE([HAVE_BLUE_AUDIO], [1], [Build with Bluefish444 audio support])
fi
INC="$INC $BLUEFISH444_INC"
bluefish444=yes
fi
AC_LANG_POP(C++)
LIBS=$SAVED_LIBS
CXXFLAGS=$SAVED_CXXFLAGS
CPPFLAGS=$SAVED_CPPFLAGS_SAVE
if test $bluefish444_req = yes -a $bluefish444 = no; then
AC_MSG_ERROR([Bluefish444 not found]);
fi
# -------------------------------------------------------------------------------------------------
# AJA stuff
# -------------------------------------------------------------------------------------------------
AJA_CXXFLAGS=
AJA_INC=
AJA_LIB=
AJA_CAP_OBJ=
AJA_PATH=
aja=no
AC_ARG_ENABLE(aja,
[ --disable-aja disable AJA suppport (default is auto)]
[ Requires: NTV2_SDK],
[aja_req=$enableval],
[aja_req=$build_default])
if test -n "$NTV2_ROOT"; then
AJA_PATH=$NTV2_ROOT/..
fi
if test -n "$AJA_DIRECTORY"; then
AJA_PATH=$AJA_DIRECTORY
fi
AC_ARG_WITH(aja,
[ --with-aja=DIR specify location of NTV2],
[AJA_PATH=$withval
])
# In lines below, there is a compatibility check for NTV2 12.x (Linux only).
# For macOS, only NTV2 13 is checked/supported.
if test $system = Linux
then
if test -n "$AJA_PATH"
then
# NTV2 SDK 12.x
AC_CHECK_FILES(${AJA_PATH}/lib/libaja.a ${AJA_PATH}/lib/libajastuff.a, FOUND_LIBAJA=yes, FOUND_LIBAJA=no)
# NTV2 SDK 13.x
if test "$FOUND_LIBAJA" = no; then
AC_CHECK_FILES(${AJA_PATH}/lib/libajantv2.a, FOUND_LIBAJA=yes, FOUND_LIBAJA=no)
NTV2_13=yes
fi
fi
else
if test $system = Windows
then
if test "$aja_req" = yes
then
ADD_MODULE("aja", "src/aja_win32_stub.o", "-laja")
aja=yes
fi
else # MacOSX
AC_CHECK_LIB(ajantv2, main, [FOUND_LIBAJA=yes], [FOUND_LIBAJA=no])
if test "$FOUND_LIBAJA" = yes; then
AC_CHECK_FILE(${AJA_PATH}/ajalibraries/ajantv2/includes/ajatypes.h, FOUND_LIBAJA=yes, FOUND_LIBAJA=no)
fi
fi
fi
# this is used only for Mac and Linux
if test "$aja_req" != no -a "$FOUND_LIBAJA" = yes
then
aja=yes
if test $system = Linux -a "$NTV2_13" != yes
then
AJA_INC="$AJA_INC -I${AJA_PATH}/ntv2projects/classes -I${AJA_PATH}/ajaapi -I${AJA_PATH}/ntv2projects/includes -I${AJA_PATH}/ntv2projects/democlasses"
AJA_LIB="${AJA_PATH}/lib/libaja.a ${AJA_PATH}/lib/libajastuff.a"
else # ntv2 13.x
AJA_INC="$AJA_INC -I${AJA_PATH}/ajalibraries/ajantv2/includes -I${AJA_PATH}/ajalibraries/ajantv2/src/mac -I${AJA_PATH}/ajaapps/crossplatform/demoapps -I${AJA_PATH}/ajalibraries -I${AJA_PATH}/ajaapps/crossplatform/demoapps/ntv2capture"
fi
if test $system = Linux
then
AJA_CXXFLAGS="-DAJALinux -DAJA_LINUX"
if test "$NTV2_13" = yes
then
AJA_INC="$AJA_INC -I${AJA_PATH}/ajalibraries/ajantv2/src/lin"
AJA_LIB="${AJA_PATH}/lib/libajantv2.a"
fi
else # mac
AJA_CXXFLAGS="-DAJAMac -DAJA_MAC"
AJA_LIB="-lajantv2"
fi
AJA_CAP_OBJ="src/video_capture/aja.o"
AJA_DISP_OBJ="src/video_display/aja.o"
AC_DEFINE([HAVE_AJA], [1], [Build with AJA support])
ADD_MODULE("aja", "$AJA_CAP_OBJ $AJA_DISP_OBJ", "$AJA_LIB")
INC="$INC $AJA_INC"
CXXFLAGS="$CXXFLAGS $AJA_CXXFLAGS"
fi
if test $aja_req = yes -a $aja = no; then
AC_MSG_ERROR([AJA not found]);
fi
# -------------------------------------------------------------------------------------------------
# DELTACAST stuff
DELTACAST_PATH=
DELTACAST_CAP_OBJ=
DELTACAST_DISP_OBJ=
DELTACAST_INC=
DELTACAST_LIB=
deltacast=no
deltacast_found=no
AC_ARG_ENABLE(deltacast,
[ --disable-deltacast disable DELTACAST suppport (default is auto)]
[ Requires: VideoMasterHD_SDK],
[deltacast_req=$enableval],
[deltacast_req=$build_default]
)
DELTACAST_PATH=$DELTACAST_DIRECTORY
AC_ARG_WITH(deltacast,
[ --with-deltacast=DIR specify location of DELTACAST],
[DELTACAST_PATH=$withval
])
if test $system = Linux -o $system = Windows
then
AC_LANG_PUSH(C++)
if test $system = Windows; then
HEADER_SUBDIR="Header"
else
HEADER_SUBDIR="Include"
fi
if test -n "$DELTACAST_PATH"
then