-
Notifications
You must be signed in to change notification settings - Fork 53
/
configure.ac
3564 lines (3087 loc) · 132 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.9],[[email protected]])
configure_flags="$*"
AC_CANONICAL_TARGET
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_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_EGREP
AC_PROG_INSTALL
AC_C_CONST
AC_TYPE_SIZE_T
AC_C_BIGENDIAN
AC_C_CHAR_UNSIGNED
AC_SYS_LARGEFILE
PKG_PROG_PKG_CONFIG([], [PKG_CONFIG=])
if test -z "$PKG_CONFIG"; then
PKG_CONFIG=$(command -v pkgconf)
PKG_PROG_PKG_CONFIG
fi
# -------------------------------------------------------------------------------------------------
POST_COMPILE_MSG=""
CXXFLAGS="${CXXFLAGS+$CXXFLAGS }-std=gnu++17"
CUDA_FLAGS="${CUDA_FLAGS-}"
INC="${INC-}"
LDFLAGS="${LDFLAGS-}"
LIB_MODULES= # modules libraries
UG_LIB_MODULES=
LIB_OBJS= # module object files
UG_LIB_OBJS=
LIBS="${LIBS-}"
MODULES=
OBJS=
TARGETS=
AC_SUBST(INC)
AC_SUBST(LIBS)
AC_SUBST(ULTRAGRID_LIBS)
AC_SUBST(ULTRAGRID_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])
)
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].
])
])
WARNINGS=
# variant of AC_MSG_WARN that in addition stores the message for repost at the end
m4_defun([UG_MSG_WARN], [
AC_MSG_WARN([$1])
WARNINGS="${WARNINGS}$1\n"
])
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=$(srcdir=$(dirname "$0"); cd "$srcdir"; 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=$(srcdir=$(dirname "$0"); cd "$srcdir"; 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
# TODO: remove plaform macros definitions
AC_MSG_CHECKING([OS family])
if test "$host_vendor" = "apple"; then
system=MacOSX
AC_DEFINE([HAVE_MACOSX], [1], [This is Mac X OS])
APPEXT=.app
elif expr "$host_os" : ".*mingw32.*" > /dev/null || expr "$host_os" : ".*msys.*" > /dev/null; then
system=Windows
APPEXT=.exe
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 # don't confuse with autoconf's $cross_compiling - ours is more correct
# because $cross_compiling=no if we are cross-compiling but are able to
# execute the compiled binary (eg. using wine-binfmt)
else
cross_compile=no
fi
if test $system = Linux; then
AC_CHECK_HEADERS([linux/version.h])
LDFLAGS="$LDFLAGS -Wl,--dynamic-list-data"
fi
if test $system = MacOSX; then
MACOS_LEGACY=no
os_version_major=`uname -r |cut -d . -f 1`
if test $os_version_major -lt 19; then # Darwin 19.0.0 is macOS 10.15
MACOS_LEGACY=yes
fi
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/macos.o"
AC_SUBST(MACOS_LEGACY)
fi
if test $system = Windows; then
LIBS="$LIBS -lsetupapi -lws2_32 -liphlpapi -lole32 -loleaut32"
LIBS="$LIBS -ldbghelp"
AC_CHECK_FUNCS(SetThreadDescription)
fi
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 = Windows; then
CUDA_FLAGS="$CUDA_FLAGS -Xcompiler -FS -Xcompiler -GS- -Xcompiler -MD"
else
CFLAGS="$CFLAGS -fPIC"
CXXFLAGS="$CXXFLAGS -fPIC"
CUDA_FLAGS="$CUDA_FLAGS -Xcompiler -fPIC"
fi
AC_SUBST(CUDA_FLAGS)
AC_ARG_VAR([ARCH], [Architecture to build for])
if test $target_cpu = x86_64 -o $target_cpu = i686
then
ARCH=${ARCH--msse4.1}
fi
if test $target_cpu = armv7l || { test $target_cpu = aarch64 && \
test $ac_cv_sizeof_int_p -eq 4; }
then
LIBS="${LIBS:+$LIBS }-latomic" # needed for atomic_uint64_t
fi
CFLAGS="$CFLAGS${ARCH+ $ARCH}"
CXXFLAGS="$CXXFLAGS${ARCH+ $ARCH}"
LDFLAGS="$LDFLAGS${ARCH+ $ARCH}"
if expr "$CFLAGS" : '.*-O' >/dev/null; then
OFAST=""
else
OFAST="-Ofast"
fi
AC_SUBST(OFAST)
AC_CHECK_HEADERS([termios.h])
# 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
add_module() {
TARGET=lib/ultragrid/ultragrid_"$1".so
if `echo "$1" | grep -q 'vcompress\|vdecompress\|display_video_mix'`; then
LIB_OBJS="$LIB_OBJS $2"
LIB_MODULES="$LIB_MODULES $3"
else
UG_LIB_OBJS="$UG_LIB_OBJS $2"
UG_LIB_MODULES="$UG_LIB_MODULES $3"
fi
if test -n "$1"; then
MODULES="$MODULES $TARGET"
TARGETS="$TARGETS
$TARGET: $2
\$(MKDIR_P) lib/ultragrid
\$(LINKER) \$(LDFLAGS) -shared -Wl,-soname,ultragrid_$1.so $2 -o lib/ultragrid/ultragrid_$1.so $3
"
fi
}
# ---------------------------------------------------------------------
# Dylib bundler
# ---------------------------------------------------------------------
if test $system = MacOSX; then
AC_PATH_PROGS(DYLIBBUNDLER, dylibbundler, [true])
if test "$DYLIBBUNDLER" = true; then
UG_MSG_WARN([Cannot find dylibbundler. We cannot put libraries into a bundle so it probably will not be portable.])
else
AC_MSG_CHECKING([dylibbundler version])
dyl_ver=$($DYLIBBUNDLER -V >/dev/null 2>&1 && dylibbundler -V | cut -d\ -f2 || echo unknown)
AC_MSG_RESULT($dyl_ver);
if test $dyl_ver = unknown || expr "$dyl_ver" \<= 2 >/dev/null; then
UG_MSG_WARN([Original dylib bundler detected, recommending v2 instead (https://github.com/SCG82/macdylibbundler)])
else
DYLIBBUNDLER="$DYLIBBUNDLER -f" # bundle also frameworks
fi
fi
fi
AC_SUBST(DYLIBBUNDLER)
# ---------------------------------------------------------------------
# AsciiDoc
# ---------------------------------------------------------------------
AC_PATH_PROGS(A2X, [asciidoctor a2x], [:])
AC_SUBST(A2X)
AC_SUBST(MANPAGES)
man=no
AC_ARG_ENABLE(man, AS_HELP_STRING([--enable-man], [build (default is auto)]
[requires: AsciiDoc/Asciidoctor]),
[req_man=$enableval],
[req_man=$build_default])
if test "$req_man" != no; then
if test "$A2X" != :; then
man=yes
MANPAGES=uv.1
fi
fi
if test "$req_man" = yes && test "$A2X" = :; then
AC_MSG_ERROR([Manual pages generate required, but]
[AsciiDoc/Asciidoctor was not found!])
fi
AC_SUBST(DLL_LIBS)
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNCS(timespec_get)
# ---------------------------------------------------------------------
# Common shell utility functions
# ---------------------------------------------------------------------
# Be careful about [] m4 processing - either use quadrigraphs or enclose macro with additional []
# remove redundant spaces from argument (multiplied, leading, trailing)
[compact_spaces_pipe() { sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//' ;}]
[compact_spaces() { echo "$1" | compact_spaces_pipe ;}]
# remove "-mwindows" from lib flags obtained with pkg-config
# because it causes output to be scratched by cmd/pwsh (but
# not MSYS2 terminal)
remove_mwindows() {
echo "$1" | sed 's/-mwindows//' | compact_spaces_pipe
}
## ensures that user explicitly requested feature is present, otherwise fail
## @param $1 feature requeseted
## @param $2 feature feature found
## @param $3 error message
AC_DEFUN([ENSURE_FEATURE_PRESENT], [
if { test "$1" != no && test "$1" != auto ;} && test "$2" = no; then
AC_MSG_ERROR([$3]);
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
UG_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_SUBST(MATHLIBS)
# -------------------------------------------------------------------------------------------------
# See if this system supports 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_CHECK_FUNCS(sched_setscheduler)
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
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_FLAGS], [Flags to be passed to CUDA compiler, eg. -arch=native])
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.])
# -------------------------------------------------------------------------------------------------
# CUDA stuff
#
# CUDA compiler choice - defaults to nvcc
#
# CUDA lookup order:
# 1) --with-cuda
# 2) CUDA_DIRECTORY env variable
# 3) CUDA_PATH env variable
# 4) default system path (PATH, LD_LIBRARY_PATH, C_INCLUDE_PATH/CPATH)
# 5) default CUDA path
CUDA_COMPUTE_ARGS=""
CUDA_COMPILER=""
CUDA_INC=
CUDA_LIB=
NVCC=
CUDA_LIB_PATH=
FOUND_CUDA=no
if test -n "$CUDA_DIRECTORY"; then
CUDA_PATH=$CUDA_DIRECTORY
fi
AC_ARG_ENABLE(cuda,
AS_HELP_STRING([--disable-cuda], [disable all CUDA code]),
[cuda_req=$enableval],
[cuda_req=$build_default])
AC_ARG_WITH(cuda,
[ --with-cuda=DIR specify location of CUDA Toolkit],
[CUDA_PATH=$withval
])
if test -n "$CUDA_PATH"; then
CUDA_PATH_SEP="$CUDA_PATH/bin$PATH_SEPARATOR"
fi
if test $cuda_req != no; then
# nvcc is intentional here
AC_PATH_PROG(NVCC, nvcc, [], [$CUDA_PATH_SEP$PATH]dnl
[$PATH_SEPARATOR/opt/cuda/bin$PATH_SEPARATOR/usr/local/cuda/bin])
fi
if test -n "$NVCC" -a $cross_compile = no -a $cuda_req != no
then
CUDA_PATH=`dirname "$NVCC"`
CUDA_PATH=`dirname "$CUDA_PATH"`
if test $system = Windows; then
AC_CHECK_PROG([CL], [cl], [cl],
[])
if test -n "$CL"; then
cl_lib_path=$(realpath "$(dirname "$(command -v "$CL")")"/../../../lib/x64)
if test $? -ne 0; then
# MSVS 14.0 has it otherwhere
cl_lib_path=$(realpath "$(dirname "$(command -v "$CL")")"/../lib)
fi
DEFAULT_LIB_P=$($LINKER --verbose 2>&1 | awk \
'BEGIN { ORS="" } /InstalledDir: / { print $2 }')/../lib
CUDA_LIB="${CUDA_LIB+$CUDA_LIB }-L$DEFAULT_LIB_P"
CUDA_LIB="$CUDA_LIB -L\"$cl_lib_path\""
FOUND_CUDA=yes
fi
else
FOUND_CUDA=yes
fi
AC_MSG_CHECKING([CUDA Toolkit version - major])
nvcc_major=`"$NVCC" --version |grep release|sed 's/^.*release \(@<:@0-9@:>@@<:@0-9@:>@*\).*$/\1/'`
AC_MSG_RESULT($nvcc_major)
AC_MSG_CHECKING([CUDA Toolkit version - minor])
nvcc_minor=`"$NVCC" --version |grep release|sed 's/^.*release @<:@0-9@:>@@<:@0-9@:>@*\.\(@<:@0-9@:>@@<:@0-9@:>@*\).*$/\1/'`
AC_MSG_RESULT($nvcc_minor)
if test $ac_cv_sizeof_int_p -eq 8 -a $system = Linux
then
CUDA_LIB_PATH="$CUDA_PATH/lib64"
else
CUDA_LIB_PATH="$CUDA_PATH/lib"
fi
if test $system = Windows; then
CUDA_PATH="\"$CUDA_PATH\""
CUDA_LIB_PATH="\"$CUDA_LIB_PATH\""
if test $WORD_LEN = 64; then
CUDA_LIB_PATH="$CUDA_LIB_PATH/x64"
else
CUDA_LIB_PATH="$CUDA_LIB_PATH/Win32"
fi
fi
CUDA_LIB="${CUDA_LIB+$CUDA_LIB }-L$CUDA_LIB_PATH -lcudart"
CUDA_INC="-I$CUDA_PATH/include"
CUDA_COMPILER="$NVCC"
INC="$INC $CUDA_INC"
if test $system = MacOSX; then
LDFLAGS="$LDFLAGS${LDFLAGS:+ }-rpath $CUDA_LIB_PATH"
DYLIBBUNDLER_FLAGS="${DYLIBBUNDER_FLAGS:+$DYLIBBUNDLER_FLAGS }-s $CUDA_LIB_PATH"
fi
fi
AC_SUBST(DYLIBBUNDLER_FLAGS)
# Pick compiler for cuda device code
AC_ARG_WITH(cuda-compiler,
AS_HELP_STRING([--with-cuda-compiler=compiler], [select compiler to compile cuda code with; suported: clang, nvcc; default: nvcc]),
[CUDA_COMPILER="$withval"],
[])
HOST_CC_REPORT=" ("
case "$CUDA_COMPILER" in
*nvcc*)
;;
*clang*)
CUDA_COMPUTE_ARGS="--cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35"
;;
"")
;;
*)
UG_MSG_WARN([Unsupported cuda compiler $CUDA_COMPILER])
;;
esac
HOST_CC_REPORT="$HOST_CC_REPORT"$(basename "$CUDA_COMPILER")
# CUDA host compiler
AC_ARG_WITH(cuda-host-compiler,
AS_HELP_STRING([--with-cuda-host-compiler=BINARY],[specify compiler used for building cuda host code]))
if test "x${with_cuda_host_compiler}" != "x" ; then
AC_PATH_PROG([cuda_host_cc], [${with_cuda_host_compiler}],[no])
# note AC_CHECK_PROG always fails on path with spaces in MSW
if test "x${cuda_host_cc}" != "xno" -o $system = Windows; then
CUDA_FLAGS="$CUDA_FLAGS -ccbin \"${cuda_host_cc}\""
else
AC_MSG_FAILURE([Binary ${with_cuda_host_compiler} given as cuda host compiler, yet not found!])
fi
else
with_cuda_host_compiler="default"
fi
if test "x$FOUND_CUDA" = "xyes" ; then
HOST_CC_REPORT="$HOST_CC_REPORT, ${with_cuda_host_compiler})"
else
HOST_CC_REPORT=""
fi
if test "$FOUND_CUDA" = yes; then
AC_DEFINE([HAVE_CUDA], [1], [CUDA is present on the system])
OBJS="$OBJS src/cuda_wrapper.o"
if test $system != Windows; 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"
else
AC_MSG_CHECKING([cl.exe supports -d2FH4-])
tst=$(mktemp tst-cl-frame-pointer-XXXX.c)
if "$CL" -d2FH4- -c $tst >/dev/null 2>&1; then
CUDA_FLAGS="$CUDA_FLAGS -Xcompiler -d2FH4-"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
rm $tst
fi
fi
ENSURE_FEATURE_PRESENT([$cuda_req], [$FOUND_CUDA], [CUDA not found])
AC_SUBST(CUDA_INC)
AC_SUBST(CUDA_LIB)
AC_SUBST(CUDA_COMPILER)
AC_SUBST(CUDA_COMPUTE_ARGS)
# -------------------------------------------------------------------------------------------------
# GL common
# -------------------------------------------------------------------------------------------------
AC_ARG_ENABLE(gl,
[ --disable-gl disable all OpenGL stuff (default is auto)]
[ Requires: glew gl (Linux + Win), none (macOS)],
[gl_req=$enableval],
[gl_req=$build_default]
)
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"
if test "$ac_cv_header_GL_gl_h" = yes -a \
"$ac_cv_lib_GL_glBindTexture" = yes
then
HAVE_GL=yes
fi
if test "$ac_cv_header_GL_glew_h" = yes -a \
\( "$ac_cv_lib_GLEW_glewInit" = yes -o "$ac_cv_lib_glew32_glewInit" = yes \)
then
HAVE_GLEW=yes
fi
# Linux
if test "$system" = Linux -a \
"$HAVE_GL" = yes -a \
"$HAVE_GLEW" = yes -a \
"$ac_cv_header_GL_glx_h" = yes -a \
"$ac_cv_lib_GL_glXCreateNewContext" = 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 Cocoa -framework OpenGL"
COMMON_FLAGS="$COMMON_FLAGS -DGL_SILENCE_DEPRECATION"
GL_COMMON_OBJ="$GL_COMMON_OBJ src/mac_gl_common.o"
fi
# Win32
if test "$system" = Windows -a "$HAVE_GLEW" = yes
then
OPENGL=yes
GL_COMMON_OBJ="$GL_COMMON_OBJ src/win32_gl_common.o"
OPENGL_LIB="-lopengl32 -lglew32 -lgdi32"
fi
if test $gl_req = no; then
OPENGL=no
GL_COMMON_OBJ=
OPENGL_LIB=
fi
ENSURE_FEATURE_PRESENT([$gl_req], [$OPENGL], [OpenGL stuff requested but dependencies were not found.])
# -------------------------------------------------------------------------------------------------
# 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
# -------------------------------------------------------------------------------------------------
# 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],
)
if test "$dvs_req" != no; then
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 $FOUND_DVS_H = yes && test $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"
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
fi
ENSURE_FEATURE_PRESENT([$dvs_req], [$dvs], [DVS not found.])
# -------------------------------------------------------------------------------------------------
# Blackmagic stuff
decklink=no
AC_ARG_ENABLE(decklink,
[ --disable-decklink disable DeckLink (default is auto)]
[ Requires: DesktopVideo],
[decklink_req=$enableval],
[decklink_req=$build_default]
)
DECKLINK_INC=$srcdir/ext-deps/DeckLink
if test $decklink_req != no; then
case "$system" in
MacOSX)
DECKLINK_INC=$DECKLINK_INC/Mac
OLD_LIBS=$LIBS
LIBS="$LIBS -framework CoreFoundation"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "$DECKLINK_INC/DeckLinkAPI.h"
]],
[[IDeckLinkIterator *deckLinkIter = CreateDeckLinkIteratorInstance();]])],FOUND_DECKLINK=yes,FOUND_DECKLINK=no)
LIBS=$OLD_LIBS
if test $FOUND_DECKLINK = yes; then
DECKLINK_LIB="-framework CoreFoundation"
fi
AC_LANG_POP(C++)
;;
Windows)
DECKLINK_INC=$DECKLINK_INC/Windows
SAVED_LIBS=$LIBS
LIBS="$LIBS -lole32"
AC_LANG_PUSH(C++)
AC_MSG_CHECKING([DeckLink usability])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "$DECKLINK_INC/DeckLinkAPI_h.h"
#include "$DECKLINK_INC/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="-lole32"
fi
AC_MSG_RESULT([$FOUND_DECKLINK])
AC_LANG_POP(C++)
;;
*)
DECKLINK_INC=$DECKLINK_INC/Linux
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="-ldl"
else
FOUND_DECKLINK=no
fi
;;
esac
if test "$FOUND_DECKLINK" = yes; then
DECKLINK_PATH=${DECKLINK_INC}
AC_SUBST(DECKLINK_PATH)
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
DECK_COMMON_OBJS="$OBJS src/video_capture/DeckLinkAPI_i.o"
else
DECK_COMMON_OBJS="$OBJS src/video_capture/DeckLinkAPIDispatch.o"
fi
add_module vidcap_decklink "$DECK_COMMON_OBJS $DECKLINK_CAP_OBJ" "$DECKLINK_LIB"
add_module display_decklink "$DECK_COMMON_OBJS $DECKLINK_DISP_OBJ" "$DECKLINK_LIB"
add_module aplay_decklink "$DECK_COMMON_OBJS $DECKLINK_SOUND_PLAY_OBJ" "$DECKLINK_LIB"
decklink=yes
INC="$INC $DECKLINK_INC"
fi
fi
ENSURE_FEATURE_PRESENT([$decklink_req], [$decklink], [DeckLink not found.])
# -------------------------------------------------------------------------------------------------
# Bluefish444 stuff
# -------------------------------------------------------------------------------------------------
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]
)
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/build/inc"
BLUEFISH444_LIB="-L$BLUEFISH444_PATH/build/lib"
elif test $system = Windows; then
BLUEFISH444_INC="-I$BLUEFISH444_PATH/inc"
BLUEFISH444_LIB="-L$BLUEFISH444_PATH/lib/win"
fi
fi
if test $WORD_LEN -eq 64; then
BLUEFISH444_LIB_NAME=BlueVelvetC64
else
BLUEFISH444_LIB_NAME=BlueVelvetC
fi
if test "$bluefish444_req" != no; then
BLUE_L=no
BLUE_H=no
AC_LANG_PUSH(C++)
CPPFLAGS="$CPPFLAGS $BLUEFISH444_INC"
CXXFLAGS="$CXXFLAGS $BLUEFISH444_INC"
LIBS="$LIBS $BLUEFISH444_LIB"
AC_CHECK_HEADERS([BlueVelvetC.h], [BLUE_H=yes], [BLUE_H=no])
AC_CHECK_LIB($BLUEFISH444_LIB_NAME, bfcFactory, [BLUE_L=yes], [BLUE_L=no])
if test $BLUE_H = yes -a $BLUE_L = yes
then
BLUEFISH444_LIB="$BLUEFISH444_LIB -l$BLUEFISH444_LIB_NAME"
add_module vidcap_bluefish444 src/video_capture/bluefish444.o "$BLUEFISH444_LIB"
add_module display_bluefish444 src/video_display/bluefish444.o "$BLUEFISH444_LIB"
INC="$INC $BLUEFISH444_INC"
bluefish444=yes
fi
AC_LANG_POP(C++)
LIBS=$SAVED_LIBS
CXXFLAGS=$SAVED_CXXFLAGS
CPPFLAGS=$SAVED_CPPFLAGS_SAVE
fi
ENSURE_FEATURE_PRESENT([$bluefish444_req], [$bluefish444], [Bluefish444 not found])
# -------------------------------------------------------------------------------------------------
# AJA stuff
# -------------------------------------------------------------------------------------------------
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
if test -z "$AJA_PATH"; then
if test -d /usr/local/include/libajantv2; then
AJA_PATH=/usr/local/include/libajantv2
# libajantv2 AUR
elif test -d /usr/include/libajantv2; then
AJA_PATH=/usr/include/libajantv2
fi
fi
AC_ARG_WITH(aja,
[ --with-aja=DIR specify location of NTV2],
[AJA_PATH=$withval
])
if test "$aja_req" != no; then
if test $system != Windows; then
AJA_LIB=ajantv2
platform=lin
if test "$system" = MacOSX; then
platform=mac
fi
AC_CHECK_LIB($AJA_LIB, main, [aja=yes], [aja=no])
if test "$aja" = yes; then
# we need to have the headers path, anyways (see 30 lines below)
if ! test -d "$AJA_PATH"; then
UG_MSG_WARN([libajantv2 found, but \$AJA_DIRECTORY still needs to point to headers root])
aja=no
fi
AJA_LIB=-l$AJA_LIB
fi
else # Windows
AC_CHECK_LIB(aja, display_aja_probe, [aja=yes], [aja=no])
fi
if test $aja = yes -a $system = Windows; then
add_module aja src/aja_win32_stub.o -laja
elif test $aja = yes; then # Linux and macOS
AJA_INC="$AJA_INC -I$AJA_PATH -I$AJA_PATH/ajantv2/\
includes -I$AJA_PATH/ajantv2/src/$platform"
if test $system = Linux; then
AJA_CXXFLAGS="-DAJALinux -DAJA_LINUX"
AJA_LIB="$AJA_LIB -lrt"
else # mac
AJA_CXXFLAGS="-DAJAMac -DAJA_MAC"
AJA_LIB="$AJA_LIB -framework IOKit"
fi