d304dcd8fa238ab7483ffdd3b60fc6ba576b8003
[goodguy/history.git] / cinelerra-5.1 / configure.ac
1
2 AC_PREREQ([2.69])
3 AC_INIT([cinelerra], [5.1], [mail@lists.cinelerra-cv.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 -Wno-unused-result"
13 CFG_CFLAGS+=" -D__STDC_CONSTANT_MACROS"
14 CFG_CFLAGS+=" -D__STDC_LIMIT_MACROS"
15 CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
16 CFG_CFLAGS+=" -I/usr/include/freetype2"
17
18 AC_DEFUN([CHECK_WITH], [
19 AC_ARG_WITH([$1],
20   AC_HELP_STRING([--with-[$1]], [$2 ($4)]),
21   [WANT_$3=$withval], [WANT_$3='$4'])
22 AC_SUBST([WANT_$3])
23 ])
24
25 CHECK_WITH([jobs],[parallel build jobs],[JOBS],[auto])
26 CHECK_WITH([exec-name],[binary executable name],[CIN],[cin])
27 CHECK_WITH([single-user],[to install cin in bin],[CINBIN_BUILD],[no])
28 CHECK_WITH([ladspa-build],[build ladspa library],[LADSPA_BUILD],[yes])
29 CHECK_WITH([cinlib],[cinelerra library path],[CINLIB_DIR],[auto])
30 CHECK_WITH([cindat],[cinelerra share path],[CINDAT_DIR],[auto])
31 CHECK_WITH([plugin-dir],[plugin install dir],[PLUGIN_DIR],[auto])
32 CHECK_WITH([ladspa-dir],[ladspa install dir],[LADSPA_DIR],[auto])
33 CHECK_WITH([config-dir],[.bcast config dir],[CONFIG_DIR],[$$HOME/.bcast5])
34
35 if test "x$WANT_CINBIN_BUILD" = "xyes"; then
36   WANT_LOCALE_DIR='$$CIN_LIB/locale'
37   test "x$WANT_CINDAT_DIR" = "xauto" && WANT_CINDAT_DIR='$$CIN_PATH'
38   test "x$WANT_CINLIB_DIR" = "xauto" && WANT_CINLIB_DIR='$$CIN_PATH'
39   test "x$WANT_PLUGIN_DIR" = "xauto" && WANT_PLUGIN_DIR='$$CIN_LIB/plugins'
40   test "x$WANT_LADSPA_DIR" = "xauto" && WANT_LADSPA_DIR='$$CIN_LIB/ladspa'
41   sinstall=dinstall
42   suninstall=duninstall
43 else
44   lcldir=`test "x$prefix" = "xNONE" && prefix=$ac_default_prefix; \
45     test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \
46     eval "dir=\"$localedir\""; eval "dir=\"$dir\""; eval "dir=\"$dir\""; \
47     echo "$dir"`
48   usrdat=`test "x$prefix" = "xNONE" && prefix=$ac_default_prefix; \
49     test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \
50     eval "dir=\"$datadir\""; eval "dir=\"$dir\""; eval "dir=\"$dir\""; \
51     echo "$dir"`
52   usrlib=`test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"; \
53     test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \
54     eval "dir=\"$libdir\""; eval "dir=\"$dir\""; eval "dir=\"$dir\""; \
55     echo "$dir"`
56   test "x$usrlib" = "x/lib" -o "x$usrlib" = "x/usr/lib" -o \
57        "x$usrlib" = "x/usr/local/lib" -a -e "/usr/lib64" && \
58   test ! -e "/usr/lib" -o `ls -1 /usr/lib64 | wc -l` -gt `ls -1 /usr/lib | wc -l` && \
59     usrlib+="64"
60   WANT_LOCALE_DIR="$lcldir"
61   test "x$WANT_CINDAT_DIR" = "xauto" && WANT_CINDAT_DIR="$usrdat/$WANT_CIN"
62   test "x$WANT_CINLIB_DIR" = "xauto" && WANT_CINLIB_DIR="$usrlib/$WANT_CIN"
63   test "x$WANT_PLUGIN_DIR" = "xauto" && WANT_PLUGIN_DIR="$WANT_CINLIB_DIR/plugins"
64   test "x$WANT_LADSPA_DIR" = "xauto" && WANT_LADSPA_DIR="$WANT_CINLIB_DIR/ladspa"
65   sinstall=cinstall
66   suninstall=cuninstall
67 fi
68 AC_SUBST(sinstall)
69 AC_SUBST(suninstall)
70
71 if test "x$WANT_JOBS" = "xauto"; then
72   CPUS=`grep -c "^proc" /proc/cpuinfo`
73   WANT_JOBS=`expr $CPUS + $CPUS / 2 + 2`
74 fi
75
76 AC_DEFUN([PKG_DEF],[
77 STATIC_PKGS+=" [$1]"
78 ver_$1="$2"
79 lib_$1="$3"
80 inc_$1="$4"
81 ])
82
83 AC_DEFUN([PKG_3RD],[
84 AC_ARG_ENABLE([$1],
85   AC_HELP_STRING([--enable-$1],[build $1 ($2)]),
86   [PKG_$1=$enableval], [PKG_$1=$2])
87 PKG_DEF([$1],[$3],[$4],[$5])
88 ])
89
90 # thirdparty builds
91
92 PKG_3RD([a52dec],[yes],
93   [a52dec-0.7.4],
94   [ liba52/.libs/liba52.a ],
95   [ include ])
96
97 PKG_3RD([audiofile],[auto],
98   [audiofile-0.3.6],
99   [ libaudiofile/.libs/libaudiofile.a \
100     libaudiofile/modules/.libs/libmodules.a \
101     libaudiofile/alac/.libs/libalac.a ],
102   [ libaudiofile ])
103
104 PKG_3RD([encore],[yes],
105   [encore-5.0],
106   [ \$(OBJDIR)/libencore.a ],
107   [ . ])
108
109 PKG_3RD([esound],[auto],
110   [esound-0.2.41],
111   [ .libs/libesd.a \
112     .libs/libesddsp.a ],
113   [ . ])
114
115 PKG_3RD([faac],[auto],
116   [faac-1.28],
117   [ libfaac/.libs/libfaac.a \
118     common/mp4v2/libmp4v2.a ],
119   [ include ])
120
121 PKG_3RD([faad2],[auto],
122   [faad2-2.7],
123   [ libfaad/.libs/libfaad.a \
124     common/mp4ff/libmp4ff.a ],
125   [ include ])
126
127 PKG_3RD([fdk],[auto],
128   [fdk-aac-0.1.4],
129   [ .libs/libfdk-aac.a ],
130   [ libAACdec/include libAACenc/include libSYS/include ])
131
132 PKG_3RD([ffmpeg],[yes],
133   [ffmpeg-3.0],
134   [ libavutil/libavutil.a \
135     libavcodec/libavcodec.a \
136     libpostproc/libpostproc.a \
137     libavdevice/libavdevice.a \
138     libavformat/libavformat.a \
139     libswscale/libswscale.a \
140     libavfilter/libavfilter.a \
141     libswresample/libswresample.a ],
142   [ . ])
143
144 PKG_3RD([fftw],[auto],
145   [fftw-3.3.4],
146   [ .libs/libfftw3.a \
147     libbench2/libbench2.a \
148     rdft/scalar/r2cb/.libs/librdft_scalar_r2cb.a \
149     rdft/scalar/r2r/.libs/librdft_scalar_r2r.a \
150     rdft/scalar/.libs/librdft_scalar.a \
151     rdft/scalar/r2cf/.libs/librdft_scalar_r2cf.a \
152     rdft/.libs/librdft.a \
153     api/.libs/libapi.a \
154     reodft/.libs/libreodft.a \
155     dft/scalar/codelets/.libs/libdft_scalar_codelets.a \
156     dft/scalar/.libs/libdft_scalar.a \
157     dft/.libs/libdft.a \
158     kernel/.libs/libkernel.a \
159     simd-support/.libs/libsimd_support.a \
160     simd-support/.libs/libsimd_sse2_nonportable.a ],
161   [ api ])
162
163 PKG_3RD([flac],[auto],
164   [flac-1.3.1],
165   [ src/libFLAC/.libs/libFLAC.a \
166     src/libFLAC++/.libs/libFLAC++.a \
167     src/share/replaygain_analysis/.libs/libreplaygain_analysis.a \
168     src/share/replaygain_synthesis/.libs/libreplaygain_synthesis.a \
169     src/share/grabbag/.libs/libgrabbag.a \
170     src/share/utf8/.libs/libutf8.a \
171     src/test_libs_common/.libs/libtest_libs_common.a ],
172   [ include ])
173
174 PKG_3RD([giflib],[yes],
175   [giflib-5.1.2],
176   [ lib/.libs/libgif.a \
177     util/libgetarg.a ],
178   [ lib ])
179
180 PKG_3RD([ilmbase],[auto],
181   [ilmbase-2.2.0],
182   [ Iex/.libs/libIex.a \
183     IexMath/.libs/libIexMath.a \
184     Half/.libs/libHalf.a \
185     Imath/.libs/libImath.a \
186     IlmThread/.libs/libIlmThread.a ],
187   [ Iex Half Imath config IlmThread ])
188
189 PKG_DEF([ladspa], [ladspa-05182015], [], [])
190
191 PKG_3RD([lame],[auto],
192   [lame-3.99.5],
193   [ libmp3lame/.libs/libmp3lame.a \
194     mpglib/.libs/libmpgdecoder.a ],
195   [ include ])
196
197 PKG_3RD([libavc1394],[auto],
198   [libavc1394-0.5.4],
199   [ libavc1394/.libs/libavc1394.a \
200     librom1394/.libs/librom1394.a \
201     common/.libs/libraw1394util.a ],
202   [ . ])
203
204 PKG_3RD([libraw1394],[auto],
205   [libraw1394-2.0.5],
206   [ src/.libs/libraw1394.a ],
207   [ . ])
208
209 PKG_3RD([libiec61883],[auto],
210   [libiec61883-1.2.0],
211   [ src/.libs/libiec61883.a ],
212   [ src ])
213
214 PKG_3RD([libdv],[auto],
215   [libdv-1.0.0],
216   [ libdv/.libs/libdv.a ],
217   [ . ])
218
219 PKG_3RD([libjpeg],[auto],
220   [libjpeg-turbo-1.4.0],
221   [ .libs/libjpeg.a \
222     .libs/libturbojpeg.a \
223     simd/.libs/libsimd.a ],
224   [ . ])
225
226 PKG_3RD([openjpeg],[yes],
227   [openjpeg-2.1.0-20160221],
228   [ bin/libopenjp2.a ],
229   [ src/lib/openjp2 ])
230
231 PKG_3RD([libogg],[auto],
232   [libogg-1.3.2],
233   [ src/.libs/libogg.a ],
234   [ include ])
235
236 PKG_3RD([libsndfile],[auto],
237   [libsndfile-1.0.26],
238   [ src/.libs/libsndfile.a \
239     src/.libs/libcommon.a \
240     src/G72x/.libs/libg72x.a \
241     src/GSM610/.libs/libgsm.a ],
242   [ . ])
243
244 PKG_3RD([libtheora],[auto],
245   [libtheora-1.1.1],
246   [ lib/.libs/libtheora.a \
247     lib/.libs/libtheoradec.a \
248     lib/.libs/libtheoraenc.a ],
249   [ . ])
250
251 PKG_3RD([libuuid],[yes],
252   [libuuid-1.0.3],
253   [ .libs/libuuid.a ],
254   [ . ])
255
256 PKG_3RD([libvorbis],[auto],
257   [libvorbis-1.3.5],
258   [ lib/.libs/libvorbis.a \
259     lib/.libs/libvorbisenc.a \
260     lib/.libs/libvorbisfile.a ],
261   [ include . ])
262
263 PKG_3RD([mjpegtools],[yes],
264   [mjpegtools-2.1.0],
265   [ utils/mmxsse/.libs/libmmxsse.a \
266     utils/.libs/libmjpegutils.a \
267     lavtools/.libs/liblavfile.a \
268     lavtools/.libs/liblavjpeg.a \
269     mplex/.libs/libmplex2.a \
270     yuvfilters/.libs/libyuvfilters.a \
271     mpeg2enc/.libs/libmpeg2encpp.a ],
272   [ .  lavtools utils ])
273
274 PKG_3RD([openexr],[auto],
275   [openexr-2.2.0],
276   [ IlmImf/.libs/libIlmImf.a \
277     IlmImfUtil/.libs/libIlmImfUtil.a ],
278   [ IlmImf config ])
279
280 #PKG_3RD([festival],[no],
281 #  [festival],
282 #  [],
283 #  [])
284 #PKG_3RD(speech_tools,[no],
285 #  [speech_tools],
286 #  [],
287 #  [])
288 #
289 PKG_3RD([tiff],[auto],
290   [tiff-3.8.2],
291   [ libtiff/.libs/libtiff.a \
292     libtiff/.libs/libtiffxx.a \
293     port/.libs/libport.a ],[
294    . ])
295
296 PKG_3RD([twolame],[auto],
297   [twolame-0.3.13],
298   [ libtwolame/.libs/libtwolame.a ],
299   [  libtwolame ])
300
301 PKG_3RD([x264],[yes],
302   [x264-snapshot-20160220-2245-stable],
303   [ libx264.a ],
304   [ . ])
305
306 PKG_3RD([x265],[yes],
307   [x265_1.9],
308   [ libx265.a ],
309   [ . source ])
310
311 PKG_3RD([libvpx],[auto],
312   [libvpx-1.5.0],
313   [ libvpx.a ],
314   [ . ])
315
316 AC_SUBST(STATIC_PKGS)
317
318 AC_DEFUN([CHECK_ENABLE], [
319 AC_ARG_ENABLE([$1],
320   AC_HELP_STRING([--enable-[$1]], [$3 ([$4])]),
321   [WANT_$2=$enableval], [WANT_$2=[$4]])
322 ])
323
324 CHECK_ENABLE([static-build], [STATIC_BUILD], [build static], [auto])
325 CHECK_ENABLE([x264_hidepth], [X264_HIDEPTH], [build x264 10bit], [no])
326 CHECK_ENABLE([x265_hidepth], [X265_HIDEPTH], [build x265 10/12bit], [no])
327
328 test "x$WANT_STATIC_BUILD" = "xauto" && WANT_STATIC_BUILD=$WANT_CINBIN_BUILD
329
330 AC_DEFUN([CHECK_PROG], [
331  AC_CHECK_PROG([PROG_$1], [$2], [yes],[no])
332 ])
333 AC_DEFUN([REQUIRE_PROG], [
334  CHECK_PROG([$1],[$2])
335  if test "x$PROG_$1" = "xno"; then
336    AC_MSG_WARN([$2 is missing and required.])
337    FATAL_ERROR=1
338  fi
339 ])
340
341 # Checks for programs.
342
343 REQUIRE_PROG(NASM, [nasm])
344 REQUIRE_PROG(YASM, [yasm])
345 REQUIRE_PROG(OBJCOPY, [objcopy])
346 if test "x$FATAL_ERROR" != "x"; then
347  AC_MSG_ERROR("fatal eror.")
348 fi
349 CHECK_PROG(PACTL, [pactl])
350
351 AC_CHECK_DECL([X_HAVE_UTF8_STRING],,[no_utf=yes],[#include <X11/Xlib.h>])
352 if test "$no_utf" = "yes"; then
353   AC_MSG_ERROR([Cinelerra requires utf8 support in X Windows.])
354 fi
355
356 # Checks for headers/libraries.
357
358 AC_DEFUN([CHECK_HEADERS], [
359 if test "x$HAVE_$1" != "xno"; then
360  AC_CHECK_HEADER(m4_apply([m4_car],m4_split([$3])), [HAVE_$1=yes], [HAVE_$1=no],
361   [m4_foreach([i], m4_split([$3]), [[#include "]i["
362 ]])])
363  AC_SUBST([HAVE_$1])
364  AC_MSG_CHECKING([$2])
365  AC_MSG_RESULT([$HAVE_$1])
366  if test "x$HAVE_$1" = "xno"; then
367   if test "x$PKG_$1" = "x"; then RESULT=no; fi
368  fi
369 fi
370 ])
371
372 AC_DEFUN([CHECK_LIB], [
373 if test "x$HAVE_$1" != "xno"; then
374  if test "x$PKG_$1" = "x" -o "x$WANT_STATIC_BUILD" = "xno"; then
375   AC_CHECK_LIB([$2], [$3], [HAVE_$1=yes], [HAVE_$1=no], [$4])
376   AC_SUBST([HAVE_$1])
377   if test "x$HAVE_$1" = "xyes"; then
378    if test "x$PKG_$1" = "x"; then
379     SYSTEM_LIBS+=" -l[$2]"
380     for lib in [$4]; do SYSTEM_LIBS+=" $lib"; done
381    else
382     SHARED_$1+=" -l[$2]"
383     for lib in [$4]; do SHARED_LIBS+=" $lib"; done
384    fi
385   elif test "x$PKG_$1" = "x"; then RESULT=no; fi
386  fi
387 fi
388 ])
389
390 CHECK_LIB([X11], [X11], [XOpenDisplay])
391 CHECK_HEADERS([X11], [X11 headers], [X11/X.h X11/Xlib.h X11/Xutil.h X11/cursorfont.h])
392 CHECK_HEADERS([X11], [X11 headers], [X11/keysym.h X11/Sunkeysym.h X11/Xatom.h X11/XF86keysym.h])
393 CHECK_LIB([XEXT], [Xext], [XShmQueryExtension])
394 CHECK_HEADERS([XEXT], [Xlib XShm extention], [X11/Xlib.h X11/extensions/XShm.h X11/extensions/shape.h])
395 CHECK_LIB([XINERAMA], [Xinerama], [XineramaQueryExtension])
396 CHECK_HEADERS([XINERAMA], [Xinerama headers], [X11/extensions/Xinerama.h])
397 CHECK_LIB([XV], [Xv], [XvQueryExtension])
398 CHECK_HEADERS([XV], [Xlib Xv extention], [X11/Xlib.h X11/extensions/Xvlib.h])
399 CHECK_LIB([BZ2], [bz2], [BZ2_bzDecompress])
400 CHECK_LIB([FONTCONFIG], [fontconfig], [FcInit])
401 CHECK_LIB([FREETYPE], [freetype], [FT_Init_FreeType])
402 CHECK_LIB([LZMA], [lzma], [lzma_version_number])
403 CHECK_LIB([PNG], [png], [png_read_png])
404 CHECK_LIB([PTHREAD], [pthread], [pthread_create])
405 CHECK_LIB([Z], [z], [gzopen])
406 CHECK_LIB([fftw], [fftw3], [fftw_execute])
407 CHECK_HEADERS([fftw], [fftw headers], [fftw3.h])
408 CHECK_LIB([libuuid], [uuid], [uuid_clear])
409 CHECK_HEADERS([libuuid], [uuid headers], [uuid/uuid.h])
410 CHECK_HEADERS([LINUX_CDROM], [linux cdrom headers], [linux/cdrom.h linux/futex.h])
411 CHECK_HEADERS([LINUX_SYS], [linux sys], [sys/ioctl.h sys/stat.h sys/types.h sys/time.h sys/syscall.h])
412 CHECK_LIB([flac], [FLAC], [FLAC__stream_decoder_new])
413 CHECK_HEADERS([flac], [FLAC headers], [FLAC/stream_decoder.h])
414 CHECK_LIB([lame], [mp3lame], [lame_init])
415 CHECK_HEADERS([lame], [lame headers], [lame/lame.h])
416 CHECK_LIB([libjpeg], [jpeg], [jpeg_start_decompress])
417 CHECK_HEADERS([libjpeg], [jpeg headers], [stdio.h jpeglib.h])
418 CHECK_LIB([libogg], [ogg], [ogg_stream_init])
419 CHECK_HEADERS([libogg], [ogg headers], [ogg/ogg.h])
420 CHECK_LIB([openjpeg], [openjpeg], [opj_version])
421 CHECK_HEADERS([openjpeg], [openjpeg headers], [openjpeg.h])
422 CHECK_LIB([libsndfile], [sndfile], [sf_open])
423 CHECK_HEADERS([libsndfile], [sndfile headers], [sndfile.h])
424 CHECK_LIB([ilmbase], [IlmImf], [ImfOpenInputFile])
425 CHECK_HEADERS([ilmbase], [IlmImf headers], [OpenEXR/ImfCRgbaFile.h])
426 CHECK_LIB([libtheora], [theora], [theora_info_init], [-ltheoraenc -ltheoradec -logg])
427 CHECK_HEADERS([libtheora], [threora headers], [theora/theoraenc.h])
428 CHECK_LIB([libvorbis], [vorbisenc], [vorbis_encode_init], [-lvorbis -lvorbisfile -logg])
429 CHECK_HEADERS([libvorbis], [vorbis encoders headers], [vorbis/vorbisenc.h])
430 CHECK_LIB([libvorbis], [vorbisfile], [ov_open])
431 CHECK_HEADERS([libvorbis], [vorbis file headers], [vorbis/vorbisfile.h])
432 CHECK_LIB([libvpx], [vpx], [vpx_codec_decode])
433 CHECK_HEADERS([libvpx], [vpx headers], [vpx/vpx_decoder.h])
434 CHECK_LIB([tiff], [tiff], [TIFFOpen])
435 CHECK_HEADERS([tiff], [tiff headers], [tiff.h tiffio.h])
436 CHECK_LIB([twolame], [twolame], [twolame_encode_buffer_float32_interleaved])
437 CHECK_HEADERS([twolame], [twolame headers], [twolame.h])
438 CHECK_LIB([x264], [x264], [x264_encoder_encode])
439 CHECK_HEADERS([x264], [x264 headers], [stdint.h x264.h])
440 CHECK_LIB([x265], [x265], [x265_encoder_encode])
441 CHECK_HEADERS([x265], [x265 headers], [x265.h])
442 CHECK_LIB([a52dec], [a52], [a52_init])
443 CHECK_HEADERS([a52dec], [a52 headers], [a52.h])
444 CHECK_LIB([encore], [encore], [encore])
445 CHECK_HEADERS([encore], [encore headers], [encore.h])
446 CHECK_LIB([faac], [faac], [faacEncOpen])
447 CHECK_HEADERS([faac], [faac headers], [faac.h])
448 CHECK_LIB([faad2], [faad], [faacDecInit])
449 CHECK_HEADERS([faad2], [faad headers], [faad.h])
450 CHECK_LIB([giflib], [gif], [DGifOpen])
451 CHECK_HEADERS([giflib], [gif lib headers], [gif_lib.h])
452 CHECK_LIB([fdk], [fdk-aac], [faacDecInit])
453 CHECK_HEADERS([fdk], [fdk headers], [fdk-aac/genericStds.h])
454
455
456 AC_DEFUN([CHECK_WANT], [
457 RESULT=yes
458 AC_ARG_WITH(m4_tolower([$1]),
459  AC_HELP_STRING([m4_join([-],[--with],m4_tolower([$1]))], [$2] (auto)),
460   [WANT_$1=$withval],[WANT_$1=auto])
461 # WANT_$1
462 if test "x$WANT_$1" != "xno" ; then
463  m4_quote($3)
464 fi
465 if test "x$RESULT" = "xno" -a "x$PKG_$1" = "x"; then
466  echo "=== want $1 Failed."
467  WANT_$1=no
468 else
469  WANT_$1=yes
470 fi
471 CFG_WANTS+=" $1"
472 AC_SUBST([WANT_$1])
473 ])
474
475 CHECK_WANT([GL], [use opengl], [
476  CHECK_LIB([GL], [GL], [glUseProgram])
477  CHECK_LIB([GL], [GLU], [gluOrtho2D])
478  CHECK_HEADERS([GL], [opengl headers], [GL/gl.h GL/glext.h GL/glu.h GL/glx.h])])
479
480 CHECK_WANT([OSS], [use OSS audio], [
481  CHECK_HEADERS([OSS], [oss headers], [sys/soundcard.h])])
482
483 CHECK_WANT([XFT], [use libXft], [
484  CHECK_LIB([XFT], [Xft], [XftInit])
485  CHECK_HEADERS([XFT], [Xft/freetype headers], [X11/Xlib.h X11/Xft/Xft.h])])
486
487 CHECK_WANT([ALSA], [use libasound/alsa], [
488  CHECK_LIB([ALSA], [asound], [snd_pcm_open])
489  CHECK_HEADERS([ALSA], [asound headers], [alsa/asoundlib.h])])
490
491 CHECK_WANT([FIREWIRE], [use firewire], [
492  CHECK_LIB([libavc1394], [avc1394], [avc1394_init_target])
493  CHECK_HEADERS([libavc1394], [libavc1394 headers], [libavc1394/avc1394.h])
494  CHECK_LIB([libavc1394], [rom1394], [rom1394_get_bus_id])
495  CHECK_HEADERS([libavc1394], [librom1394 headers], [libavc1394/rom1394.h])
496  CHECK_LIB([libiec61883], [iec61883], [iec61883_mpeg2_recv_init])
497  CHECK_HEADERS([libiec61883], [libiec61883 headers], [libiec61883/iec61883.h])
498  CHECK_LIB([libraw1394], [raw1394], [raw1394_iso_recv_init])
499  CHECK_HEADERS([libraw1394], [libraw1394 headers], [libraw1394/raw1394.h])])
500
501 CHECK_WANT([DV], [use dv], [
502  CHECK_LIB([libdv], [dv], [dv_init])
503  CHECK_HEADERS([libdv], [libdv headers], [libdv/dv.h])])
504
505 CHECK_WANT([DVB], [use dvb], [
506  CHECK_HEADERS([DVB], [dvb device headers], [linux/dvb/dmx.h linux/dvb/frontend.h])])
507
508 CHECK_WANT([VIDEO4LINUX2], [use v4l2], [
509  CHECK_HEADERS([VIDEO4LINUX2], [v4l2 system headers], [linux/kernel.h linux/types.h linux/videodev2.h])])
510
511 CHECK_WANT([XXF86VM], [use xf86vmode], [
512  CHECK_HEADERS([XXF86VM], [XF86VM headers], [X11/Xlib.h X11/extensions/xf86vmode.h])])
513
514 CHECK_WANT([ESOUND], [use esd], [
515  CHECK_LIB([esound], [esd], [esd_open_sound])
516  CHECK_HEADERS([esound], [esound headers], [esd.h])
517  CHECK_LIB([audiofile], [audiofile], [afOpenFile])
518  CHECK_HEADERS([audiofile], [audiofile headers], [audiofile.h])])
519
520 CHECK_WANT([DL], [system has libdl], [
521  CHECK_LIB([DL], [dl], [dlopen])])
522
523 CHECK_WANT([NUMA], [system has libnuma], [
524  CHECK_LIB([NUMA], [numa], [numa_alloc])])
525
526
527 AC_MSG_CHECKING([for openexr available])
528 saved_LIBS="$LIBS"
529 saved_CXXFLAGS="$CXXFLAGS"
530 # ilmbase libs
531 LIBS=" -lIlmImf -lIlmThread -lIex"
532 CXXFLAGS="-I/usr/include/OpenEXR"
533 AC_LANG_PUSH(C++)
534 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
535 #include "ImfChannelList.h"
536 #include "ImfChromaticities.h"
537 #include "ImfCompression.h"
538 #include "ImfIO.h"
539 #include "ImfInputFile.h"
540 #include "ImfOutputFile.h"
541 #include "ImfPixelType.h"
542 #include "ImfRgbaFile.h"
543 #include "ImfRgbaYca.h"
544 #include "ImfVersion.h"
545 class EXRIStream : public Imf::IStream { public:
546 EXRIStream() : Imf::IStream("mypath") {} };
547 class EXROStream : public Imf::OStream { public: 
548 EXROStream() : Imf::OStream("mypath") {} };
549 ]])], [HAVE_openexr=yes], [HAVE_openexr=no])
550 if test "x$HAVE_openexr" = "xyes"; then
551   SHARED_openexr="$LIBS"
552 fi
553 LIBS="$saved_LIBS"
554 CXXFLAGS="$saved_CXXFLAGS"
555 AC_LANG_POP(C++)
556 AC_MSG_RESULT([$HAVE_openexr])
557 AC_SUBST([HAVE_openexr])
558
559 # build global_config
560 OBJDIR=`uname -m`
561 AC_SUBST(OBJDIR)
562
563 echo "AC_HELP_STRING([Reason],[Package])"
564 echo "AC_HELP_STRING([------],[-------])"
565
566 AC_DEFUN([PKG_DISABLED],[
567   BUILD_$1=0
568   AC_SUBST(BUILD_$1)
569   echo "AC_HELP_STRING([disabled],[$1])"
570 ])
571 AC_DEFUN([PKG_SHARED],[
572  BUILD_$1=0
573  AC_SUBST(BUILD_$1)
574  SHARED_LIBS+="$SHARED_$1"
575  echo "AC_HELP_STRING([shared],[$1])"
576 ])
577 AC_DEFUN([PKG_STATIC],[
578  BUILD_$1=1
579  AC_SUBST(BUILD_$1)
580  STATIC_BLDS+=" [$1]"
581  echo "AC_HELP_STRING([$2],[$1])"
582 ])
583 AC_DEFUN([PKG_FORCED],[PKG_STATIC([$1],[forced])])
584
585 # order matters
586 for dep in \
587         ffmpeg/faac ffmpeg/faad2 ffmpeg/twolame ffmpeg/lame ffmpeg/openjpeg \
588         ffmpeg/libvorbis ffmpeg/libtheora ffmpeg/x264 ffmpeg/fdk \
589         libiec61883/libraw1394 libavc1394/librom1394 \
590         openexr/ilmbase ilmbase/libogg \
591         libtheora/libogg libtheora/libvorbis ; do
592   lib=`dirname $dep`
593   eval pkg_lib="\$PKG_$lib"; eval have_lib="\$HAVE_$lib";
594   if test "x$pkg_lib" != "xno" ; then
595     needs=`basename $dep`
596     eval "PKG_$needs=yes"
597   fi
598 done
599
600 AC_DEFUN([PKG_PROVIDE],[
601 if test "x$BUILD_$1" = "x" ; then
602  if test "x$2" = "xno" -o "x$PKG_$1" = "xno"; then
603   PKG_DISABLED([$1])
604  elif test "x$PKG_$1" = "xyes"; then
605   PKG_FORCED([$1])
606  elif test "x$WANT_STATIC_BUILD" = "xyes"; then
607   PKG_STATIC([$1],[static])
608  elif test "x$HAVE_$1" = "xyes"; then
609   PKG_SHARED([$1])
610  else
611   PKG_STATIC([$1],[needed])
612  fi
613 fi
614 ])
615
616 PKG_PROVIDE([a52dec])
617 PKG_PROVIDE([encore])
618 PKG_PROVIDE([audiofile],[$WANT_ESOUND])
619 PKG_PROVIDE([esound],[$WANT_ESOUND])
620 PKG_PROVIDE([faac])
621 PKG_PROVIDE([faad2])
622 PKG_PROVIDE([fdk])
623 PKG_PROVIDE([ffmpeg])
624 PKG_PROVIDE([fftw])
625 PKG_PROVIDE([flac])
626 PKG_PROVIDE([giflib])
627 PKG_PROVIDE([ilmbase])
628 PKG_PROVIDE([ladspa],[$WANT_LADSPA_BUILD])
629 PKG_PROVIDE([lame])
630 PKG_PROVIDE([libavc1394],[$WANT_FIREWIRE])
631 PKG_PROVIDE([libraw1394],[$WANT_FIREWIRE])
632 PKG_PROVIDE([libiec61883],[$WANT_FIREWIRE])
633 PKG_PROVIDE([libdv],[$WANT_DV])
634 PKG_PROVIDE([libjpeg])
635 PKG_PROVIDE([libogg])
636 PKG_PROVIDE([libsndfile])
637 PKG_PROVIDE([libtheora])
638 PKG_PROVIDE([libuuid])
639 PKG_PROVIDE([libvorbis])
640 PKG_PROVIDE([mjpegtools])
641 PKG_PROVIDE([openexr])
642 PKG_PROVIDE([openjpeg])
643 PKG_PROVIDE([tiff])
644 PKG_PROVIDE([twolame])
645 PKG_PROVIDE([x264])
646 PKG_PROVIDE([x265])
647 PKG_PROVIDE([libvpx])
648
649 AC_SUBST(STATIC_BLDS)
650 AC_SUBST(SHARED_LIBS)
651
652 for f in $SYSTEM_LIBS; do
653   echo "AC_HELP_STRING([system],[$f])"
654 done
655 AC_SUBST(SYSTEM_LIBS)
656
657 echo ""
658 for v in GL XFT XXF86VM OSS ALSA FIREWIRE DV DVB \
659          VIDEO4LINUX2 ESOUND; do
660   eval vv="\$WANT_$v"
661   if test "x$vv" != "xno"; then
662     CFG_CFLAGS+=" -DHAVE_$v"
663     vv=with
664   else
665     vv=without
666   fi
667   v=`echo "$v" | tr "A-Z" "a-z"`
668   echo "  using: $vv-$v"
669 done
670
671 echo "  using: with-jobs = $WANT_JOBS"
672 echo "  using: exec-name = $WANT_CIN"
673 echo "  using: with-cinlib = $WANT_CINLIB_DIR"
674 echo "  using: with-cindat = $WANT_CINDAT_DIR"
675 echo "  using: with-config-dir = $WANT_CONFIG_DIR"
676 echo "  using: with-plugin-dir = $WANT_PLUGIN_DIR"
677 echo "  using: with-ladspa-dir = $WANT_LADSPA_DIR"
678 echo ""
679 echo "  using: single-user  = $WANT_CINBIN_BUILD"
680 echo "  using: static-build = $WANT_STATIC_BUILD"
681 echo "  using: ladspa-build = $WANT_LADSPA_BUILD"
682 echo ""
683
684 # build extras
685 if test "x$HAVE_NUMA" = "xyes"; then
686   EXTRA_LIBS+=' -lnuma'
687 fi
688 if test "x$HAVE_DL" = "xyes"; then
689   EXTRA_LIBS+=' -ldl'
690   FFMPEG_EXTRA_CFG+=' --extra-ldflags="-ldl"'
691 fi
692 AC_SUBST(EXTRA_LIBS)
693 AC_SUBST(FFMPEG_EXTRA_CFG)
694 AC_SUBST(WANT_X264_HIDEPTH)
695 AC_SUBST(WANT_X265_HIDEPTH)
696
697 if test "x$BUILD_openexr" = "x0"; then
698   CFG_CFLAGS+=" -I/usr/include/OpenEXR"
699 fi
700
701 AC_SUBST(CFG_CFLAGS)
702 AC_SUBST(CFG_CXXFLAGS)
703
704 AC_CONFIG_FILES([Makefile])
705 AC_OUTPUT
706
707 exec > global_config
708
709 echo "SHELL := /bin/bash"
710 echo "export SHELL"
711 echo "WANT_JOBS := $WANT_JOBS"
712 echo ""
713 echo "OBJDIR := $OBJDIR"
714 echo "BINDIR := \$(TOPDIR)/bin"
715 echo "CINELERRA := \$(TOPDIR)/cinelerra"
716 echo "GUICAST := \$(TOPDIR)/guicast"
717 echo "LIBZMPEG3 := \$(TOPDIR)/libzmpeg3"
718 echo "MPEG2ENC := \$(TOPDIR)/mpeg2enc"
719 echo "MPLEXLO := \$(TOPDIR)/mplexlo"
720 echo "PLUGINS := \$(TOPDIR)/plugins"
721 echo "TDB := \$(TOPDIR)/db"
722 echo "THIRDPARTY := \$(TOPDIR)/thirdparty"
723 echo "EXTRA_LIBS := $EXTRA_LIBS"
724 echo "FFMPEG_EXTRA_CFG := $FFMPEG_EXTRA_CFG"
725 echo "export OBJDIR BINDIR CINELERRA GUICAST LIBZMPEG3"
726 echo "export MPEG2ENC MPLEXLO PLUGINS TDB"
727 echo "export THIRDPARTY EXTRA_LIBS FFMPEG_EXTRA_CFG"
728 echo ""
729
730 echo "WANT_CIN := $WANT_CIN"
731 for w in $CFG_WANTS; do ww=WANT_$w; echo "WANT_$w := ${!ww}"; done
732 echo ""
733
734 echo "ifndef CFLAGS_"
735 echo "ifdef CFLAGS"
736 echo "CFLAGS_ := \$(CFLAGS)"
737 echo "else"
738 echo "CFLAGS_ := ${CFLAGS:--g -O2}"
739 echo "endif"
740 echo "endif"
741
742 echo "CFLAGS := \$(CFLAGS_)"
743 echo "CFLAGS += '-DCIN=\"\$(WANT_CIN)\"'"
744 echo "CFLAGS += '-DCINLIB_DIR=\"$WANT_CINLIB_DIR\"'"
745 echo "CFLAGS += '-DCINDAT_DIR=\"$WANT_CINDAT_DIR\"'"
746 echo "CFLAGS += '-DCONFIG_DIR=\"$WANT_CONFIG_DIR\"'"
747 echo "CFLAGS += '-DPLUGIN_DIR=\"$WANT_PLUGIN_DIR\"'"
748 echo "CFLAGS += '-DLOCALE_DIR=\"$WANT_LOCALE_DIR\"'"
749 echo "CFLAGS += '-DLADSPA_DIR=\"$WANT_LADSPA_DIR\"'"
750 for flg in $CFG_CFLAGS; do echo "CFLAGS += $flg"; done
751 echo ""
752 for flg in $CFG_CXXFLAGS; do echo "CXXFLAGS += $flg"; done
753 echo ""
754
755 if test  $WANT_X264_HIDEPTH = "yes" ; then
756   echo "x264.cfg_params := --enable-static --bit-depth=10"
757 fi
758 if test  $WANT_X265_HIDEPTH = "yes" ; then
759   echo "x265.cfg_params := -DENABLE_SHARED=no -DHIGH_BIT_DEPTH:BOOL=ON"
760 fi
761
762 for pkg in $STATIC_PKGS; do echo "static_pkgs += $pkg"; done
763 echo ""
764 for pkg in $STATIC_BLDS; do
765   echo "static_blds += $pkg"
766   ver_pkg=ver_$pkg
767   echo "$ver_pkg := \$(THIRDPARTY)/${!ver_pkg}"
768   inc_pkg=inc_$pkg
769   echo "$inc_pkg := \\"
770   for inc in ${!inc_pkg}; do
771     echo "  -I\$($ver_pkg)/$inc \\"
772   done
773   echo ""
774   echo "static_incs += \$(inc_$pkg)"
775   lib_pkg=lib_$pkg
776   echo "$lib_pkg := \\"
777   for lib in ${!lib_pkg}; do
778     echo "  \$($ver_pkg)/$lib \\"
779   done
780   echo ""
781   echo "static_libs += \$($lib_pkg)"
782   echo ""
783 done
784 echo ""
785
786 for lib in $SHARED_LIBS; do echo "shared_libs += $lib"; done
787 echo ""
788 for lib in $SYSTEM_LIBS; do echo "system_libs += $lib"; done
789 echo "export static_pkgs static_blds shared_libs system_libs"
790 echo ""
791
792 echo "thirdparty_libraries := \$(static_libs) \$(shared_libs)"
793 echo "libraries += -Wl,--start-group"
794 echo "libraries += \$(thirdparty_libraries)"
795 echo "libraries += \$(system_libs)"
796 echo "libraries += \$(EXTRA_LIBS)"
797 echo "libraries += -Wl,--end-group"
798 # -Wl,--start-group ... -Wl,--end-group does not work on ubuntu
799 echo "libraries += \$(thirdparty_libraries)"
800 echo "libraries += \$(system_libs)"
801 echo "libraries += \$(EXTRA_LIBS)"
802 echo ""
803 echo "export thirdparty_libraries libraries"
804 echo "export CFLAGS_ CXXFLAGS_ LDFLAGS_"
805 echo "unexport CFLAGS CXXFLAGS LDFLAGS"