1# Process this file with autoconf to produce a configure script.
2
3AC_INIT(transcode,1.1.7)
4AC_CONFIG_AUX_DIR(autotools)
5AC_CONFIG_SRCDIR(src/transcode.c)
6
7dnl Detect the canonical host and target build environment
8AC_CANONICAL_SYSTEM
9
10AM_INIT_AUTOMAKE(transcode,1.1.7)
11AM_CONFIG_HEADER(config.h)
12
13AM_MAINTAINER_MODE
14
15dnl Checks for programs.
16AC_LANG([C])
17AC_PROG_CC
18AM_PROG_CC_C_O
19AC_PROG_CPP
20AC_PROG_AWK
21AC_PROG_INSTALL
22AC_PROG_LN_S
23AC_PROG_MAKE_SET
24AM_PROG_AS
25AM_CONDITIONAL(HAVE_GCC, test x"$GCC" = x"yes")
26
27dnl Check for gcc2, which doesn't seem to handle asm templates
28dnl And check for gcc4, which also has problems with filter_tomsmocomp
29dnl
30gcc2=no
31gcc4=no
32if test x"$GCC" = x"yes" ; then
33  gcc_ver="`LANG=C $CC -dumpversion`"
34  if test x"$gcc_ver" != x"" ; then
35    if echo $gcc_ver | grep -q ^2 ; then
36      gcc2=yes
37    fi
38    if echo $gcc_ver | grep -q ^4 ; then
39      gcc4=yes
40    fi
41  fi
42fi
43AM_CONDITIONAL(HAVE_GCC2, test x"$gcc2" = x"yes")
44AM_CONDITIONAL(HAVE_GCC4, test x"$gcc4" = x"yes")
45
46dnl we got $AWK already, but not its full path
47AC_PATH_PROG(PATH_TO_AWK, $AWK)
48
49dnl Check the OS.  This has to be done here, after checks for proograms and
50dnl before checks for libraries.
51
52deflib="/lib"
53is_linux=no
54is_bsd=no
55is_osx=no
56case "${target_os}" in
57  *linux*)
58    is_linux=yes
59    AC_DEFINE([OS_LINUX], 1, [Define if your system is Linux])
60    ;;
61  freebsd*|openbsd*|netbsd*|bsdi*|darwin*|rhapsody*)
62    is_bsd=yes
63    AC_DEFINE([OS_BSD], 1, [Define if your system is modern BSD])
64
65  # darwin is a subcase of BSD
66  case "${target_os}" in
67    darwin*)
68      is_osx=yes
69      CFLAGS="${CFLAGS} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"
70      #LDFLAGS="${LDFLAGS} -all_load"
71
72      AC_DEFINE([OS_DARWIN], 1, [Define if this is a Darwin / MacOS X system.])
73      AC_DEFINE([BROKEN_PTHREADS], 1, [Define if you have weird pthreads.])
74
75      # Include Fink in compile and link if present
76      if test -d /sw; then
77        CPPFLAGS="${CPPFLAGS} -I/sw/include"
78        LDFLAGS="${LDFLAGS} -L/sw/lib"
79      fi
80      ;;
81  esac
82    ;;
83esac
84AM_CONDITIONAL([OS_LINUX], test x"$is_linux" = x"yes")
85AM_CONDITIONAL([OS_BSD], test x"$is_bsd" = x"yes")
86AM_CONDITIONAL([OS_DARWIN], test x"$is_osx" = x"yes")
87
88
89dnl Checks for libraries.
90AC_CHECK_LIB(dl, dlopen)
91AC_CHECK_FUNCS([dlopen])
92if test x"$is_osx" = x"true" ; then
93  AC_CHECK_FUNCS(dlsym_prepend_underscore,
94    [CFLAGS="${CFLAGS} -Ddlsym=dlsym_prepend_underscore"],
95    AC_MSG_WARN([Function 'dlsym_prepend_underscore' not found.])
96    AC_MSG_WARN([Using function 'dlsym' directly instead.])
97    AC_MSG_WARN([This can be a problem if the installed dlsym])
98    AC_MSG_WARN([does not automatically prepend an underscore])
99    AC_MSG_WARN([to symbols.]))
100fi
101
102USE_DLDARWIN=no
103if test x"$ac_cv_lib_dl_dlopen" = x"no" ; then
104  case x${target_os} in
105    xdarwin*)
106      USE_DLDARWIN=yes
107      DLDARWIN_CFLAGS="-I\$(top_srcdir)/libdldarwin/"
108      DLDARWIN_LIBS="\$(top_builddir)/libdldarwin/libdldarwin.a"
109      ;;
110  esac
111fi
112AC_SUBST(USE_DLDARWIN)
113AC_SUBST(DLDARWIN_CFLAGS)
114AC_SUBST(DLDARWIN_LIBS)
115AM_CONDITIONAL(USE_DLDARWIN, test x"$USE_DLDARWIN" = x"yes")
116
117dnl libtool setup
118AC_PROVIDE([AC_PROG_CXX])  dnl we don't want it!
119AC_PROVIDE([AC_PROG_F77])  dnl likewise
120AC_DISABLE_STATIC
121AC_LIBTOOL_DLOPEN
122AC_PROG_LIBTOOL
123
124
125dnl Checks for header files.
126TC_CHECK_STD_HEADERS
127AC_CHECK_HEADERS([endian.h malloc.h sys/mman.h sys/select.h])
128
129dnl Checks for typedefs, structures, and compiler characteristics.
130AC_C_CONST
131AC_C_INLINE
132AC_C_BIGENDIAN([words_bigendian=true
133  AC_DEFINE([WORDS_BIGENDIAN], 1, [Define if your CPU is big-endian.])],
134  words_bigendian=false)
135AM_CONDITIONAL(WORDS_BIGENDIAN, test x"$words_bigendian" = x"true")
136TC_C_GCC_ATTRIBUTES
137TC_C_ATTRIBUTE_ALIGNED
138
139dnl Checks for library functions.
140AC_FUNC_MALLOC
141AC_TYPE_SIGNAL
142AC_CHECK_FUNCS([getopt_long_only getpagesize gettimeofday mmap strlcat strlcpy strtof vsscanf])
143AM_CONDITIONAL(HAVE_GETOPT_LONG_ONLY, test x"$ac_cv_func_getopt_long_only" = x"yes")
144AM_CONDITIONAL(HAVE_MMAP, test x"$ac_cv_func_mmap" = x"yes")
145AM_CONDITIONAL(HAVE_GETTIMEOFDAY, test x"$ac_cv_func_gettimeofday" = x"yes")
146
147dnl Special check for sysconf() to ensure _SC_PAGESIZE is also available.
148AC_CACHE_CHECK([for sysconf(_SC_PAGESIZE)], ac_cv_sysconf_with_sc_pagesize,
149               [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],[[sysconf(_SC_PAGESIZE);]])],
150                                  [ac_cv_sysconf_with_sc_pagesize=yes],
151                                  [ac_cv_sysconf_with_sc_pagesize=no])])
152if test x"$ac_cv_sysconf_with_sc_pagesize" = x"yes"; then
153    AC_DEFINE([HAVE_SYSCONF_WITH_SC_PAGESIZE], 1,
154              [Define to 1 if you have sysconf(_SC_PAGESIZE).])
155fi
156
157dnl Large file support.
158AC_SYS_LARGEFILE
159AC_FUNC_FSEEKO
160
161dnl Thread support (pthreads).
162case "$host" in
163  *-*-freebsd*)
164    pthread_cflags="-pthread -D_REENTRANT -D_THREAD_SAFE"
165    pthread_libs="-pthread"
166    ;;
167  *-*-openbsd*)
168    pthread_cflags="-D_REENTRANT"
169    pthread_libs="-pthread"
170    ;;
171  *-*-bsdi*)
172    pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
173    pthread_libs=""
174    ;;
175  *)
176    pthread_cflags="-D_REENTRANT"
177    pthread_libs="-lpthread"
178    ;;
179esac
180# let user override
181if test -n "$PTHREAD_LIBS" ; then
182  pthread_libs="$PTHREAD_LIBS"
183fi
184if test -n "$PTHREAD_CFLAGS" ; then
185  pthread_cflags="$PTHREAD_CFLAGS"
186fi
187save_LIBS="$LIBS"
188LIBS="$LIBS $pthread_libs"
189save_CFLAGS="$CFLAGS"
190CFLAGS="$CFLAGS $pthread_cflags"
191AC_MSG_CHECKING(for pthreads in $pthread_libs)
192AC_TRY_LINK([
193#include <pthread.h>
194],[
195   pthread_attr_t type;
196   pthread_attr_init(&type);
197],
198  [use_pthreads="yes"],
199  [use_pthreads="no"]
200);
201LIBS="$save_LIBS"
202CFLAGS="$save_CFLAGS"
203AC_MSG_RESULT($use_pthreads)
204if test x"$use_pthreads" = x"yes" ; then
205  PTHREAD_LIBS="$pthread_libs"
206  PTHREAD_CFLAGS="$pthread_cflags"
207else
208  PTHREAD_LIBS=""
209  PTHREAD_CFLAGS=""
210fi
211AC_SUBST(PTHREAD_LIBS)
212AC_SUBST(PTHREAD_CFLAGS)
213
214
215dnl
216dnl Architecture specific instructions
217dnl
218
219AC_MSG_CHECKING([for build architecture])
220have_x86cpu=false
221have_x86_64cpu=false
222have_ppccpu=false
223case x"$host_cpu" in
224  xi?86*|xk6*)
225    have_x86cpu=true
226    AC_MSG_RESULT([Intel Pentium architecture (IA32)])
227    AC_DEFINE([ARCH_X86], 1, [Define if your machine is x86 based])
228    ;;
229  xx86_64*|xamd64*)
230    have_x86_64cpu=true
231    AC_MSG_RESULT([AMD64 architecture (AMD64)])
232    AC_DEFINE([ARCH_X86_64], 1, [Define if your machine is AMD64 based])
233    ;;
234  xpowerpc*)
235    have_ppccpu=true
236    AC_MSG_RESULT([Mac PPC architecture (PPC)])
237    AC_DEFINE([ARCH_PPC], 1, [Define if your machine is PPC based])
238    ;;
239  *)
240    ;;
241esac
242AM_CONDITIONAL(ARCH_X86, test x"$have_x86cpu" = x"true")
243AM_CONDITIONAL(ARCH_X86_64, test x"$have_x86_64cpu" = x"true")
244AM_CONDITIONAL(ARCH_PPC, test x"$have_ppccpu" = x"true")
245
246
247dnl x86 & x86_64 architectures
248
249dnl MMX support
250dnl
251explicit_mmx=no
252AC_ARG_ENABLE(mmx,
253  AC_HELP_STRING([--enable-mmx],
254    [enable MMX code portions (yes)]),
255  [case "${enableval}" in
256    yes) use_mmx=yes ;;
257    no)  use_mmx=no ;;
258    *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmx) ;;
259  esac
260  explicit_mmx=yes],
261  [if test x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" ; then
262    use_mmx=yes
263  else
264    use_mmx=no
265  fi])
266
267have_asm_mmx="no"
268if test x"$use_mmx" = x"yes" ; then
269  AC_MSG_CHECKING([if \$CC groks MMX inline assembly])
270  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));])],
271    [have_asm_mmx="yes"])
272  if test x"$have_asm_mmx" = x"yes" ; then
273    AC_DEFINE([HAVE_ASM_MMX], 1,
274      [Define if your compiler understands MMX assembly instructions])
275  fi
276  AC_MSG_RESULT($have_asm_mmx)
277  if test x"$have_asm_mmx" = x"no" -a x"$explicit_mmx" = x"yes" ; then
278    AC_MSG_WARN(*** Ignoring --enable-mmx due to no compiler support ***)
279  fi
280fi
281AM_CONDITIONAL(HAVE_ASM_MMX, test x"$have_asm_mmx" = x"yes")
282if test x"$have_asm_mmx" = x"no" ; then
283  AC_MSG_WARN(*** All MMX dependent parts will be disabled ***)
284fi
285
286dnl 3DNow support
287dnl
288explicit_3dnow=no
289AC_ARG_ENABLE(3dnow,
290  AC_HELP_STRING([--enable-3dnow],
291    [enable 3DNow code portions (yes)]),
292  [case "${enableval}" in
293    yes) if test x"$have_asm_mmx" = x"no"; then
294             AC_MSG_ERROR(--enable-3dnow requires --enable-mmx)
295         else
296             use_3dnow=yes
297         fi ;;
298    no)  use_3dnow=no ;;
299    *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
300  esac
301  explicit_3dnow=yes],
302  [if test x"$have_asm_mmx" = x"yes" -a \( x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" \) ; then
303    use_3dnow=yes
304  else
305    use_3dnow=no
306  fi])
307have_asm_3dnow="no"
308if test x"$use_3dnow" = x"yes" ; then
309  AC_MSG_CHECKING([if \$CC groks 3DNow inline assembly])
310  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p;asm volatile("pfmul %%mm3,%%mm4"::"r"(p));])],
311    [have_asm_3dnow="yes"])
312  if test x"$have_asm_3dnow" = x"yes" ; then
313    AC_DEFINE([HAVE_ASM_3DNOW], 1,
314      [Define if your compiler understands 3DNow assembly instructions])
315  fi
316  AC_MSG_RESULT($have_asm_3dnow)
317  if test x"$have_asm_3dnow" = x"no" -a x"$explicit_3dnow" = x"yes" ; then
318    AC_MSG_WARN(*** Ignoring --enable-3dnow due to no compiler support ***)
319  fi
320fi
321AM_CONDITIONAL(HAVE_ASM_3DNOW, test x"$have_asm_3dnow" = x"yes")
322if test x"$have_asm_3dnow" = x"no" ; then
323  AC_MSG_WARN(*** All 3DNow dependent parts will be disabled ***)
324fi
325
326
327dnl SSE support
328dnl
329explicit_sse=no
330AC_ARG_ENABLE(sse,
331  AC_HELP_STRING([--enable-sse],
332    [enable SSE code portions (yes)]),
333  [case "${enableval}" in
334    yes) if test x"$have_asm_mmx" = x"no"; then
335             AC_MSG_ERROR(--enable-sse requires --enable-mmx)
336         else
337             use_sse=yes
338         fi ;;
339    no)  use_sse=no ;;
340    *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
341  esac
342  explicit_sse=yes],
343  [if test x"$have_asm_mmx" = x"yes" -a \( x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" \) ; then
344    use_sse=yes
345  else
346    use_sse=no
347  fi])
348have_asm_sse="no"
349if test x"$use_sse" = x"yes" ; then
350  AC_MSG_CHECKING([if \$CC groks SSE inline assembly])
351  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p; asm volatile("movntps  %%xmm0, 0"::"r"(p));])],
352    [have_asm_sse=yes])
353  if test x"$have_asm_sse" = x"yes" ; then
354    AC_DEFINE([HAVE_ASM_SSE], 1,
355      [Define if your compiler understands SSE assembly instructions])
356  fi
357  AC_MSG_RESULT($have_asm_sse)
358  if test x"$have_asm_sse" = x"no" -a x"$explicit_sse" = x"yes" ; then
359    AC_MSG_WARN(*** Ignoring --enable-sse due to no compiler support ***)
360  fi
361fi
362AM_CONDITIONAL(HAVE_ASM_SSE, test x"$have_asm_sse" = x"yes")
363if test x"$have_asm_sse" = x"no" ; then
364  AC_MSG_WARN(*** All SSE dependent parts will be disabled ***)
365fi
366
367
368dnl SSE2 support
369dnl
370explicit_sse2=no
371AC_ARG_ENABLE(sse2,
372  AC_HELP_STRING([--enable-sse2],
373    [enable SSE2 code portions (yes)]),
374  [case "${enableval}" in
375    yes) if test x"$have_asm_sse" = x"no"; then
376             AC_MSG_ERROR(--enable-sse2 requires --enable-sse)
377         else
378             use_sse2=yes
379         fi ;;
380    no)  use_sse2=no ;;
381    *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse2) ;;
382  esac
383  explicit_sse2=yes],
384  [if test x"$have_asm_sse" = x"yes" -a \( x"$have_x86cpu" = x"true" -o x"$have_x86_64cpu" = x"true" \) ; then
385    use_sse2=yes
386  else
387    use_sse2=no
388  fi])
389have_asm_sse2="no"
390if test x"$use_sse2" = x"yes" ; then
391  AC_MSG_CHECKING([if \$CC can handle SSE2 inline asm])
392  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [void *p; asm volatile("movdqa  %%xmm2, %%xmm3"::"r"(p));])],
393    [have_asm_sse2=yes])
394  if test x"$have_asm_sse2" = x"yes" ; then
395    AC_DEFINE([HAVE_ASM_SSE2], 1,
396      [Define if your compiler understands SSE2 assembly instructions])
397  fi
398  AC_MSG_RESULT($have_asm_sse2)
399  if test x"$have_asm_sse2" = x"no" -a x"$explicit_sse2" = x"yes" ; then
400    AC_MSG_WARN(*** Ignoring --enable-sse2 due to no compiler support ***)
401  fi
402fi
403AM_CONDITIONAL(HAVE_ASM_SSE2, test x"$have_asm_sse2" = x"yes")
404if test x"$have_asm_sse2" = x"no" ; then
405  AC_MSG_RESULT(*** All SSE2 dependent parts will be disabled ***)
406fi
407
408
409
410dnl ppc architectures
411
412
413dnl
414dnl Altivec support
415dnl
416AC_ARG_ENABLE(altivec,
417  AC_HELP_STRING([--enable-altivec],
418    [enable Altivec code portions (yes)]),
419  [case "${enableval}" in
420    yes) use_altivec=yes ;;
421    no)  use_altivec=no ;;
422    *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
423  esac],
424  [if test x"$have_ppccpu" = x"true" ; then
425    use_altivec=yes
426  else
427    use_altivec=no
428  fi])
429dnl if test x"$use_altivec" = x"no" ; then
430dnl	AC_MSG_WARN(*** All Altivec dependent parts will be disabled ***)
431dnl fi
432
433
434AC_MSG_CHECKING([if \$CC groks AltiVec inline assembly])
435have_asm_altivec=no
436if test x"$use_altivec" = x"yes" ; then
437  AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [asm volatile("vperm 0,1,2,3");])],
438    [have_asm_altivec=yes],
439    [save_CFLAGS="$CFLAGS"
440      CFLAGS="$CFLAGS -Wa,-m7400"
441      AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [asm volatile("vperm 0,1,2,3");])],
442        [have_asm_altivec=yes])
443      CFLAGS="$save_CFLAGS"])
444fi
445AC_MSG_RESULT($have_asm_altivec)
446if test x"$have_asm_altivec" = x"yes" ; then
447  AC_DEFINE([HAVE_ASM_ALTIVEC], 1,
448    [Define if your compiler understands AltiVec inline assembly])
449fi
450
451AC_MSG_CHECKING([if \$CC groks AltiVec C extensions])
452have_c_altivec=no
453if test x"$use_altivec" = x"yes" ; then
454  # Darwin test
455  save_CFLAGS="$CFLAGS"
456  CFLAGS="$CFLAGS -faltivec"
457  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [vec_mtvscr((vector unsigned int)(0));])],
458    [have_c_altivec=yes
459      ALTIVEC_CFLAGS="-faltivec"],
460    [# Linux/PPC test
461      CFLAGS="${save_CFLAGS} -fvec"
462      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [vec_mtvscr((vector unsigned int)(0));])],
463        [have_c_altivec=yes
464          ALTIVEC_CFLAGS="-fvec"])
465    ])
466  CFLAGS="$save_CFLAGS"
467fi
468AC_MSG_RESULT($have_c_altivec)
469AM_CONDITIONAL(CAN_COMPILE_C_ALTIVEC, test x"$have_c_altivec" = x"yes")
470if test x"$have_c_altivec" = x"yes" ; then
471  AC_DEFINE([CAN_COMPILE_C_ALTIVEC], 1,
472    [Define if your compiler groks C AltiVec extensions.])
473  AC_SUBST(ALTIVEC_CFLAGS)
474fi
475
476AC_MSG_CHECKING([if linker needs -framework vecLib])
477if test x"$use_altivec" = x"yes" ; then
478  save_LDFLAGS="$LDFLAGS"
479  LDFLAGS="$LDFLAGS -framework vecLib"
480  ld_altivec=no
481  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [ld_altivec=yes])
482  LDFLAGS="$save_LDFLAGS"
483fi
484AC_MSG_RESULT($ld_altivec)
485if test x"$ld_altivec" = x"yes" ; then
486  LDFLAGS="$LDFLAGS -framework vecLib"
487fi
488
489
490dnl ---------------------------------------------------------------------
491dnl
492dnl pkgconfig
493dnl
494PKG_PROG_PKG_CONFIG([0.20])
495if test -z "$PKG_CONFIG" ; then
496  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
497fi
498
499
500dnl ---------------------------------------------------------------------
501dnl X11 checks
502
503AC_PATH_XTRA
504if test x"${no_x}" = x"yes" ; then
505  AC_MSG_WARN(can not find X11)
506  USE_X11=no
507else
508  AC_DEFINE([HAVE_X11], 1, [Have X11 support])
509  USE_X11=yes
510fi
511
512AC_SUBST(X_CFLAGS)
513AC_SUBST(X_PRE_LIBS)
514AC_SUBST(X_EXTRA_LIBS)
515AC_SUBST(X_LIBS)
516AC_SUBST(x_includes)
517AC_SUBST(x_libraries)
518
519dnl fi
520
521AM_CONDITIONAL(HAVE_X11, test x"${USE_X11}" = x"yes")
522
523if test x"${USE_X11}" = x"yes" ; then
524  AC_CHECK_LIB(Xv, XvQueryExtension,
525    [have_xv=yes
526      AC_DEFINE([HAVE_LIBXV], 1,
527        [Have libxv support])],
528    [have_xv=no],
529    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
530
531  AC_CHECK_LIB(X11, XShmQueryExtension,
532    [have_xshm=yes
533      AC_DEFINE([HAVE_X11_SHM], 1,
534        [Have Xshm support])],
535    [have_xshm=no],
536    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
537
538  AC_CHECK_HEADERS([X11/Xaw/Simple.h],
539    [have_xaw_simple=yes
540      AC_DEFINE([HAVE_XAW_SIMPLE], 1,
541        [Have the Xaw Simple.h file support])],
542    [have_xaw_simple=no])
543
544  AC_CHECK_LIB(Xpm, XpmFreeAttributes,
545    [have_xpm=yes
546      AC_DEFINE([HAVE_LIBXPM], 1,
547        [Have libXpm support])],
548    [have_xpm=no],
549    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
550else
551  have_xv="no"
552  have_xshm="no"
553  have_xaw_simple="no"
554  have_xpm="no"
555fi
556
557AM_CONDITIONAL(HAVE_LIBXV, test x"$have_xv" = x"yes")
558AM_CONDITIONAL(HAVE_X11_SHM, test x"$have_xshm" = x"yes")
559AM_CONDITIONAL(HAVE_XAW_SIMPLE, test x"$have_xaw_simple" = x"yes" )
560AM_CONDITIONAL(HAVE_LIBXPM, test x"$have_xpm" = x"yes")
561
562dnl end X11 checks
563dnl ---------------------------------------------------------------------
564
565AC_CHECK_LIB(z, gzopen,
566  [],
567  [AC_MSG_ERROR([transcode depends on libz, but cannot links against libz])],
568  [])
569
570AC_CHECK_LIB(m, sin,
571  [],
572  [AC_MSG_ERROR([transcode depends on libm (>= 2.0), but cannot link against libm])],
573  [-lc])
574
575TC_PKG_INIT
576
577have_libavcodec=no
578have_libavformat=no
579AC_MSG_CHECKING([for ffmpeg support])
580AC_ARG_ENABLE(ffmpeg,
581  AC_HELP_STRING([--enable-ffmpeg],
582    [enable support for FFmpeg libraries - RECOMMENDED (yes)]),
583  [case "${enableval}" in
584    yes) ;;
585    no)  ;;
586    *) AC_MSG_ERROR(bad value ${enableval} for --enable-ffmpeg) ;;
587  esac],
588  [enable_ffmpeg=yes])
589if test x"$enable_ffmpeg" = x"no" ; then
590  AC_MSG_RESULT(disabled)
591else
592  AC_MSG_RESULT(requested, checking for libraries)
593
594  dnl
595  dnl libavcodec
596  dnl
597  TC_PKG_CONFIG_CHECK(libavcodec, "$enable_ffmpeg", LIBAVCODEC, libavcodec, [http://www.ffmpeg.org/])
598
599  dnl
600  dnl libavformat
601  dnl
602  TC_PKG_CONFIG_CHECK(libavformat, "$enable_ffmpeg", LIBAVFORMAT, libavformat, [http://www.ffmpeg.org/])
603
604  AC_DEFINE([HAVE_FFMPEG], 1, [Have FFmpeg libraries support])
605fi
606
607TC_PKG_HAVE(libavcodec, LIBAVCODEC)
608TC_PKG_HAVE(libavformat, LIBAVFORMAT)
609
610AM_CONDITIONAL(HAVE_FFMPEG, test x"$enable_ffmpeg" = x"yes")
611
612
613
614dnl
615dnl setup layout define once
616dnl
617
618dnl
619dnl libv4l toolkit
620dnl
621TC_PKG_CONFIG_CHECK(libv4l2, no, LIBV4L2, libv4l2,
622                    [http://hansdegoede.livejournal.com/3636.html])
623TC_PKG_CONFIG_CHECK(libv4lconvert, no, LIBV4LCONVERT,
624                    libv4lconvert,
625                    [http://hansdegoede.livejournal.com/3636.html])
626TC_PKG_HAVE(libv4l2, LIBV4L2)
627TC_PKG_HAVE(libv4lconvert, LIBV4LCONVERT)
628
629dnl
630dnl libmpeg2
631dnl
632TC_PKG_CONFIG_CHECK(libmpeg2, no, LIBMPEG2, libmpeg2,
633                    [http://libmpeg2.sf.net/])
634TC_PKG_CONFIG_CHECK(libmpeg2convert, no, LIBMPEG2CONVERT,
635                    libmpeg2convert, [http://libmpeg2.sf.net/])
636TC_PKG_HAVE(libmpeg2, LIBMPEG2)
637TC_PKG_HAVE(libmpeg2convert, LIBMPEG2CONVERT)
638
639dnl
640dnl build options
641dnl
642
643dnl
644dnl support for new/experimental features (1.1.0: NMS)
645dnl
646AC_MSG_CHECKING([enable new or experimental components])
647AC_ARG_ENABLE(experimental,
648  AC_HELP_STRING([--enable-experimental],
649    [enable new, experimental or even incomplete transcode components (no)]),
650  [case "${enableval}" in
651    yes) ;;
652    no)  ;;
653    *) AC_MSG_ERROR(bad value ${enableval} for --enable-experimental) ;;
654  esac],
655  [enable_experimental=no])
656AC_MSG_RESULT($enable_experimental)
657if test x"$enable_experimental" = x"yes" ; then
658  AC_DEFINE([ENABLE_EXPERIMENTAL], 1, [Enable experimental components])
659fi
660AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test x"$enable_experimental" = x"yes")
661
662dnl
663dnl support for deprecated features (1.1.0: tcrequant)
664dnl
665AC_MSG_CHECKING([enable deprecated components])
666AC_ARG_ENABLE(deprecated,
667  AC_HELP_STRING([--enable-deprecated],
668    [enable deprecated or even broken transcode components (no)]),
669  [case "${enableval}" in
670    yes) ;;
671    no)  ;;
672    *) AC_MSG_ERROR(bad value ${enableval} for --enable-deprecated) ;;
673  esac],
674  [enable_deprecated=no])
675AC_MSG_RESULT($enable_deprecated)
676if test x"$enable_deprecated" = x"yes" ; then
677  AC_DEFINE([ENABLE_DEPRECATED], 1, [Enable deprecated components])
678fi
679AM_CONDITIONAL(ENABLE_DEPRECATED, test x"$enable_deprecated" = x"yes")
680
681dnl
682dnl static import frame buffer
683dnl
684AC_MSG_CHECKING([for internal static framebuffer support])
685AC_ARG_ENABLE(statbuffer,
686  AC_HELP_STRING([--enable-statbuffer],
687    [enable internal static framebuffer support; recommended (yes)]),
688  [case "${enableval}" in
689    yes) ;;
690    no)  ;;
691    *) AC_MSG_ERROR(bad value ${enableval} for --enable-statbuffer) ;;
692  esac],
693  [enable_statbuffer=yes])
694AC_MSG_RESULT($enable_statbuffer)
695if test x"$enable_statbuffer" = x"yes" ; then
696  AC_DEFINE([STATBUFFER], 1, [Use the static buffers])
697fi
698
699
700dnl
701dnl hardware/OS dependent modules
702dnl
703
704dnl
705dnl v4l
706dnl
707TC_CHECK_V4L(AC_DEFINE([HAVE_V4L], 1, [Have video4linux(2)]))
708AM_CONDITIONAL(HAVE_V4L, test x"$have_v4l" = x"yes")
709AM_CONDITIONAL(HAVE_V4L2, test x"$have_v4l2" = x"yes")
710
711dnl
712dnl bktr
713dnl
714TC_CHECK_BKTR(AC_DEFINE([HAVE_BKTR], 1, [Have bktr(4)]))
715AM_CONDITIONAL(HAVE_BKTR, test x"$have_bktr" = x"yes")
716
717dnl
718dnl sunau
719dnl
720TC_CHECK_SUNAU(AC_DEFINE([HAVE_SUNAU], 1, [Have Sun style audio(4)]))
721AM_CONDITIONAL(HAVE_SUNAU, test x"$have_sunau" = x"yes")
722
723dnl
724dnl OSS
725dnl
726TC_CHECK_OSS(AC_DEFINE([HAVE_OSS], 1, [Have OSS audio]))
727AM_CONDITIONAL(HAVE_OSS, test x"$have_oss" = x"yes")
728
729dnl
730dnl ALSA
731dnl
732TC_CHECK_ALSA(AC_DEFINE([HAVE_ALSA], 1, [Have ALSA audio]))
733AM_CONDITIONAL(HAVE_ALSA, test x"$have_alsa" = x"yes")
734
735dnl
736dnl optional 3rd party package support
737dnl
738
739dnl
740dnl Divx4linux
741dnl
742AC_CHECK_HEADERS([encore2.h])
743
744dnl
745dnl libpostproc
746dnl
747TC_PKG_CONFIG_CHECK(libpostproc, no, LIBPOSTPROC, libpostproc, [http://ffmpeg.mplayerhq.hu/])
748TC_PKG_HAVE(libpostproc, LIBPOSTPROC)
749
750dnl
751dnl freetype2
752dnl
753TC_PKG_CONFIG_CHECK(freetype2, no, FREETYPE2, freetype2, [http://www.freetype.org/])
754TC_PKG_HAVE(freetype2, FREETYPE2)
755
756dnl
757dnl lame
758dnl
759TC_PKG_CHECK(lame, yes, LAME, no, none, mp3lame, lame_init, lame,
760 [http://www.mp3dev.org/])
761if test x"$have_lame" = x"yes" ; then
762  lame_inc="no"
763  save_CPPFLAGS="$CPPFLAGS"
764  CPPFLAGS="$CPPFLAGS $lame_ii"
765  AC_CHECK_HEADER([lame/lame.h],
766    [AC_DEFINE([HAVE_LAME_INC], [1],
767      [Have Lame includes in separate path]) lame_inc=yes])
768  if test x"$lame_inc" = x"no" ; then
769    AC_CHECK_HEADER([lame.h], lame_inc="yes")
770  fi
771  if test x"$lame_inc" = x"no" ; then
772    have_lame="no"
773    TC_PKG_ERROR(lame, lame.h, yes, lame, [http://www.mp3dev.org/],
774      [cannot compile lame.h])
775  else
776    LAME_CFLAGS="$lame_ii"
777  fi
778  CPPFLAGS="$save_CPPFLAGS"
779
780  AC_MSG_CHECKING([lame version])
781  ac_save_CFLAGS="$CFLAGS"
782  ac_save_LIBS="$LIBS"
783  CFLAGS="$CFLAGS $LAME_CFLAGS"
784  LIBS="$LIBS $LAME_LIBS"
785  AC_RUN_IFELSE([AC_LANG_SOURCE([[
786#include <stdio.h>
787
788#ifdef HAVE_LAME_INC
789#include <lame/lame.h>
790#else
791#include <lame.h>
792#endif
793
794int main () {
795  lame_version_t lv;
796  get_lame_version_numerical(&lv);
797  if(lv.alpha || lv.beta) lv.minor--;
798  printf("%d%d\n", lv.major, lv.minor);
799  return 0;
800}
801]])],
802    [lame_version="`./conftest$ac_exeext`"],
803    [AC_MSG_RESULT([failed])
804     TC_PKG_ERROR(lame, lame.h, yes, lame, [http://www.mp3dev.org/],
805      [cannot compile and run a test program])],,
806    [AC_MSG_RESULT([cross compiling; assumed OK...])])
807  CFLAGS="$ac_save_CFLAGS"
808  LIBS="$ac_save_LIBS"
809
810  if test 393 -ge "$lame_version" ; then
811    have_lame="no"
812    TC_PKG_ERROR(lame, lame.h, yes, lame, [http://www.mp3dev.org/],
813      [lame version < 3.93])
814  fi
815fi
816TC_PKG_HAVE(lame, LAME)
817
818dnl
819dnl xvid
820dnl
821TC_PKG_CHECK(xvid, no, xvid, no, xvid.h, xvidcore, xvid_global, xvid,
822 [http://www.xvid.org/])
823if test x"$have_xvid" = x"yes" ; then
824  AC_MSG_CHECKING([xvid version >= 1.0])
825  AC_RUN_IFELSE([AC_LANG_SOURCE([[
826#include <stdio.h>
827#include <xvid.h>
828
829int main() {
830	printf("%s\n", (XVID_API >= XVID_MAKE_API(4, 0)) ?"yes" :"no");
831	return 0;
832}
833]])],
834    [xvid_version_ok="`./conftest$ac_exeext`"],
835    [AC_MSG_RESULT([failed])
836     TC_PKG_ERROR(xvid, xvid.h, yes, xvid, [http://www.xvid.org/],
837      [cannot compile and run a test program])],,
838    [AC_MSG_RESULT([cross compiling; assumed OK...])])
839  if test x"$xvid_version_ok" = x"yes"; then
840    XVID_LIBS="-lxvidcore"
841  else
842    have_xvid="no"
843    TC_PKG_ERROR(xvid, xvid.h, yes, xvid, [http://www.xvid.org/],
844      [XviD version < 1.0])
845  fi
846fi
847TC_PKG_HAVE(xvid, XVID)
848
849dnl
850dnl x264
851dnl
852TC_PKG_CONFIG_CHECK(x264, no, X264, x264, [http://developers.videolan.org/x264.html])
853if test x"$have_x264" = x"yes" ; then
854  AC_MSG_CHECKING([x264 version])
855  AC_RUN_IFELSE([AC_LANG_SOURCE([[
856#include <stdio.h>
857#include <stdint.h>  /* required by x264.h */
858#include <x264.h>
859
860int main() {
861	printf("%d\n", X264_BUILD);
862	return 0;
863}
864]])],
865    [x264_version="`./conftest$ac_exeext`"],
866    [AC_MSG_RESULT([failed])
867     TC_PKG_ERROR(x264, x264.h, yes, x264,
868                  [http://developers.videolan.org/x264.html],
869                  [cannot compile and run a test program])],
870    [AC_MSG_RESULT([cross compiling; assumed OK...])
871     x264_version=54])
872  if test 54 -gt "$x264_version"; then
873    have_x264="no"
874    TC_PKG_ERROR(x264, x264.h, yes, x264,
875                 [http://developers.videolan.org/x264.html],
876                 [x264 version too old (must be at least 54)])
877  fi
878fi
879TC_PKG_HAVE(x264, X264)
880
881dnl
882dnl ogg
883dnl
884TC_PKG_CONFIG_CHECK(ogg, no, OGG, ogg, [http://www.xiph.org/ogg/])
885TC_PKG_HAVE(ogg, OGG)
886
887dnl
888dnl vorbis
889dnl
890TC_PKG_CONFIG_CHECK(vorbis, no, VORBIS, vorbis, [http://www.xiph.org/ogg/vorbis/])
891TC_PKG_HAVE(vorbis, VORBIS)
892
893dnl
894dnl theora
895dnl
896TC_PKG_CONFIG_CHECK(theora, no, THEORA, theora, [http://www.theora.org/])
897TC_PKG_HAVE(theora, THEORA)
898
899dnl
900dnl libdvdread
901dnl
902LIBDVDREAD_EXTRA_LIBS="$LIBDVDREAD_EXTRA_LIBS -lm"
903TC_PKG_CHECK(libdvdread, yes, LIBDVDREAD, no, none, dvdread, DVDOpen,
904 libdvdread, [http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
905if test x"$have_libdvdread" = x"yes" ; then
906  libdvdread_inc="no"
907  save_CPPFLAGS="$CPPFLAGS"
908  CPPFLAGS="$CPPFLAGS $libdvdread_ii"
909  AC_CHECK_HEADER([dvdread/dvd_reader.h],
910    [AC_DEFINE([HAVE_LIBDVDREAD_INC], [1],
911      [have libdvdread includes in separate path])
912    libdvdread_inc="yes"])
913  if test x"$libdvdread_inc" = x"no" ; then
914    AC_CHECK_HEADER([dvd_reader.h],
915      [libdvdread_inc="yes"])
916  fi
917  CPPFLAGS="$save_CPPFLAGS"
918  if test x"$libdvdread_inc" = x"no" ; then
919    have_libdvdread="no"
920    TC_PKG_ERROR(libdvdread, dvd_reader.h, yes, libdvdread,
921      [http://www.dtek.chalmers.se/groups/dvd/downloads.shtml],
922      [cannot compile dvd_reader.h])
923  else
924    LIBDVDREAD_CFLAGS="$libdvdread_ii"
925  fi
926fi
927TC_PKG_HAVE(libdvdread, LIBDVDREAD)
928
929dnl
930dnl PVM3
931dnl
932PVM3_EXTRA_LIBS="$PVM3_EXTRA_LIBS -lgpvm3"
933TC_PKG_CHECK(pvm3, no, PVM3, no, pvm3.h, pvm3, pvm_initsend,
934  pvm3, [])
935if test x"$have_pvm3" = x"yes" ; then
936  save_CPPFLAGS="$CPPFLAGS"
937  CPPFLAGS="$CPPFLAGS $PVM3_CFLAGS"
938  AC_RUN_IFELSE([AC_LANG_SOURCE([[
939#include <stdio.h>
940#include <pvm3.h>
941int main ()
942{
943  if ((PVM_MAJOR_VERSION == 3) && (PVM_MINOR_VERSION < 4))
944  {
945	printf("You need to upgrade pvm3 to version > 3.4\n");
946	return(1);
947  }
948  if (PVM_MAJOR_VERSION < 3)
949  {
950	printf("You need to upgrade pvm3 to version > 3.4\n");
951	return(1);
952  }
953  return 0;
954}
955]])],
956  [have_pvm3="yes"],
957  [have_pvm3="no"],
958  [AC_MSG_RESULT([cross compiling; assumed OK...])
959   have_pvm3="yes"])
960  CPPFLAGS="$save_CPPFLAGS"
961  # also include the in-tree pvm3 headers
962  PVM3_CFLAGS="$PVM3_CFLAGS -I\$(top_srcdir)/pvm3"
963  PVM3_PVMGS="$w_pvm3_l/pvmgs"
964fi
965AC_SUBST(PVM3_PVMGS)
966TC_PKG_HAVE(pvm3, PVM3)
967
968dnl
969dnl libdv
970dnl
971TC_PKG_CONFIG_CHECK(libdv, no, LIBDV, libdv, [http://libdv.sourceforge.net/])
972TC_PKG_HAVE(libdv, LIBDV)
973
974dnl
975dnl libquicktime
976dnl
977TC_PKG_CONFIG_CHECK(libquicktime, no, LIBQUICKTIME, libquicktime,
978 [http://libquicktime.sourceforge.net/])
979if test x"$have_libquicktime" = x"yes" ; then
980  AC_CHECK_LIB(quicktime, lqt_encode_video,
981    [AC_DEFINE([LIBQUICKTIME_000904], [1], [Have libquicktime 1.0.0 or newer])],
982    [],
983    [$LIBQUICKTIME_LIBS $LIBQUICKTIME_EXTRA_LIBS])
984fi
985TC_PKG_HAVE(libquicktime, LIBQUICKTIME)
986
987dnl
988dnl LZO
989dnl
990TC_PKG_CHECK(lzo, no, LZO, no, [lzo/lzo1x.h], lzo2, lzo_version, lzo,
991 [http://www.oberhumer.com/opensource/lzo/])
992TC_PKG_HAVE(lzo, LZO)
993
994dnl
995dnl A52
996dnl
997A52_EXTRA_LIBS="$A52_EXTRA_LIBS -lm"
998TC_PKG_CHECK(a52, no, A52, no, [a52dec/a52.h], a52, a52_init, liba52,
999 [http://liba52.sourceforge.net/])
1000TC_PKG_HAVE(a52, A52)
1001if test x"$have_a52" = x"yes" ; then
1002  enable_a52_default_decoder="yes"
1003else
1004  enable_a52_default_decoder="no"
1005fi
1006
1007dnl
1008dnl FAAC
1009dnl
1010TC_PKG_CHECK(faac, no, FAAC, no, [faac.h], faac, faacEncGetVersion, no,
1011  [http://www.audiocoding.com/])
1012TC_PKG_HAVE(faac, FAAC)
1013
1014dnl
1015dnl libxml2
1016dnl
1017TC_PKG_CONFIG_CHECK(libxml2, no, LIBXML2, libxml-2.0, [http://xmlsoft.org])
1018TC_PKG_HAVE(libxml2, LIBXML2)
1019
1020dnl
1021dnl ibp, lors and libxio -- must be after libxml2
1022dnl
1023TC_PATH_IBP(AC_DEFINE([HAVE_IBP], 1, [ibp and lors support]))
1024AM_CONDITIONAL(HAVE_IBP, test x"$have_ibp" = x"yes")
1025
1026XIO_CFLAGS="-I\$(top_srcdir)/libtc"
1027if test x"$have_ibp" = x"yes" ; then
1028  XIO_LIBS="\$(top_builddir)/libtc/libtc.la $IBP_LIBS $LIBXML2_LIBS"
1029else
1030  XIO_LIBS=""
1031fi
1032AC_SUBST(XIO_CFLAGS)
1033AC_SUBST(XIO_LIBS)
1034
1035dnl
1036dnl mjpegtools (actually only YUV4MPEG)
1037dnl
1038TC_PKG_CONFIG_CHECK(mjpegtools, no, MJPEGTOOLS, mjpegtools,
1039 [http://mjpeg.sourceforge.net/])
1040if test x"$have_mjpegtools" = x"yes" ; then
1041  # check if mjpegtools version >= Mar 31 2004
1042  save_CFLAGS="$CFLAGS"
1043  save_LIBS="$LIBS"
1044  CFLAGS="$CFLAGS $MJPEGTOOLS_CFLAGS"
1045  LIBS="$LIBS $MJPEGTOOLS_LIBS"
1046  AC_LINK_IFELSE([AC_LANG_PROGRAM([
1047#if defined(HAVE_MJPEGTOOLS_INC)
1048#include "yuv4mpeg.h"
1049#include "mpegconsts.h"
1050#else
1051#include "mjpegtools/yuv4mpeg.h"
1052#include "mjpegtools/mpegconsts.h"
1053#endif
1054],
1055    [y4m_write_frame_header(1, NULL, NULL)])],
1056    [AC_DEFINE([USE_NEW_MJPEGTOOLS_CODE], [1],
1057      [using mjpegtools post Mar 31 2004])])
1058  CFLAGS="$save_CFLAGS"
1059  LIBS="$save_LIBS"
1060fi
1061TC_PKG_HAVE(mjpegtools, MJPEGTOOLS)
1062
1063dnl
1064dnl SDL
1065dnl
1066TC_PKG_CONFIG_CHECK(sdl, no, SDL, sdl, [http://www.libsdl.org/])
1067if test x"$have_sdl" = x"yes" ; then
1068  sdl_major_version=1
1069  sdl_minor_version=2
1070  sdl_micro_version=5
1071  save_CPPFLAGS="$CPPFLAGS"
1072  CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
1073  AC_RUN_IFELSE([AC_LANG_SOURCE([[
1074#include <stdio.h>
1075#include <stdlib.h>
1076#include <string.h>
1077#include "SDL.h"
1078int main (int argc, char *argv[])
1079{
1080   if ( (SDL_MAJOR_VERSION > $sdl_major_version) ||
1081        ((SDL_MAJOR_VERSION == $sdl_major_version) &&
1082		(SDL_MINOR_VERSION > $sdl_minor_version)) ||
1083        ((SDL_MAJOR_VERSION == $sdl_major_version) &&
1084		(SDL_MINOR_VERSION == $sdl_minor_version) &&
1085		(SDL_PATCHLEVEL >= $sdl_micro_version)) )
1086    {
1087      return 0;
1088    }
1089  else
1090    {
1091      fprintf(stderr, "SDL version %d.%d.%d is too old!\n",
1092			SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
1093      return 1;
1094    }
1095}
1096]])],
1097  [have_sdl="yes"],
1098  [have_sdl="no"],
1099  [AC_MSG_RESULT([cross compiling; assumed OK...])
1100   have_sdl="yes"])
1101  CPPFLAGS="$save_CPPFLAGS"
1102fi
1103TC_PKG_HAVE(sdl, SDL)
1104
1105dnl
1106dnl ImageMagick
1107dnl
1108IMAGEMAGICK_EXTRA_LIBS="$IMAGEMAGICK_EXTRA_LIBS $($PKG_CONFIG --libs ImageMagick)"
1109TC_PKG_CHECK(imagemagick, no, IMAGEMAGICK, no, [magick/api.h],
1110 none, InitializeMagick, Wand, [http://www.imagemagick.org/])
1111TC_PKG_HAVE(imagemagick, IMAGEMAGICK)
1112if test x"$have_imagemagick" = x"yes" ; then
1113  SAVE_CPPFLAGS="$CPPFLAGS"
1114  CPPFLAGS="$IMAGEMAGICK_CFLAGS $CPPFLAGS"
1115  AC_CHECK_HEADER([wand/magick-wand.h],
1116    [AC_DEFINE([HAVE_BROKEN_WAND], [1], ["have old wand header"])])
1117  CPPFLAGS="$SAVE_CPPFLAGS"
1118fi
1119
1120dnl
1121dnl libjpegmmx or libjpeg
1122dnl
1123TC_PKG_CHECK(libjpegmmx, no, LIBJPEGMMX, no, jpeglib.h, jpeg-mmx,
1124  jpeg_CreateCompress, jpeg-mmx, [http://sourceforge.net/projects/mjpeg/])
1125if test x"$have_libjpegmmx" = x"no" ; then
1126  TC_PKG_CHECK(libjpeg, yes, LIBJPEG, no, jpeglib.h, jpeg,
1127    jpeg_CreateCompress, jpeg, [ftp://ftp.uu.net/graphics/jpeg/])
1128else
1129  have_libjpeg="yes"
1130  LIBJPEG_CFLAGS="$LIBJPEGMMX_CFLAGS"
1131  LIBJPEG_LIBS="$LIBJPEGMMX_LIBS"
1132fi
1133TC_PKG_HAVE(libjpeg, LIBJPEG)
1134
1135
1136dnl
1137dnl bsdav
1138dnl
1139TC_PKG_CHECK(bsdav, no, BSDAV, no, bsdav.h, bsdav,
1140  bsdav_read_stream_header, bsdav, [http://www.jakemsr.com/bsdav/])
1141TC_PKG_HAVE(bsdav, BSDAV)
1142
1143
1144dnl
1145dnl iconv
1146dnl
1147TC_PKG_CHECK(iconv, yes, ICONV, no, iconv.h, none, none, libiconv,
1148 [http://www.gnu.org/software/libiconv/])
1149if test x"$have_iconv" = x"yes" ; then
1150  save_LDFLAGS="$LDFLAGS"
1151  LDFLAGS="$LDFLAGS $iconv_ll"
1152  AC_CHECK_LIB(iconv, iconv_open,
1153    [],
1154    [have_iconv="no"],
1155    [$ICONV_EXTRA_LIBS])
1156  LDFLAGS="$save_LDFLAGS"
1157  if test x"$have_iconv" = x"no" ; then
1158    save_LDFLAGS="$LDFLAGS"
1159    LDFLAGS="$LDFLAGS $iconv_ll"
1160    AC_CHECK_LIB(iconv, libiconv_open,
1161      [have_iconv="yes"],
1162      [have_iconv="no"],
1163      [$ICONV_EXTRA_LIBS])
1164    LDFLAGS="$save_LDFLAGS"
1165  fi
1166  # see if iconv_open is in (g)libc
1167  have_libc_iconv="no"
1168  if test x"$have_iconv" = x"no" ; then
1169    save_LDFLAGS="$LDFLAGS"
1170    LDFLAGS="$LDFLAGS $iconv_ll"
1171    AC_CHECK_LIB(c, iconv_open,
1172      [have_iconv="yes" have_libc_iconv="yes"],
1173      [have_iconv="no"],
1174      [$ICONV_EXTRA_LIBS])
1175    LDFLAGS="$save_LDFLAGS"
1176  fi
1177  if test x"$have_iconv" = x"yes" ; then
1178    if test x"$have_libc_iconv" != x"yes" ; then
1179      ICONV_LIBS="$iconv_ll -liconv $ICONV_EXTRA_LIBS"
1180    fi
1181  else
1182    TC_PKG_ERROR(iconv, [iconv_open()], yes, libiconv,
1183      [http://www.gnu.org/software/libiconv/],
1184      [cannot find either iconv_open() or libiconv_open()])
1185  fi
1186fi
1187TC_PKG_HAVE(iconv, ICONV)
1188
1189
1190dnl
1191dnl Other modules
1192dnl
1193
1194dnl
1195dnl import_pv3
1196dnl
1197AC_MSG_CHECKING([for PV3 support])
1198AC_ARG_ENABLE(pv3,
1199  AC_HELP_STRING([--enable-pv3],
1200    [enable PV3 support (no)]),
1201  [case "${enableval}" in
1202    yes) if test true != "$have_x86cpu" -o yes != "$is_linux" -o yes != "$ac_cv_func_mmap"; then
1203           AC_MSG_ERROR(PV3 not supported on this platform)
1204         fi
1205         ;;
1206    no)  ;;
1207    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pv3) ;;
1208  esac],
1209  [enable_pv3=no])
1210AC_MSG_RESULT($enable_pv3)
1211AM_CONDITIONAL(ENABLE_PV3, test "yes" = "$enable_pv3")
1212
1213dnl
1214dnl import_nuv
1215dnl
1216AC_MSG_CHECKING([for NuppelVideo support])
1217AC_ARG_ENABLE(nuv,
1218  AC_HELP_STRING([--enable-nuv],
1219    [enable NuppelVideo support (no)]),
1220  [case "${enableval}" in
1221    yes) if test yes != "$have_lzo"; then
1222           AC_MSG_ERROR([liblzo2 is required for NuppelVideo support, try --enable-lzo])
1223         fi
1224    	 if test true == "$have_x86_64cpu"; then
1225           AC_MSG_WARN([NuppelVideo support on x86_64 platform is ***EXPERIMENTAL***])
1226         elif test true != "$have_x86cpu"; then
1227           AC_MSG_ERROR([NuppelVideo is supported only on x86 and x86_64 platforms yet])
1228         fi
1229         ;;
1230    no)  ;;
1231    *) AC_MSG_ERROR(bad value ${enableval} for --enable-nuv) ;;
1232  esac],
1233  [enable_nuv=no])
1234AC_MSG_RESULT($enable_nuv)
1235AM_CONDITIONAL(ENABLE_NUV, test "yes" = "$enable_nuv")
1236
1237
1238dnl
1239dnl The following come with transcode
1240dnl
1241
1242dnl
1243dnl libtc
1244dnl
1245LIBTC_LIBS="\$(top_builddir)/libtc/libtc.la"
1246AC_SUBST(LIBTC_LIBS)
1247
1248dnl
1249dnl libtcaudio
1250dnl
1251LIBTCAUDIO_LIBS="\$(top_builddir)/libtcaudio/libtcaudio.la"
1252AC_SUBST(LIBTCAUDIO_LIBS)
1253
1254dnl
1255dnl libtcvideo
1256dnl
1257LIBTCVIDEO_LIBS="\$(top_builddir)/libtcvideo/libtcvideo.la"
1258AC_SUBST(LIBTCVIDEO_LIBS)
1259
1260dnl
1261dnl avilib
1262dnl
1263AVILIB_LIBS="\$(top_builddir)/avilib/libavi.la"
1264AC_SUBST(AVILIB_LIBS)
1265
1266dnl
1267dnl wavlib
1268dnl
1269WAVLIB_LIBS="\$(top_builddir)/avilib/libwav.la"
1270AC_SUBST(WAVLIB_LIBS)
1271
1272
1273dnl
1274dnl aclib
1275dnl
1276AC_ARG_ENABLE([x86-textrels],
1277    AC_HELP_STRING([--enable-x86-textrels], [enable x86-32 optimizations which use text relocations (yes)]),
1278    [if test "no" = "$enableval"; then
1279         AC_DEFINE([ACLIB_DISABLE_X86_TEXTRELS], [1], [Disable x86-32 optimizations in aclib that require text relocations])
1280     fi])
1281ACLIB_LIBS="\$(top_builddir)/aclib/libac.la"
1282AC_SUBST(ACLIB_LIBS)
1283
1284
1285
1286dnl
1287dnl warning flags; always add -Wall -Wstrict-prototypes -Wmissing-prototypes
1288dnl note that autoconf uses an unprototyped main(), so we disable prototype
1289dnl warnings when checking whether -Werror works
1290dnl
1291AC_ARG_ENABLE([warnings-as-errors],
1292    AC_HELP_STRING([--enable-warnings-as-errors], [treat warnings as errors]))
1293dnl GCC 4.2.x spits out bogus warnings when un-consting arguments in a
1294dnl function call (GCC bug 29478), so don't use -Werror there
1295if test x"$GCC" = x"yes" && test -n "`$CC -v 2>&1 | tail -1 | grep '4\.2\.'`"; then
1296    AC_MSG_WARN([GCC 4.2.x produces spurious warnings, -Werror disabled])
1297elif test x"$GCC" = x"yes" ; then
1298    OPT_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
1299    TMP_CFLAGS=""
1300    TC_TRY_CFLAGS([$OPT_CFLAGS $CFLAGS],[TMP_CFLAGS="$OPT_CFLAGS "])
1301    dnl Don't assign this yet, as -Wall would counteract the -Wno-XXX options
1302    if test x"$enable_warnings_as_errors" = x"yes" ; then
1303        dnl compiler warnings treated as errors
1304        dnl we don't care about pointer sign warnings, and empty format
1305        dnl strings are occasionally useful, so disable those warnings
1306        OPT_CFLAGS="-Werror -Wno-pointer-sign -Wno-format-zero-length $CFLAGS"
1307        TC_TRY_CFLAGS([$OPT_CFLAGS -Wno-strict-prototypes -Wno-missing-prototypes],[CFLAGS=$OPT_CFLAGS])
1308    fi
1309    CFLAGS="$TMP_CFLAGS$CFLAGS"
1310fi
1311AC_SUBST(CFLAGS)
1312
1313dnl import/export module path
1314dnl
1315MOD_PATH="\${libdir}/transcode"
1316AC_ARG_WITH(mod-path,
1317  AC_HELP_STRING([--with-mod-path],
1318    [where export/import modules are installed (${libdir}/transcode)]),
1319  MOD_PATH=$withval)
1320AC_SUBST(MOD_PATH)
1321
1322dnl export profiles data path
1323dnl
1324PROF_PATH="\${datadir}/transcode/profiles"
1325AC_ARG_WITH(prof-path,
1326  AC_HELP_STRING([--with-prof-path],
1327    [where export profiles data are installed (${datadir}/transcode/profiles)]),
1328  PROF_PATH=$withval)
1329AC_SUBST(PROF_PATH)
1330
1331
1332X_CFLAGS=`echo $X_CFLAGS | sed -e 's/  */ /g'`
1333X_PRE_LIBS=`echo $X_PRE_LIBS | sed -e 's/  */ /g'`
1334X_LIBS=`echo $X_LIBS | sed -e 's/  */ /g'`
1335X_EXTRA_LIBS=`echo $X_EXTRA_LIBS | sed -e 's/  */ /g'`
1336
1337CC=`echo $CC | sed -e 's/  */ /g'`
1338CFLAGS=`echo $CFLAGS | sed -e 's/  */ /g'`
1339CPPFLAGS=`echo $CPPFLAGS | sed -e 's/  */ /g'`
1340CXXFLAGS=`echo $CXXFLAGS | sed -e 's/  */ /g'`
1341LDFLAGS=`echo $LDFLAGS | sed -e 's/  */ /g'`
1342
1343AC_SUBST(CFLAGS)
1344AC_SUBST(CC)
1345AC_SUBST(LDFLAGS)
1346AC_SUBST(SIMD_FLAGS)
1347
1348AC_CONFIG_FILES([
1349	Makefile
1350	aclib/Makefile
1351	avilib/Makefile
1352	docs/Makefile
1353	docs/html/Makefile
1354	docs/man/Makefile
1355	docs/pvm3/Makefile
1356	docs/tech/Makefile
1357	docs/tech/html/Makefile
1358	encode/Makefile
1359	export/Makefile
1360	filter/Makefile
1361	filter/divxkey/Makefile
1362	filter/extsub/Makefile
1363	filter/preview/Makefile
1364	filter/subtitler/Makefile
1365	filter/tomsmocomp/Makefile
1366	filter/yuvdenoise/Makefile
1367	filter/stabilize/Makefile
1368	import/Makefile
1369	import/framegen/Makefile
1370	import/nuv/Makefile
1371	import/v4l/Makefile
1372	multiplex/Makefile
1373	libdldarwin/Makefile
1374	libtc/Makefile
1375	libtcaudio/Makefile
1376	libtcvideo/Makefile
1377	pvm3/Makefile
1378	src/Makefile
1379	testsuite/Makefile
1380	tools/Makefile
1381	transcode.spec
1382	filter/parse_csv.awk
1383	filter/filter_list.awk
1384])
1385AC_OUTPUT
1386
1387
1388AC_MSG_RESULT([
1389----------------------------------------
1390Summary for transcode $VERSION:
1391----------------------------------------
1392
1393core options
1394----------------------------------------
1395enable experimental code       $enable_experimental
1396enable deprecated code         $enable_deprecated
1397static AV-frame buffering      $enable_statbuffer
1398A52 default decoder            $enable_a52_default_decoder
1399FFmpeg support                 $enable_ffmpeg
1400
1401hardware support
1402----------------------------------------
1403v4l (legacy)                   $have_v4l
1404v4l2                           $have_v4l2
1405ALSA                           $have_alsa
1406OSS                            $have_oss
1407bktr                           $have_bktr
1408sunau                          $have_sunau
1409
1410optional module support
1411----------------------------------------
1412PV3                            $enable_pv3
1413NuppelVideo                    $enable_nuv
1414
1415optional package support
1416----------------------------------------
1417IBP (libxio)                   $have_ibp
1418X11                            $USE_X11
1419    Xv      extension          $have_xv
1420    Xshm    extension          $have_xshm
1421    Xaw     library            $have_xaw_simple
1422    Xpm     library            $have_xpm
1423])
1424
1425TC_PKG_REPORT
1426
1427if test x"yes" = x"$have_pvm3"; then
1428    AC_MSG_WARN([PVM3 support is yet untested, unsupported and may be BROKEN!.])
1429    AC_MSG_WARN([Please be careful and be prepared for bugs or nasty behaviours.])
1430    AC_MSG_WARN([Report problems on transcode-devel mailing list.])
1431    # ugly -- has anyone a better idea?
1432    echo
1433    echo
1434fi
1435
1436