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