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