e83d466603546e1ef77da0920edd392720e8a564
[goodguy/cinelerra.git] / configure.ac
1
2 AC_PREREQ([2.69])
3 AC_INIT([cinelerra],[5.1],[mail@lists.cinelerra-gg.org])
4
5 # Put autogenerated stuff in subdir m4, which must be created
6 # externally. This macro must be set before calling AC_INIT_AUTOMAKE
7 AC_CONFIG_AUX_DIR(m4)
8 AM_INIT_AUTOMAKE([foreign])
9
10 AM_PROG_AS
11 AC_LANG([C++])
12 AC_LANG([C])
13 AC_PROG_CXX
14
15 CFG_CFLAGS+=" -fno-omit-frame-pointer -fno-math-errno -fno-signed-zeros"
16 CFG_CFLAGS+=" -pthread -Wall"
17 # misguided pedantic warnings
18 #  this is extra work, not a gain...
19 #CFG_CFLAGS+=" -Wno-unknown-warning-option"
20 CFG_CFLAGS+=" -Wno-attributes"
21 CFG_CFLAGS+=" -Wno-unused-result"
22 CFG_CFLAGS+=" -Wno-stringop-overflow"
23 CFG_CFLAGS+=" -Wno-format-truncation"
24 CFG_CFLAGS+=" -Wno-format-overflow"
25 CFG_CFLAGS+=" -Wno-parentheses"
26 CFG_CFLAGS+=" -Wno-stringop-truncation"
27 CFG_CFLAGS+=" -D__STDC_CONSTANT_MACROS"
28 CFG_CFLAGS+=" -D__STDC_LIMIT_MACROS"
29 CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
30 CFG_CFLAGS+=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
31 CFG_CFLAGS+=" -I/usr/include -I/usr/local/include"
32 CFG_CFLAGS+=" -I/usr/include/freetype2 -I/usr/local/include/freetype2"
33 CFG_CFLAGS+=" -I/data/data/com.termux/files/usr/include/freetype2"
34 CFG_CFLAGS+=" -I/usr/include/uuid -I/usr/local/include/uuid"
35 CFG_CFLAGS+=" -I/data/data/com.termux/files/usr/include/uuid -I/usr/local/include/uuid"
36 CFG_CFLAGS+=" -I/usr/include/mjpegtools -I/usr/local/include/mjpegtools"
37
38 AC_DEFUN([CHECK_WITH], [
39 AC_ARG_WITH([$1],
40   AS_HELP_STRING([--with-[$1]],[$2 ($4)]),
41   [WANT_$3=$withval], [WANT_$3='$4'])
42 AC_SUBST([WANT_$3])
43 ])
44
45 CHECK_WITH([jobs],[parallel build jobs],[JOBS],[auto])
46 CHECK_WITH([exec-name],[binary executable name],[CIN],[cin])
47 CHECK_WITH([single-user],[to install cin in bin],[CINBIN_BUILD],[no])
48 CHECK_WITH([lv2],[lv2 library support],[LV2],[yes])
49 CHECK_WITH([cinlib],[cinelerra library path],[CINLIB_DIR],[auto])
50 CHECK_WITH([cindat],[cinelerra share path],[CINDAT_DIR],[auto])
51 CHECK_WITH([plugin-dir],[plugin install dir],[PLUGIN_DIR],[auto])
52 CHECK_WITH([ladspa-dir],[ladspa install dir],[LADSPA_DIR],[auto])
53 CHECK_WITH([ladspa-build],[build ladspa library],[LADSPA_BUILD],[yes])
54 CHECK_WITH([config-dir],[.bcast config dir],[CONFIG_DIR],[$$HOME/.bcast5])
55 CHECK_WITH([nested-dir],[nested proxy dir],[NESTED_DIR],[$$HOME/Videos])
56 CHECK_WITH([snap-dir],[snapshot/grabshot dir],[SNAP_DIR],[$$HOME/Pictures])
57 CHECK_WITH([browser],[cin_browser path],[CIN_BROWSER],[firefox])
58 CHECK_WITH([git-ffmpeg],[git ffmpeg using url],[GIT_FFMPEG],[no])
59 CHECK_WITH([noelision],[use noelision/libpthread],[NOELISION],[auto])
60 CHECK_WITH([booby],[window lock trace booby trap],[BOOBY],[no])
61 CHECK_WITH([libzmpeg],[build libzmpeg],[LIBZMPEG],[yes])
62 CHECK_WITH([libdpx],[build libdpx],[LIBDPX],[auto])
63 CHECK_WITH([commercial],[enable commercial capture],[COMMERCIAL],[no])
64 CHECK_WITH([thirdparty],[use thirdparty build],[CIN_3RDPARTY],[yes])
65 CHECK_WITH([shuttle],[shuttle device],[SHUTTLE],[yes])
66 CHECK_WITH([wintv],[usb 2040:826d wintv device],[WINTV],[yes])
67 CHECK_WITH([x10tv],[usb 0bc7:0004 X10 remote device],[X10TV],[yes])
68 CHECK_WITH([vaapi],[video acceleration api],[VAAPI],[yes])
69 CHECK_WITH([vdpau],[video decode+presentation api for unix],[VDPAU],[yes])
70 CHECK_WITH([nv],[nvenc/nvdec ffnvcodec api],[NV],[yes])
71 CHECK_WITH([cuda],[nv cuda plugins],[CUDA],[auto])
72 CHECK_WITH([clang],[use clang instead of gcc/g++],[CLANG],[no])
73 CHECK_WITH([filegif],[enable filegif i/o], [GIFLIB],[yes])
74
75 if test "x$WANT_LV2" != "xno"; then
76   GTK2_LIBS=`pkg-config --libs gtk+-2.0`
77   AC_CHECK_LIB([m], [gtk_init], [HAVE_gtk=yes], [HAVE_gtk=no], [$GTK2_LIBS])
78   test "x$HAVE_gtk" != "xno" && test -z "`pkg-config --cflags gtk+-2.0`" && HAVE_gtk=no
79   test "x$HAVE_gtk" != "xno" && test -z "`pkg-config --libs gtk+-2.0`" && HAVE_gtk=no
80   if test "x$HAVE_gtk" = "xno"; then
81     AC_MSG_ERROR([LV2 requires gtk+-2.0 support.])
82   fi
83 fi
84
85 if test "x$WANT_COMMERCIAL" = "xyes" -a "x$WANT_LIBZMPEG" != "xyes" ; then
86   AC_MSG_ERROR([commercial requires libzmpeg support.])
87 fi
88
89 if test "x$WANT_CINBIN_BUILD" = "xyes"; then
90   WANT_LOCALE_DIR='$$CIN_LIB/locale'
91   test "x$WANT_CINDAT_DIR" = "xauto" && WANT_CINDAT_DIR='$$CIN_PATH'
92   test "x$WANT_CINLIB_DIR" = "xauto" && WANT_CINLIB_DIR='$$CIN_PATH'
93   test "x$WANT_PLUGIN_DIR" = "xauto" && WANT_PLUGIN_DIR='$$CIN_LIB/plugins'
94   test "x$WANT_LADSPA_DIR" = "xauto" && WANT_LADSPA_DIR='$$CIN_LIB/ladspa'
95 else
96   lcldir=`test "x$prefix" = "xNONE" && prefix=$ac_default_prefix; \
97     test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \
98     eval "dir=\"$localedir\""; eval "dir=\"$dir\""; eval "dir=\"$dir\""; \
99     echo "$dir"`
100   usrdat=`test "x$prefix" = "xNONE" && prefix=$ac_default_prefix; \
101     test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \
102     eval "dir=\"$datadir\""; eval "dir=\"$dir\""; eval "dir=\"$dir\""; \
103     echo "$dir"`
104   usrlib=`test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"; \
105     test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \
106     eval "dir=\"$libdir\""; eval "dir=\"$dir\""; eval "dir=\"$dir\""; \
107     echo "$dir"`
108   test "x$usrlib" = "x/lib" -o "x$usrlib" = "x/usr/lib" -o \
109        "x$usrlib" = "x/usr/local/lib" -a -e "/usr/lib64" && \
110   test ! -e "/usr/lib" -o `ls -1 /usr/lib64 | wc -l` -gt `ls -1 /usr/lib | wc -l` && \
111     usrlib+="64"
112   WANT_LOCALE_DIR="$lcldir"
113   test "x$WANT_CINDAT_DIR" = "xauto" && WANT_CINDAT_DIR="$usrdat/$WANT_CIN"
114   test "x$WANT_CINLIB_DIR" = "xauto" && WANT_CINLIB_DIR="$usrlib/$WANT_CIN"
115   test "x$WANT_PLUGIN_DIR" = "xauto" && WANT_PLUGIN_DIR="$WANT_CINLIB_DIR/plugins"
116   test "x$WANT_LADSPA_DIR" = "xauto" && WANT_LADSPA_DIR="$WANT_CINLIB_DIR/ladspa"
117 fi
118
119 CIN_INSTALLS=""
120 CIN_UNINSTALLS=""
121 if test "x$WANT_LIBZMPEG" = "xyes"; then
122   CIN_INSTALLS+=" zmp_install"
123   CIN_UNINSTALLS+=" zmp_uninstall"
124 fi
125 if test "x$WANT_COMMERCIAL" = "xyes"; then
126   CIN_INSTALLS+=" com_install"
127   CIN_UNINSTALLS+=" com_uninstall"
128 fi
129 if test "x$WANT_LADSPA_BUILD" = "xyes"; then
130   CIN_INSTALLS+=" lad_install "
131   CIN_UNINSTALLS+=" lad_uninstall "
132 fi
133 if test "x$WANT_LV2" = "xyes"; then
134   CIN_INSTALLS+=" lv2_install "
135   CIN_UNINSTALLS+=" lv2_uninstall "
136 fi
137 AC_SUBST(CIN_INSTALLS)
138 AC_SUBST(CIN_UNINSTALLS)
139
140 if test "x$WANT_CINBIN_BUILD" = "xyes"; then
141   MAK_INSTALLS="dvl_install"
142   MAK_UNINSTALLS="dvl_uninstall"
143 else
144   MAK_INSTALLS=" sys_install"
145   MAK_UNINSTALLS="sys_uninstall"
146 fi
147 AC_SUBST(MAK_INSTALLS)
148 AC_SUBST(MAK_UNINSTALLS)
149
150 if test "x$WANT_JOBS" = "xauto"; then
151 #  CPUS=`grep -c "^proc" /proc/cpuinfo`
152   CPUS=`nproc`
153   WANT_JOBS=`expr $CPUS + $CPUS / 2 + 2`
154 fi
155
156 AC_DEFUN([PKG_DEF],[
157 STATIC_PKGS+=" [$1]"
158 ver_$1="$2"
159 lib_$1="$3"
160 inc_$1="$4"
161 ])
162
163 AC_DEFUN([PKG_3RD],[
164 AC_ARG_ENABLE([$1],
165   AS_HELP_STRING([--enable-$1],[build $1 ($2)]),
166   [PKG_$1=$enableval], [PKG_$1=$2])
167 PKG_DEF([$1],[$3],[$4],[$5])
168 ])
169
170 # thirdparty builds
171
172 PKG_3RD([a52dec],[yes],
173   [a52dec-0.7.4],
174   [ liba52/.libs/liba52.a ],
175   [ include ])
176
177 PKG_3RD([djbfft],[yes],
178   [djbfft-0.76],
179   [ libdjbfft.a ],
180   [ . ])
181
182 PKG_3RD([audiofile],[no],
183   [audiofile-0.3.6],
184   [ libaudiofile/.libs/libaudiofile.a \
185     libaudiofile/modules/.libs/libmodules.a \
186     libaudiofile/alac/.libs/libalac.a ],
187   [ libaudiofile ])
188
189 PKG_3RD([encore],[no],
190   [encore-5.0],
191   [ \$(OBJDIR)/libencore.a ],
192   [ . ])
193
194 PKG_3RD([esound],[no],
195   [esound-0.2.41],
196   [ .libs/libesd.a \
197     .libs/libesddsp.a ],
198   [ . ])
199
200 PKG_3RD([ffmpeg],[yes],
201   [ffmpeg-4.4],
202   [ libavutil/libavutil.a \
203     libavcodec/libavcodec.a \
204     libpostproc/libpostproc.a \
205     libavformat/libavformat.a \
206     libswscale/libswscale.a \
207     libavfilter/libavfilter.a \
208     libswresample/libswresample.a ],
209   [ . ])
210
211 if test "x$WANT_GIT_FFMPEG" != "xno" ; then
212   ver_ffmpeg="ffmpeg.git"
213 fi
214
215 PKG_3RD([fftw],[auto],
216   [fftw-3.3.10],
217   [ .libs/libfftw3.a \
218     libbench2/libbench2.a \
219     rdft/scalar/r2cb/.libs/librdft_scalar_r2cb.a \
220     rdft/scalar/r2r/.libs/librdft_scalar_r2r.a \
221     rdft/scalar/.libs/librdft_scalar.a \
222     rdft/scalar/r2cf/.libs/librdft_scalar_r2cf.a \
223     rdft/.libs/librdft.a \
224     api/.libs/libapi.a \
225     reodft/.libs/libreodft.a \
226     dft/scalar/codelets/.libs/libdft_scalar_codelets.a \
227     dft/scalar/.libs/libdft_scalar.a \
228     dft/.libs/libdft.a \
229     kernel/.libs/libkernel.a \
230     simd-support/.libs/libsimd_support.a ],
231   [ api ])
232
233 PKG_3RD([flac],[auto],
234   [flac-1.3.2],
235   [ src/libFLAC/.libs/libFLAC.a \
236     src/libFLAC++/.libs/libFLAC++.a \
237     src/share/replaygain_analysis/.libs/libreplaygain_analysis.a \
238     src/share/replaygain_synthesis/.libs/libreplaygain_synthesis.a \
239     src/share/grabbag/.libs/libgrabbag.a \
240     src/share/utf8/.libs/libutf8.a \
241     src/test_libs_common/.libs/libtest_libs_common.a ],
242   [ include ])
243
244 PKG_3RD([giflib],[yes],
245   [giflib-5.2.1],
246   [ libgif.a \
247     libutil.a ],
248   [ . ])
249
250 PKG_DEF([ladspa], [ladspa-0.4.17], [], [])
251
252 PKG_3RD([lame],[auto],
253   [lame-3.100],
254   [ libmp3lame/.libs/libmp3lame.a \
255     mpglib/.libs/libmpgdecoder.a ],
256   [ include ])
257
258 PKG_3RD([libavc1394],[auto],
259   [libavc1394-0.5.4],
260   [ libavc1394/.libs/libavc1394.a \
261     librom1394/.libs/librom1394.a \
262     common/.libs/libraw1394util.a ],
263   [ . ])
264
265 PKG_3RD([libraw1394],[auto],
266   [libraw1394-2.1.2],
267   [ src/.libs/libraw1394.a ],
268   [ . ])
269
270 PKG_3RD([libiec61883],[auto],
271   [libiec61883-1.2.0],
272   [ src/.libs/libiec61883.a ],
273   [ src ])
274
275 PKG_3RD([libdv],[auto],
276   [libdv-1.0.0],
277   [ libdv/.libs/libdv.a ],
278   [ . ])
279
280 PKG_3RD([libjpeg],[auto],
281   [libjpeg-turbo-2.1.2],
282   [ build/libjpeg.a \
283     build/libturbojpeg.a ],
284   [ opt/libjpeg-turbo/include ])
285
286 PKG_3RD([opus],[auto],
287   [opus-1.3.1],
288   [ .libs/libopus.a ],
289   [ include ])
290
291 PKG_3RD([openjpeg],[auto],
292   [openjpeg-2.4.0],
293   [ bin/libopenjp2.a ],
294   [ src/lib/openjp2 ])
295
296 PKG_3RD([libogg],[auto],
297   [libogg-1.3.5],
298   [ src/.libs/libogg.a ],
299   [ include ])
300
301 PKG_3RD([libsndfile],[auto],
302   [libsndfile-1.0.28],
303   [ src/.libs/libsndfile.a \
304     src/.libs/libcommon.a \
305     src/G72x/.libs/libg72x.a \
306     src/GSM610/.libs/libgsm.a ],
307   [ . ])
308
309 PKG_3RD([libtheora],[auto],
310   [libtheora-1.1.1],
311   [ lib/.libs/libtheora.a \
312     lib/.libs/libtheoradec.a \
313     lib/.libs/libtheoraenc.a ],
314   [ include ])
315
316 PKG_3RD([libuuid],[yes],
317   [libuuid-1.0.3],
318   [ .libs/libuuid.a ],
319   [ . ])
320
321 PKG_3RD([libvorbis],[auto],
322   [libvorbis-1.3.7],
323   [ lib/.libs/libvorbis.a \
324     lib/.libs/libvorbisenc.a \
325     lib/.libs/libvorbisfile.a ],
326   [ include . ])
327
328 ## arch dep tests
329 ARCH=[`uname -m`]
330 I86=[`expr "x$ARCH" : 'xi[346]86.*'`]
331 X86=[`expr "x$ARCH" : 'x..._64*'`]
332
333 if test "x$I86$X86" != "x00" ; then
334
335 PKG_3RD([mjpegtools],[yes],
336   [mjpegtools-2.1.0],
337   [ utils/mmxsse/.libs/libmmxsse.a \
338     utils/.libs/libmjpegutils.a \
339     lavtools/.libs/liblavfile.a \
340     lavtools/.libs/liblavjpeg.a \
341     mplex/.libs/libmplex2.a \
342     yuvfilters/.libs/libyuvfilters.a \
343     mpeg2enc/.libs/libmpeg2encpp.a ],
344   [ .  lavtools utils ])
345
346 else
347
348 PKG_3RD([mjpegtools],[yes],
349   [mjpegtools-2.1.0],
350   [ utils/.libs/libmjpegutils.a \
351     lavtools/.libs/liblavfile.a \
352     lavtools/.libs/liblavjpeg.a \
353     mplex/.libs/libmplex2.a \
354     yuvfilters/.libs/libyuvfilters.a \
355     mpeg2enc/.libs/libmpeg2encpp.a ],
356   [ .  lavtools utils ])
357
358 fi
359
360 PKG_3RD([openexr],[auto],
361   [openexr-2.4.1],
362   [ usr/local/lib/libHalf.a \
363     usr/local/lib/libIex.a \
364     usr/local/lib/libIexMath.a \
365     usr/local/lib/libIlmThread.a \
366     usr/local/lib/libImath.a \
367     usr/local/lib/libIlmImf.a \
368     usr/local/lib/libIlmImfUtil.a ],
369   [ usr/local/include/OpenEXR ])
370
371 PKG_3RD([openExr],[auto], [openExr], [] [])
372 PKG_3RD([ilmBase],[auto], [ilmBase], [] [])
373
374 #PKG_3RD([festival],[no],
375 #  [festival],
376 #  [],
377 #  [])
378 #PKG_3RD(speech_tools,[no],
379 #  [speech_tools],
380 #  [],
381 #  [])
382 #
383 PKG_3RD([tiff],[auto],
384   [tiff-4.3.0],
385   [ libtiff/.libs/libtiff.a \
386     libtiff/.libs/libtiffxx.a \
387     port/.libs/libport.a ],[
388    . ])
389
390 PKG_3RD([twolame],[auto],
391   [twolame-0.4.0],
392   [ libtwolame/.libs/libtwolame.a ],
393   [  libtwolame ])
394
395 PKG_3RD([x264],[auto],
396   [x264-snapshot-20210615-master],
397   [ libx264.a ],
398   [ . ])
399
400 PKG_3RD([x265],[auto],
401   [x265_3.5],
402   [ libx265.a ],
403   [ . source ])
404
405 PKG_3RD([libvpx],[auto],
406   [libvpx-1.11.0],
407   [ libvpx.a ],
408   [ . ])
409
410 PKG_3RD([lv2],[auto],
411   [lv2-1.18.0],
412   [ ],
413   [ usr/local/include usr/local/lib64/lv2 usr/local/lib/lv2 ])
414
415 PKG_3RD([sratom],[auto],
416   [sratom-0.6.4],
417   [ usr/local/lib/libsratom-0.a ],
418   [ usr/local/include ])
419
420 PKG_3RD([serd],[auto],
421   [serd-0.30.4],
422   [ usr/local/lib/libserd-0.a ],
423   [ usr/local/include ])
424
425 PKG_3RD([sord],[auto],
426   [sord-0.16.4],
427   [ usr/local/lib/libsord-0.a ],
428   [ usr/local/include ])
429
430 PKG_3RD([lilv],[auto],
431   [lilv-0.24.8],
432   [ usr/local/lib/liblilv-0.a ],
433   [ usr/local/include ])
434
435 PKG_3RD([suil],[auto],
436   [suil-0.10.6],
437   [ usr/local/lib/libsuil-0.a ],
438   [ usr/local/include ])
439
440 PKG_3RD([libaom],[auto],
441   [libaom-v3.2.0],
442   [ usr/local/lib*/libaom*.a ],
443   [ usr/local/include ])
444
445 PKG_3RD([dav1d],[auto],
446   [dav1d-0.5.1],
447   [ usr/local/lib*/libdav1d*.a ],
448   [ usr/local/include ])
449
450 PKG_3RD([libwebp],[auto],
451   [libwebp-1.1.0],
452   [ usr/local/lib*/libwebp*.a ],
453   [ usr/local/include ])
454
455 PKG_3RD([ffnvcodec],[auto],
456   [ffnvcodec],
457   [ ],
458   [ . ])
459
460 PKG_3RD([libdpx],[auto],
461   [libdpx],
462   [ libdpx/libdpx.a ],
463   [ libdpx ])
464
465 if test [ "$(uname -o)"] = "Android"  ; then
466
467 PKG_3RD([libbthread],[auto],
468   [libbthread-master],
469   [ *.a ],
470   [ . ])
471 fi
472
473
474 AC_SUBST(STATIC_PKGS)
475
476 AC_DEFUN([CHECK_ENABLE], [
477 AC_ARG_ENABLE([$1],
478   AS_HELP_STRING([--enable-[$1]],[$3 ([$4])]),
479   [WANT_$2=$enableval], [WANT_$2=[$4]])
480 ])
481
482 CHECK_ENABLE([static-build], [STATIC_BUILD], [build static], [auto])
483 CHECK_ENABLE([x264_hidepth], [X264_HIDEPTH], [build x264 10bit], [no])
484 CHECK_ENABLE([x265_hidepth], [X265_HIDEPTH], [build x265 10bit], [no])
485
486 test "x$WANT_STATIC_BUILD" = "xauto" && WANT_STATIC_BUILD=$WANT_CINBIN_BUILD
487
488 AC_DEFUN([CHECK_PROG], [
489  AC_CHECK_PROG([PROG_$1], [$2], [yes],[no])
490 ])
491 AC_DEFUN([REQUIRE_PROG], [
492  CHECK_PROG([$1],[$2])
493  if test "x$PROG_$1" = "xno"; then
494    AC_MSG_WARN([$2 is missing and required.])
495    FATAL_ERROR=1
496  fi
497 ])
498
499 ## arch dep tests
500 ARCH=[`uname -m`]
501 I86=[`expr "x$ARCH" : 'xi[346]86.*'`]
502 X86=[`expr "x$ARCH" : 'x..._64*'`]
503
504 if test "x$I86$X86" != "x00" ; then
505   # Checks for ix86 programs.
506   REQUIRE_PROG(NASM, [nasm])
507   # libx264 nasm fix
508   AC_MSG_CHECKING([nasm x264 compatible])
509   echo "vmovdqa32 [[eax]]{k1}{z}, zmm0" > conftest.asm
510   nasm conftest.asm -o conftest.o > /dev/null 2>&1
511   if test $? != 0 ; then
512    AC_MSG_RESULT([no])
513    AC_MSG_WARN([libx264 built without assembly code])
514    X264_CFG_PARAMS="$X264_CFG_PARAMS --disable-asm"
515   else
516    AC_MSG_RESULT([yes])
517   fi
518   rm -f conftest.asm conftest.o
519   REQUIRE_PROG(YASM, [yasm])
520 fi
521
522 if test "x$I86$X86" == "x00"; then
523    CFG_CFLAGS+=" -DNO_CTX -DNO_GDB -DNO_BTRACE"
524 fi
525
526 ## end arch dep tests
527
528 REQUIRE_PROG(OBJCOPY, [objcopy])
529 if test "x$FATAL_ERROR" != "x"; then
530  AC_MSG_ERROR("fatal eror.")
531 fi
532 CHECK_PROG(PACTL, [pactl])
533 WANT_PACTL=$PROG_PACTL
534
535 AC_CHECK_DECL([X_HAVE_UTF8_STRING],,[no_utf=yes],[#include <X11/Xlib.h>])
536 if test "$no_utf" = "yes"; then
537   AC_MSG_ERROR([Cinelerra requires utf8 support in X Windows.])
538 fi
539
540 # Checks for headers/libraries.
541
542 AC_DEFUN([CHECK_HEADERS], [
543 if test "x$HAVE_$1" != "xno"; then
544  AC_CHECK_HEADER(m4_apply([m4_car],m4_split([$3])), [HAVE_$1=yes], [HAVE_$1=no],
545   [m4_foreach([i], m4_split([$3]), [[#include "]i["
546 ]])])
547  AC_SUBST([HAVE_$1])
548  AC_MSG_CHECKING([$2])
549  AC_MSG_RESULT([$HAVE_$1])
550  if test "x$HAVE_$1" = "xno"; then
551   if test "x$PKG_$1" = "x"; then RESULT=no; fi
552  fi
553 fi
554 ])
555
556 AC_DEFUN([CHECK_LIB], [
557 if test "x$HAVE_$1" != "xno"; then
558  if test "x$PKG_$1" = "x" -o "x$WANT_STATIC_BUILD" = "xno" -a "x$PKG_$1" != "xno"; then
559   AC_CHECK_LIB([$2], [$3], [HAVE_$1=yes], [HAVE_$1=no], [$4])
560   AC_SUBST([HAVE_$1])
561   if test "x$WANT_$1" != "xno"; then
562    if test "x$HAVE_$1" = "xyes"; then
563     if test "x$PKG_$1" = "x"; then
564      SYSTEM_LIBS+=" -l[$2]"
565      for lib in [$4]; do SYSTEM_LIBS+=" $lib"; done
566     else
567      SHARED_$1+=" -l[$2]"
568      for lib in [$4]; do SHARED_LIBS+=" $lib"; done
569     fi
570    elif test "x$PKG_$1" = "x"; then
571     RESULT=no
572    fi
573   fi
574  fi
575 fi
576 ])
577
578 CHECK_LIB([X11], [X11], [XOpenDisplay])
579 CHECK_HEADERS([X11], [X11 headers], [X11/X.h X11/Xlib.h X11/Xutil.h X11/cursorfont.h])
580 CHECK_HEADERS([X11], [X11 headers], [X11/keysym.h X11/Sunkeysym.h X11/Xatom.h X11/XF86keysym.h])
581 CHECK_LIB([XEXT], [Xext], [XShmQueryExtension])
582 CHECK_HEADERS([XEXT], [Xlib XShm extention], [X11/Xlib.h X11/extensions/XShm.h X11/extensions/shape.h])
583 CHECK_LIB([XINERAMA], [Xinerama], [XineramaQueryExtension])
584 CHECK_HEADERS([XINERAMA], [Xinerama headers], [X11/extensions/Xinerama.h])
585 CHECK_LIB([XFIXES], [Xfixes], [XFixesQueryVersion])
586 CHECK_LIB([BZ2], [bz2], [BZ2_bzDecompress])
587 CHECK_LIB([FONTCONFIG], [fontconfig], [FcInit])
588 CHECK_LIB([FREETYPE], [freetype], [FT_Init_FreeType])
589 CHECK_LIB([LZMA], [lzma], [lzma_version_number])
590 CHECK_LIB([PNG], [png], [png_read_png])
591 CHECK_LIB([PTHREAD], [pthread], [pthread_create])
592 CHECK_LIB([Z], [z], [gzopen])
593 CHECK_LIB([fftw], [fftw3], [fftw_execute])
594 CHECK_HEADERS([fftw], [fftw headers], [fftw3.h])
595 CHECK_LIB([libuuid], [uuid], [uuid_clear])
596 CHECK_HEADERS([libuuid], [uuid headers], [uuid/uuid.h])
597 CHECK_HEADERS([LINUX_CDROM], [linux cdrom headers], [linux/cdrom.h linux/futex.h])
598 CHECK_HEADERS([LINUX_SYS], [linux sys], [sys/ioctl.h sys/stat.h sys/types.h sys/time.h sys/syscall.h])
599 CHECK_LIB([flac], [FLAC], [FLAC__stream_decoder_new])
600 CHECK_HEADERS([flac], [FLAC headers], [FLAC/stream_decoder.h])
601 CHECK_LIB([lame], [mp3lame], [lame_init])
602 CHECK_HEADERS([lame], [lame headers], [lame/lame.h])
603 CHECK_LIB([libjpeg], [jpeg], [jpeg_start_decompress])
604 CHECK_HEADERS([libjpeg], [jpeg headers], [stdio.h jpeglib.h])
605 CHECK_LIB([openjpeg], [openjp2], [opj_version])
606 CHECK_HEADERS([openjpeg], [openjpeg headers], [openjpeg.h])
607 CHECK_LIB([libsndfile], [sndfile], [sf_open])
608 CHECK_HEADERS([libsndfile], [sndfile headers], [sndfile.h])
609 CHECK_LIB([ilmbase], [IlmImf], [ImfOpenInputFile])
610 CHECK_HEADERS([ilmbase], [IlmImf headers], [OpenEXR/ImfCRgbaFile.h])
611 CHECK_LIB([libvpx], [vpx], [vpx_codec_decode])
612 CHECK_HEADERS([libvpx], [vpx headers], [vpx/vpx_decoder.h])
613 CHECK_LIB([mjpegtools], [mjpegutils], [mjpeg_info])
614 CHECK_HEADERS([mjpegtools], [mjpegtools headers], [mjpegtools/mjpeg_types.h])
615 CHECK_LIB([tiff], [tiff], [TIFFOpen])
616 CHECK_HEADERS([tiff], [tiff headers], [tiff.h tiffio.h])
617 CHECK_LIB([twolame], [twolame], [twolame_encode_buffer_float32_interleaved])
618 CHECK_HEADERS([twolame], [twolame headers], [twolame.h])
619 CHECK_LIB([x264], [x264], [x264_encoder_encode])
620 CHECK_HEADERS([x264], [x264 headers], [stdint.h x264.h])
621 CHECK_LIB([x265], [x265], [x265_encoder_encode])
622 CHECK_HEADERS([x265], [x265 headers], [x265.h])
623 CHECK_LIB([opus], [opus], [opus_multistream_decoder_create])
624 CHECK_HEADERS([opus], [libopus headers], [opus/opus_multistream.h])
625 CHECK_LIB([libaom], [aom], [aom_codec_version])
626 CHECK_HEADERS([libaom], [libaom headers], [aom/aom.h])
627 CHECK_LIB([dav1d], [dav1d], [dav1d_version])
628 CHECK_HEADERS([dav1d], [libdav1d headers], [dav1d/dav1d.h])
629 CHECK_LIB([libwebp], [webp], [WebPGetEncoderVersion])
630 CHECK_HEADERS([libwebp], [libwebp headers], [webp/encode.h])
631 CHECK_LIB([a52dec], [a52], [a52_init])
632 CHECK_HEADERS([a52dec], [a52 headers], [stdint.h a52.h])
633 CHECK_LIB([encore], [encore], [encore])
634 CHECK_HEADERS([encore], [encore headers], [encore.h])
635 CHECK_LIB([giflib], [gif], [DGifOpen])
636 CHECK_HEADERS([giflib], [gif lib headers], [gif_lib.h])
637 CHECK_LIB([jbig], [jbig], [jbg_dec_init])
638
639 CHECK_LIB([VDPAU], [vdpau], [vdp_device_create_x11])
640 if test "x$HAVE_VDPAU" != "xyes" -a "x$WANT_VDPAU" = "xyes"; then
641   AC_MSG_ERROR([requires vdpau support.])
642 fi
643
644 CHECK_LIB([VAAPI], [va], [vaInitialize])
645 if test "x$HAVE_VAAPI" = "xyes" -a "x$WANT_VAAPI" != "xno"; then
646   CHECK_HEADERS([vaapi_x11], [va x11 headers], [va/va_x11.h])
647   CHECK_LIB([vaapi_x11], [va-x11], [vaGetDisplay])
648   CHECK_HEADERS([vaapi_drm], [va drm headers], [va/va_drm.h])
649   CHECK_LIB([vaapi_drm], [va-drm], [vaGetDisplayDRM])
650 fi
651 if test "x$HAVE_VAAPI" != "xyes" -a "x$WANT_VAAPI" = "xyes"; then
652   AC_MSG_ERROR([requires vaapi support.])
653 fi
654
655 #CHECK_LIB([NVENC], [nvidia-encode], [NvEncodeAPICreateInstance])
656
657 #if test "x$HAVE_mjpegtools" = "xyes"; then
658 #CFG_CFLAGS+=" -I/usr/include/mjpegtools -I/usr/local/include/mjpegtools"
659 #fi
660
661 AC_DEFUN([CHECK_WANT], [
662 RESULT=yes
663 # WANT_$1
664 AC_ARG_WITH(m4_tolower([$1]),
665  AS_HELP_STRING([m4_join([-],[--with],m4_tolower([$1]))],[$3 (auto)]),
666   [WANT_$1=$withval],[WANT_$1=$2])
667  m4_quote($4)
668  if test "x$WANT_$1" = "xauto" ; then
669   WANT_$1="$RESULT"
670  elif test "x$WANT_$1" = "xyes" ; then
671   if test "x$RESULT" = "xno" -a "x$PKG_$1" = "x"; then
672     AC_MSG_ERROR([required for $1 support.])
673   fi
674  fi
675 CFG_WANTS+=" $1"
676 AC_SUBST([WANT_$1])
677 ])
678
679 CHECK_WANT([GL], [auto], [use opengl], [
680  CHECK_LIB([GL], [GL], [glUseProgram])
681  CHECK_LIB([GL], [GLU], [gluOrtho2D])
682  CHECK_HEADERS([GL], [opengl headers], [GL/gl.h GL/glext.h GL/glu.h GL/glx.h])])
683
684 CHECK_WANT([XV], [auto], [use xv], [
685  CHECK_LIB([xv], [Xv], [XvQueryExtension])
686  CHECK_HEADERS([xv], [Xlib Xv extention], [X11/Xlib.h X11/extensions/Xvlib.h])])
687
688 CHECK_WANT([OSS], [auto], [use OSS audio], [
689  CHECK_HEADERS([OSS], [oss headers], [sys/soundcard.h])])
690
691 CHECK_WANT([XFT], [auto], [use libXft], [
692  CHECK_LIB([XFT], [Xft], [XftInit])
693  CHECK_HEADERS([XFT], [Xft/freetype headers], [X11/Xlib.h X11/Xft/Xft.h])])
694
695 CHECK_WANT([ALSA], [auto], [use libasound/alsa], [
696  CHECK_LIB([ALSA], [asound], [snd_pcm_open])
697  CHECK_HEADERS([ALSA], [asound headers], [alsa/asoundlib.h])])
698
699 CHECK_WANT([OGG], [auto], [use ogg/theora/vorbis], [
700  CHECK_LIB([libogg], [ogg], [ogg_stream_init])
701  CHECK_HEADERS([libogg], [ogg headers], [ogg/ogg.h])
702  CHECK_LIB([libtheora], [theora], [theora_info_init], [-ltheoraenc -ltheoradec -logg])
703  CHECK_HEADERS([libtheora], [threora headers], [theora/theoraenc.h])
704  CHECK_LIB([libvorbis], [vorbisenc], [vorbis_encode_init], [-lvorbis -lvorbisfile -logg])
705  CHECK_HEADERS([libvorbis], [vorbis encoders headers], [vorbis/vorbisenc.h])
706  CHECK_LIB([libvorbis], [vorbisfile], [ov_open])
707  CHECK_HEADERS([libvorbis], [vorbis file headers], [vorbis/vorbisfile.h])])
708
709 CHECK_WANT([FIREWIRE], [auto], [use firewire], [
710  CHECK_LIB([libavc1394], [avc1394], [avc1394_init_target])
711  CHECK_HEADERS([libavc1394], [libavc1394 headers], [libavc1394/avc1394.h])
712  CHECK_LIB([libavc1394], [rom1394], [rom1394_get_bus_id])
713  CHECK_HEADERS([libavc1394], [librom1394 headers], [libavc1394/rom1394.h])
714  CHECK_LIB([libiec61883], [iec61883], [iec61883_mpeg2_recv_init])
715  CHECK_HEADERS([libiec61883], [libiec61883 headers], [libiec61883/iec61883.h])
716  CHECK_LIB([libraw1394], [raw1394], [raw1394_iso_recv_init])
717  CHECK_HEADERS([libraw1394], [libraw1394 headers], [libraw1394/raw1394.h])])
718 # have all or none
719 test "x$HAVE_libavc1394" = "xyes" && \
720 test "x$HAVE_libiec61883" = "xyes" && \
721 test "x$HAVE_libraw1394" = "xyes" && \
722   HAVE_FIREWIRE=yes || \
723 HAVE_libavc1394=no \
724 HAVE_libiec61883=no \
725 HAVE_libraw1394=no \
726  HAVE_FIREWIRE=no
727
728 CHECK_WANT([DV], [auto], [use dv], [
729  CHECK_LIB([libdv], [dv], [dv_init])
730  CHECK_HEADERS([libdv], [libdv headers], [libdv/dv.h])])
731
732 CHECK_WANT([DVB], [auto], [use dvb], [
733  CHECK_HEADERS([DVB], [dvb device headers], [linux/dvb/dmx.h linux/dvb/frontend.h])])
734
735 CHECK_WANT([VIDEO4LINUX2], [auto], [use v4l2], [
736  CHECK_HEADERS([VIDEO4LINUX2], [v4l2 system headers], [linux/kernel.h linux/types.h linux/videodev2.h])])
737
738 CHECK_WANT([XXF86VM], [auto], [use xf86vmode], [
739  CHECK_HEADERS([XXF86VM], [XF86VM headers], [X11/Xlib.h X11/extensions/xf86vmode.h])])
740
741 CHECK_WANT([ESOUND], [no], [use esd], [
742  CHECK_LIB([esound], [esd], [esd_open_sound])
743  CHECK_HEADERS([esound], [esound headers], [esd.h])
744  CHECK_LIB([audiofile], [audiofile], [afOpenFile])
745  CHECK_HEADERS([audiofile], [audiofile headers], [audiofile.h])])
746 # have all or none
747 test "x$HAVE_esound" = "xyes" && \
748 test "x$HAVE_audiofile" = "xyes" && \
749   HAVE_ESOUND=yes || \
750 HAVE_esound=no \
751 HAVE_audiofile=no \
752   HAVE_ESOUND=no
753
754 CHECK_WANT([PULSE], [auto], [use pulseaudio], [
755  CHECK_LIB([pulse_simple], [pulse-simple], [pa_simple_new])
756  CHECK_HEADERS([pulse_simple], [pulse-simple headers], [pulse/simple.h])
757  CHECK_LIB([pulse], [pulse], [pa_context_new])
758  CHECK_HEADERS([pulse], [pulse headers], [pulse/error.h])])
759
760 CHECK_WANT([ISOFS], [auto], [use isofs], [
761  CHECK_HEADERS([isofs], [isofs headers], [linux/isofs.h])])
762
763 if test "x$WANT_LADSPA_BUILD" != "xyes" ; then
764  CHECK_WANT([LADSPA], [auto], [ladspa plugin clients], [
765   CHECK_HEADERS([ladspa], [ladspa headers], [ladspa.h])])
766 else
767  WANT_LADSPA=yes
768 fi
769
770 CHECK_WANT([SHUTTLE], [yes], [shuttle dev support], [
771  CHECK_HEADERS([keysyms], [x11 keysym defs], [X11/keysymdef.h])])
772 if test "x$WANT_SHUTTLE" = "xno"; then
773  WANT_SHUTTLE_USB="no"
774 fi
775 CHECK_WANT([SHUTTLE_USB], [yes], [use libusb-1.0], [
776  CHECK_LIB([libusbx], [usb-1.0], [libusb_init])
777  CHECK_HEADERS([libusbx], [libusb headers], [libusb-1.0/libusb.h])])
778
779 CHECK_WANT([LV2], [auto], [use lv2], [
780  saved_CFLAGS="$CFLAGS"
781  CHECK_LIB([lilv], [lilv-0], [lilv_world_new])
782  CHECK_LIB([sord], [sord-0], [sord_world_new])
783  CHECK_LIB([serd], [serd-0], [serd_reader_new])
784  CHECK_LIB([sratom], [sratom-0], [sratom_new])
785  CFLAGS="-I/usr/include/lilv-0 -I/usr/local/include/lilv-0"
786  CHECK_HEADERS([lv2], [lilv headers], [lilv/lilv.h])
787  CHECK_LIB([suil], [suil-0], [suil_instance_new])
788  CFLAGS="-I/usr/include/suil-0 -I/usr/local/include/suil-0"
789  CHECK_HEADERS([lv2], [suil headers], [suil/suil.h])
790  CFLAGS="$saved_CFLAGS"])
791 # have all or none
792 test "x$HAVE_lv2" = "xyes" && \
793 test "x$HAVE_lilv" = "xyes" && \
794 test "x$HAVE_sord" = "xyes" && \
795 test "x$HAVE_serd" = "xyes" && \
796 test "x$HAVE_sratom" = "xyes" && \
797 test "x$HAVE_suil" = "xyes" && \
798   HAVE_LV2=yes || \
799 HAVE_lv2=no \
800 HAVE_lilv=no \
801 HAVE_sord=no \
802 HAVE_serd=no \
803 HAVE_sratom=no \
804 HAVE_suil=no \
805   HAVE_LV2=no
806
807 CHECK_WANT([CUDA], [auto], [build cuda plugins], [
808   CHECK_HEADERS([CUDA], [cuda sdk], [${CUDA_PATH:-/usr/local/cuda}/include/cuda.h])])
809
810 CHECK_WANT([DL], [auto], [system has libdl], [
811  CHECK_LIB([DL], [dl], [dlopen])])
812
813 CHECK_WANT([OPENCV], [no], [opencv=sys/sta/dyn,git/tar=url], [
814 ])
815
816 CHECK_WANT([NUMA], [auto], [system has libnuma], [
817  CHECK_LIB([NUMA], [numa], [numa_alloc])])
818
819 CHECK_WANT([OPENEXR], [auto], [use openexr], [
820  AC_MSG_CHECKING([for openexr available])
821  saved_LIBS="$LIBS"
822  saved_CXXFLAGS="$CXXFLAGS"
823  # ilmbase libs
824  LIBS=" -lIlmImf -lIlmThread -lIex -lpthread"
825  CXXFLAGS="-I/usr/include/OpenEXR -I/usr/local/include/OpenEXR"
826  AC_LANG_PUSH(C++)
827  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
828 #include "ImfChannelList.h"
829 #include "ImfChromaticities.h"
830 #include "ImfCompression.h"
831 #include "ImfIO.h"
832 #include "ImfInputFile.h"
833 #include "ImfOutputFile.h"
834 #include "ImfPixelType.h"
835 #include "ImfRgbaFile.h"
836 #include "ImfRgbaYca.h"
837 #include "ImfVersion.h"
838 class EXRIStream : public Imf::IStream { public:
839 EXRIStream() : Imf::IStream("mypath") {} };
840 class EXROStream : public Imf::OStream { public: 
841 EXROStream() : Imf::OStream("mypath") {} };
842 ]])], [HAVE_OPENEXR=yes], [HAVE_OPENEXR=no])
843  if test "x$WANT_OPENEXR" = "xauto"; then
844    WANT_OPENEXR="yes"
845  fi
846  if test "x$WANT_OPENEXR" = "xyes" -a "x$HAVE_OPENEXR" = "xyes"; then
847   if test "x$WANT_STATIC_BUILD" = "xno"; then
848     SHARED_openexr="$LIBS"
849     SHARED_LIBS+=" $LIBS"
850     CFG_CFLAGS+=" -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR"
851   fi
852  fi
853  LIBS="$saved_LIBS"
854  CXXFLAGS="$saved_CXXFLAGS"
855  AC_LANG_POP(C++)
856  AC_MSG_RESULT([$HAVE_OPENEXR])
857 ])
858 AC_SUBST([HAVE_OPENEXR])
859 # have all or none
860 test "x$HAVE_openexr" = "xyes" && \
861 test "x$HAVE_ilmbase" = "xyes" && \
862   HAVE_OPENEXR=yes || \
863 HAVE_openexr=no \
864 HAVE_ilmbase=no \
865   HAVE_OPENEXR=no
866
867 # build global_config
868 OBJDIR=`uname -m`
869 AC_SUBST(OBJDIR)
870
871 echo "AS_HELP_STRING([Reason],[Package])"
872 echo "AS_HELP_STRING([------],[-------])"
873
874 AC_DEFUN([PKG_DISABLED],[
875  PKG_$1="no"
876  BUILD_$1=0
877  AC_SUBST(BUILD_$1)
878  echo "AS_HELP_STRING([disabled],[$1])"
879 ])
880 AC_DEFUN([PKG_SHARED],[
881  PKG_$1="shared"
882  BUILD_$1=0
883  AC_SUBST(BUILD_$1)
884  SHARED_LIBS+="$SHARED_$1"
885 ])
886
887 AC_DEFUN([PKG_STATIC],[
888  if test "x$WANT_CIN_3RDPARTY" != "xno"; then
889   PKG_$1="yes"
890   BUILD_$1=1
891   AC_SUBST(BUILD_$1)
892   STATIC_BLDS+=" [$1]"
893   echo "AS_HELP_STRING([$2],[$1])"
894  fi
895 ])
896
897 AC_DEFUN([PKG_FORCED],[PKG_STATIC([$1],[forced])])
898
899 if test "x$WANT_CIN_3RDPARTY" != "xno"; then
900 # order matters
901 for dep in \
902         ffmpeg/twolame ffmpeg/lame ffmpeg/openjpeg \
903         ffmpeg/libvorbis ffmpeg/libtheora ffmpeg/x264 ffmpeg/x265 \
904         libiec61883/libraw1394 libavc1394/librom1394 \
905         openexr/ilmbase ilmbase/libogg \
906         libtheora/libogg libtheora/libvorbis ; do
907   lib=`dirname $dep`;  needs=`basename $dep`
908   eval pkg_lib="\$PKG_$lib"
909   if test "x$pkg_lib" != "xno"; then
910     eval "PKG_$needs=yes"
911   fi
912 done
913 fi
914
915 AC_DEFUN([PKG_PROVIDE],[
916 if test "x$BUILD_$1" = "x" ; then
917  if test "x$PKG_$1" = "xyes"; then
918   if test "x$WANT_CIN_3RDPARTY" = "xno"; then
919     PKG_SHARED([$1])
920   else
921     PKG_FORCED([$1])
922   fi
923  elif test "x$2" = "xno" -o "x$PKG_$1" = "xno"; then
924   PKG_DISABLED([$1])
925  elif test "x$WANT_STATIC_BUILD" = "xyes"; then
926   PKG_STATIC([$1],[static])
927  elif test "x$HAVE_$1" = "xyes"; then
928   PKG_SHARED([$1])
929  else
930   PKG_STATIC([$1],[needed])
931  fi
932 fi
933 ])
934
935 PKG_PROVIDE([libbthread])
936 PKG_PROVIDE([a52dec])
937 PKG_PROVIDE([djbfft])
938 PKG_PROVIDE([encore])
939 PKG_PROVIDE([audiofile],[$WANT_ESOUND])
940 PKG_PROVIDE([esound],[$WANT_ESOUND])
941 PKG_PROVIDE([ffmpeg])
942 PKG_PROVIDE([fftw])
943 PKG_PROVIDE([flac])
944 PKG_PROVIDE([giflib], [$WANT_GIFLIB])
945 PKG_PROVIDE([ilmBase], [$WANT_OPENEXR])
946 PKG_PROVIDE([ladspa],[$WANT_LADSPA_BUILD])
947 PKG_PROVIDE([lame])
948 PKG_PROVIDE([libavc1394],[$WANT_FIREWIRE])
949 PKG_PROVIDE([libraw1394],[$WANT_FIREWIRE])
950 PKG_PROVIDE([libiec61883],[$WANT_FIREWIRE])
951 PKG_PROVIDE([libdv],[$WANT_DV])
952 PKG_PROVIDE([libjpeg])
953 PKG_PROVIDE([libogg])
954 PKG_PROVIDE([libsndfile])
955 PKG_PROVIDE([libtheora])
956 PKG_PROVIDE([libuuid])
957 PKG_PROVIDE([libvorbis])
958 PKG_PROVIDE([mjpegtools])
959 PKG_PROVIDE([libaom])
960 PKG_PROVIDE([dav1d])
961 PKG_PROVIDE([libwebp])
962 PKG_PROVIDE([openExr], [$WANT_OPENEXR])
963 PKG_PROVIDE([openexr], [$WANT_OPENEXR])
964 PKG_PROVIDE([openjpeg])
965 PKG_PROVIDE([tiff])
966 PKG_PROVIDE([twolame])
967 PKG_PROVIDE([x264])
968 PKG_PROVIDE([x265])
969 PKG_PROVIDE([libvpx])
970 PKG_PROVIDE([opus])
971 PKG_PROVIDE([lv2], [$WANT_LV2])
972 PKG_PROVIDE([lilv], [$WANT_LV2])
973 PKG_PROVIDE([sratom], [$WANT_LV2])
974 PKG_PROVIDE([serd], [$WANT_LV2])
975 PKG_PROVIDE([sord], [$WANT_LV2])
976 PKG_PROVIDE([suil], [$WANT_LV2])
977 PKG_PROVIDE([ffnvcodec], [$WANT_NV])
978 PKG_PROVIDE([libdpx])
979
980 if test "x$WANT_LV2" = "xyes"; then
981   if test "x$HAVE_lv2" = "xyes" -a "x$BUILD_lilv" = "x0"; then
982     CFG_CFLAGS+=' -I/usr/include/lilv-0 -I/usr/local/include/lilv-0'
983     CFG_CFLAGS+=' -I/usr/include/suil-0 -I/usr/local/include/suil-0'
984   fi
985 fi
986
987 AC_SUBST(STATIC_BLDS)
988 for f in $SHARED_LIBS; do
989   echo "AS_HELP_STRING([shared],[$f])"
990 done
991 AC_SUBST(SHARED_LIBS)
992 for f in $SYSTEM_LIBS; do
993   echo "AS_HELP_STRING([system],[$f])"
994 done
995 AC_SUBST(SYSTEM_LIBS)
996
997 echo ""
998 if test "x$WANT_CIN_3RDPARTY" != "xno"; then
999   CFG_CFLAGS+=" -DHAVE_CIN_3RDPARTY"
1000 fi
1001 for v in GL XFT XXF86VM OSS ALSA FIREWIRE OGG DV DVB LADSPA \
1002          VIDEO4LINUX2 ESOUND PULSE PACTL OPENEXR LV2 \
1003          COMMERCIAL GIFLIB LIBZMPEG LIBDPX SHUTTLE SHUTTLE_USB XV \
1004          VAAPI VDPAU CUDA NV WINTV X10TV; do
1005   eval vv="\$WANT_$v"
1006   if test "x$vv" != "xno"; then
1007     CFG_CFLAGS+=" -DHAVE_$v"
1008     vv=with
1009   else
1010     vv=without
1011   fi
1012   v=`echo "$v" | tr "A-Z" "a-z"`
1013   echo "  using: $vv-$v"
1014 done
1015
1016 # build extras
1017 if test "x$WANT_CLANG" = "xyes" ; then
1018   FFMPEG_EXTRA_CFG+=' --cc=clang --cxx=clang++'
1019 fi
1020 if test "x$HAVE_tiff" = "xyes"; then
1021   if test "x$HAVE_jbig" = "xyes"; then
1022     EXTRA_LIBS+=' -ljbig'
1023   fi
1024 fi
1025 if test "x$HAVE_NUMA" = "xyes"; then
1026   EXTRA_LIBS+=' -lnuma'
1027 fi
1028
1029 FFMPEG_EXTRA_LDFLAGS=""
1030 if test "x$WANT_VAAPI" != "xno" -a "x$HAVE_VAAPI" = "xyes"; then
1031   FFMPEG_EXTRA_LDFLAGS+=' -lva'
1032   EXTRA_LIBS+=' -lva'
1033   WANT_VAAPI="yes"
1034   if test "x$HAVE_vaapi_x11" = "xyes"; then
1035     FFMPEG_EXTRA_LDFLAGS+=' -lva-x11'
1036     EXTRA_LIBS+=' -lva-x11'
1037   fi
1038   if test "x$HAVE_vaapi_drm" = "xyes"; then
1039     FFMPEG_EXTRA_LDFLAGS+=' -lva-drm'
1040     EXTRA_LIBS+=' -lva-drm'
1041   fi
1042 fi
1043 CFG_WANTS+=" VAAPI"
1044
1045 if test "x$WANT_VDPAU" != "xno" -a "x$HAVE_VDPAU" = "xyes"; then
1046   WANT_VDPAU="yes"
1047 fi
1048 CFG_WANTS+=" VDPAU"
1049
1050 if test "x$WANT_NV" != "xno"; then
1051   WANT_NV="yes"
1052   CFG_WANTS+=" NV"
1053 fi
1054
1055 if test "x$HAVE_DL" = "xyes"; then
1056   EXTRA_LIBS+=' -ldl'
1057   FFMPEG_EXTRA_LDFLAGS+=' -ldl'
1058 fi
1059 if test "x$FFMPEG_EXTRA_LDFLAGS" != "x"; then
1060   FFMPEG_EXTRA_CFG+=' --extra-ldflags="'$FFMPEG_EXTRA_LDFLAGS'"'
1061 fi
1062
1063 if test "x$WANT_BOOBY" != "xno"; then
1064   CFG_CFLAGS+=" -DBOOBY"
1065 fi
1066
1067 if test [ "$(uname -o)"] = "Android" ; then
1068 # termux
1069 EXTRA_LIBS+=' -liconv -landroid-shmem'
1070 fi
1071
1072 # intel lock elision bugs
1073 if test "x$WANT_NOELISION" != "xno"; then
1074   CFG_RPATH=`ls -1fd 2> /dev/null \
1075  /usr/lib/noelision \
1076  /lib/noelision \
1077  /usr/lib64/noelision \
1078  /lib64/noelision \
1079   | tail -1`
1080 fi
1081
1082 echo "  using: with-jobs = $WANT_JOBS"
1083 echo "  using: exec-name = $WANT_CIN"
1084 echo "  using: with-cinlib = $WANT_CINLIB_DIR"
1085 echo "  using: with-cindat = $WANT_CINDAT_DIR"
1086 echo "  using: with-config-dir = $WANT_CONFIG_DIR"
1087 echo "  using: with-nested-dir = $WANT_NESTED_DIR"
1088 echo "  using: with-snap-dir = $WANT_SNAP_DIR"
1089 echo "  using: with-browser = $WANT_CIN_BROWSER"
1090 echo "  using: with-plugin-dir = $WANT_PLUGIN_DIR"
1091 echo "  using: with-ladspa-dir = $WANT_LADSPA_DIR"
1092 echo "  using: with-opencv = $WANT_OPENCV"
1093 echo "  using: with-git-ffmpeg = $WANT_GIT_FFMPEG"
1094 echo "  using: with-noelision = $WANT_NOELISION"
1095 echo "  using: with-booby = $WANT_BOOBY"
1096 echo "  using: with-clang = $WANT_CLANG"
1097 echo ""
1098 echo "  using: thirdparty build = $WANT_CIN_3RDPARTY"
1099 echo "  using: single-user  = $WANT_CINBIN_BUILD"
1100 echo "  using: static-build = $WANT_STATIC_BUILD"
1101 echo "  using: ladspa-build = $WANT_LADSPA_BUILD"
1102 echo ""
1103
1104 AC_SUBST(WANT_CIN_3RDPARTY)
1105 AC_SUBST(EXTRA_LIBS)
1106 AC_SUBST(FFMPEG_EXTRA_CFG)
1107 AC_SUBST(WANT_X264_HIDEPTH)
1108 AC_SUBST(WANT_X265_HIDEPTH)
1109
1110 AC_SUBST(CFG_CFLAGS)
1111 AC_SUBST(CFG_CXXFLAGS)
1112
1113 AC_CONFIG_FILES([Makefile])
1114 AC_OUTPUT
1115
1116 exec > global_config
1117
1118 echo "SHELL := /bin/bash"
1119 echo "export SHELL"
1120 echo "WANT_JOBS := $WANT_JOBS"
1121 if test "x$WANT_CLANG" = "xyes" ; then
1122   echo "CC = clang"
1123   echo "CXX = clang++"
1124   echo "export CC CXX"
1125 fi
1126 echo ""
1127 echo "OBJDIR := $OBJDIR"
1128 echo "BINDIR := \$(TOPDIR)/bin"
1129 echo "CINELERRA := \$(TOPDIR)/cinelerra"
1130 echo "GUICAST := \$(TOPDIR)/guicast"
1131 echo "LIBZMPEG3 := \$(TOPDIR)/libzmpeg3"
1132 echo "MPEG2ENC := \$(TOPDIR)/mpeg2enc"
1133 echo "MPLEXLO := \$(TOPDIR)/mplexlo"
1134 echo "PLUGINS := \$(TOPDIR)/plugins"
1135 echo "TDB := \$(TOPDIR)/db"
1136 echo "THIRDPARTY := \$(TOPDIR)/thirdparty"
1137 echo "EXTRA_LIBS := $EXTRA_LIBS"
1138 echo "FFMPEG_EXTRA_CFG := $FFMPEG_EXTRA_CFG"
1139 echo "export OBJDIR BINDIR CINELERRA GUICAST LIBZMPEG3"
1140 echo "export MPEG2ENC MPLEXLO PLUGINS TDB"
1141 echo "export THIRDPARTY EXTRA_LIBS FFMPEG_EXTRA_CFG"
1142 echo ""
1143
1144 echo "WANT_CIN := $WANT_CIN"
1145 CFG_WANTS+=" CIN_3RDPARTY LIBZMPEG COMMERCIAL STATIC_BUILD"
1146 for w in $CFG_WANTS; do ww=WANT_$w; echo "WANT_$w := ${!ww}"; done
1147 echo ""
1148
1149 echo "ifndef CFLAGS_"
1150 echo "ifdef CFLAGS"
1151 echo "CFLAGS_ := \$(CFLAGS)"
1152 echo "else"
1153 echo "CFLAGS_ := ${CFLAGS:--g -O2}"
1154 echo "endif"
1155 echo "endif"
1156 echo "ifndef CXXFLAGS_"
1157 echo "ifdef CXXFLAGS"
1158 echo "CXXFLAGS_ := \$(CXXFLAGS)"
1159 echo "endif"
1160 echo "endif"
1161 echo "ifndef LDFLAGS_"
1162 echo "ifdef LDFLAGS"
1163 echo "LDFLAGS_ := \$(LDFLAGS)"
1164 echo "endif"
1165 echo "endif"
1166
1167 echo "CFLAGS := \$(CFLAGS_)"
1168 echo "CFLAGS += '-DCIN=\"\$(WANT_CIN)\"'"
1169 echo "CFLAGS += '-DCINLIB_DIR=\"$WANT_CINLIB_DIR\"'"
1170 echo "CFLAGS += '-DCINDAT_DIR=\"$WANT_CINDAT_DIR\"'"
1171 echo "CFLAGS += '-DCONFIG_DIR=\"$WANT_CONFIG_DIR\"'"
1172 echo "CFLAGS += '-DNESTED_DIR=\"$WANT_NESTED_DIR\"'"
1173 echo "CFLAGS += '-DSNAP_DIR=\"$WANT_SNAP_DIR\"'"
1174 echo "CFLAGS += '-DPLUGIN_DIR=\"$WANT_PLUGIN_DIR\"'"
1175 echo "CFLAGS += '-DLOCALE_DIR=\"$WANT_LOCALE_DIR\"'"
1176 echo "CFLAGS += '-DLADSPA_DIR=\"$WANT_LADSPA_DIR\"'"
1177 echo "CFLAGS += '-DCIN_BROWSER=\"$WANT_CIN_BROWSER\"'"
1178 for flg in $CFG_CFLAGS; do echo "CFLAGS += $flg"; done
1179 echo ""
1180 if test "x$CFG_CXXFLAGS" != "x"; then
1181   for flg in $CFG_CXXFLAGS; do echo "CXXFLAGS += $flg"; done
1182   echo ""
1183 fi
1184 if test "x$CFG_LDFLAGS" != "x" ; then
1185   echo "LDFLAGS +=$CFG_LDFLAGS"
1186   echo ""
1187 fi
1188
1189 if test "x$CYGWIN" != "x" ; then
1190   echo 'FF_PATH ?= /usr/local'
1191   echo 'LDFLAGS += -L$(FF_PATH)/lib'
1192   echo 'CFLAGS += -I$(FF_PATH)/include'
1193   echo ""
1194   echo "CFLAGS += -DNO_BTRACE"
1195   echo "CFLAGS += -DNO_GDB"
1196   echo "CFLAGS += -DNO_CTX"
1197   echo "CFLAGS += -DNO_PRCTL"
1198   echo "CFLAGS += -DNO_TID"
1199   echo "CFLAGS += -DNO_XSELECT"
1200   echo ""
1201 else
1202   LDFLAGS+=" -z noexecstack"
1203 fi
1204 if test "x$BSD" != "x" ; then
1205   echo "CFLAGS += -DNO_PRCTL"
1206   echo "CFLAGS += -DNO_TID"
1207   echo "CFLAGS += -DNO_GDB"
1208 fi
1209
1210 if test "x$WANT_X264_HIDEPTH" = "xyes" ; then
1211   X264_CFG_PARAMS="$X264_CFG_PARAMS --bit-depth=10"
1212 fi
1213 if test "x$WANT_X265_HIDEPTH" = "xyes" ; then
1214   X265_CFG_PARAMS="$X265_CFG_PARAMS -DHIGH_BIT_DEPTH:BOOL=ON" # -DMAIN12:BOOL=ON"
1215 fi
1216
1217 for pkg in $STATIC_PKGS; do
1218   eval pkg_lib="\$PKG_$pkg"
1219   if test "x$pkg_lib" = "xyes"; then
1220     echo "static_pkgs += $pkg"
1221   elif test "x$pkg_lib" = "xshared"; then
1222     echo "shared_pkgs += $pkg"
1223   fi
1224 done
1225 echo ""
1226
1227 for pkg in $STATIC_BLDS; do
1228   echo "static_blds += $pkg"
1229   ver_pkg=ver_$pkg
1230   echo "$ver_pkg := \$(THIRDPARTY)/${!ver_pkg}"
1231   inc_pkg=inc_$pkg
1232   echo "$inc_pkg := \\"
1233   for inc in ${!inc_pkg}; do
1234     echo "  -I\$($ver_pkg)/$inc \\"
1235   done
1236   echo ""
1237   echo "static_incs += \$(inc_$pkg)"
1238   lib_pkg=lib_$pkg
1239   echo "$lib_pkg := \\"
1240   for lib in ${!lib_pkg}; do
1241     echo "  \$($ver_pkg)/$lib \\"
1242   done
1243   echo ""
1244   echo "static_libs += \$($lib_pkg)"
1245   echo ""
1246 done
1247 echo ""
1248
1249 for lib in $SHARED_LIBS; do echo "shared_libs += $lib"; done
1250 echo ""
1251 for lib in $SYSTEM_LIBS; do echo "system_libs += $lib"; done
1252 echo "export static_pkgs shared_pkgs static_blds shared_libs system_libs"
1253 echo ""
1254
1255 echo "thirdparty_libraries := \$(static_libs) \$(shared_libs)"
1256
1257 if test "x$CFG_RPATH" != "x"; then
1258   echo "libraries+= -Wl,-rpath=$CFG_RPATH"
1259 fi
1260
1261 echo "libraries += -Wl,--start-group"
1262 echo "libraries += \$(thirdparty_libraries)"
1263 echo "libraries += \$(shared_libs)"
1264 echo "libraries += \$(system_libs)"
1265 echo "libraries += \$(EXTRA_LIBS)"
1266 echo "libraries += -Wl,--end-group"
1267 # -Wl,--start-group ... -Wl,--end-group does not work on ubuntu
1268 echo "libraries += \$(thirdparty_libraries)"
1269 echo "libraries += \$(shared_libs)"
1270 echo "libraries += \$(system_libs)"
1271 echo "libraries += \$(EXTRA_LIBS)"
1272 echo ""
1273 echo "export thirdparty_libraries libraries"
1274 echo "export CFLAGS_ CXXFLAGS_ LDFLAGS_"
1275 echo "unexport CFLAGS CXXFLAGS LDFLAGS"
1276
1277 if test "x$HAVE_tiff" = "xyes"; then
1278   if test "x$HAVE_jbig" != "xyes"; then
1279     echo "tiff.cfg_params+= --disable-jbig"
1280   fi
1281 fi
1282
1283 if test "x$WANT_GIT_FFMPEG" != "xno"; then
1284   echo "ffmpeg.git := $WANT_GIT_FFMPEG"
1285 fi
1286 if test "x$X264_CFG_PARAMS" != "x" ; then
1287   echo "x264.cfg_params :=$X264_CFG_PARAMS --enable-static --enable-pic"
1288 fi
1289 if test "x$X265_CFG_PARAMS" != "x" ; then
1290   echo "x265.cfg_params :=$X265_CFG_PARAMS -DENABLE_SHARED=no"
1291 fi
1292