mkvtoolnix/configure.in

1237 lines
33 KiB
Plaintext

AC_INIT(src/merge/mkvmerge.cpp)
AC_PREREQ(2.50)
AC_CONFIG_HEADERS(config.h:config.h.in)
PACKAGE="mkvtoolnix"
VERSION="2.0.0"
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
SAVED_CFLAGS="$CFLAGS"
AC_PROG_CC
CFLAGS="$SAVED_CFLAGS"
AC_PROG_CC_C_O
AC_PROG_CPP
SAVED_CXXFLAGS="$CXXFLAGS"
AC_PROG_CXX
CXXFLAGS="$SAVED_CXXFLAGS"
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar, :)
AC_CHECK_TOOL(LD, ld, :)
dnl Check for headers
AC_HEADER_STDC()
AC_CHECK_HEADERS([inttypes.h stdint.h sys/types.h])
AC_CHECK_FUNCS(vsscanf,,)
dnl Optional features that are built and those that aren't
opt_features_yes=""
opt_features_no=""
function check_version {
check_ver_req="$1"
check_ver_real="$2"
set - `echo $check_ver_req 0 0 0 | sed 's/\./\ /g'`
check_ver_major=$1
check_ver_minor=$2
check_ver_micro=$3
set - `echo $check_ver_real 0 0 0 | sed 's/\./\ /g'`
check_ver_ok=0
if test "x$1" = "x" -o $1 -lt ${check_ver_major} ; then
check_ver_ok=0
elif test $1 -gt ${check_ver_major} ; then
check_ver_ok=1
elif test "x$2" = "x" -o $2 -lt ${check_ver_minor} ; then
check_ver_ok=0
elif test $2 -gt ${check_ver_minor} ; then
check_ver_ok=1
elif test "x$3" = "x" -o $3 -lt ${check_ver_micro} ; then
check_ver_ok=0
else
check_ver_ok=1
fi
test $check_ver_ok = 1
}
dnl Stolen from VideoLAN Client, http://www.videolan.org/
dnl
dnl Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
dnl
dnl We give the user the opportunity to specify
dnl --with-words=big or --with-words=little ; otherwise, try to guess
dnl
AC_ARG_WITH(words,
AC_HELP_STRING([--with-words=endianness],[set endianness (big or little)]))
case "${with_words}" in
big)
ac_cv_c_bigendian=yes
;;
little)
ac_cv_c_bigendian=no
;;
*)
dnl Try to guess endianness by matching patterns on a compiled
dnl binary, by looking for an ASCII or EBCDIC string
AC_CACHE_CHECK([whether the byte order is big-endian],
[ac_cv_c_bigendian],
[ac_cv_c_bigendian="unknown"
[cat >conftest.c <<EOF
short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
void _a(void) { char*s = (char*)am; s = (char *)ai; }
short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
void _e(void) { char*s = (char*)em; s = (char*)ei; }
int main(void) { _a(); _e(); return 0; }
EOF
]
if test -f conftest.c
then
if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
&& test -f conftest.o
then
if test "`strings conftest.o | grep BIGenDianSyS`"
then
ac_cv_c_bigendian="yes"
fi
if test "`strings conftest.o | grep LiTTleEnDian`"
then
ac_cv_c_bigendian="no"
fi
fi
fi
])
if test "${ac_cv_c_bigendian}" = "unknown"
then
AC_MSG_ERROR([Could not guess endianness, please use --with-words])
fi
;;
esac
dnl Now we know what to use for endianness, just put it in the header
if test "${ac_cv_c_bigendian}" = "yes"
then
AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
fi
dnl
dnl Extra include and library dirs that someone would like to specify.
dnl
AC_ARG_WITH(extra-includes,
AC_HELP_STRING([--with-extra-includes=DIR],[Path to other include directories separated by ';']),,
with_extra_include_given=no)
AC_ARG_WITH(extra-libs,
AC_HELP_STRING([--with-extra-libs=DIR],[Path to other library directories separated by ';']),,
with_extra_libs_given=no)
EXTRA_CFLAGS=
USER_CFLAGS="$CFLAGS"
USER_CPPFLAGS="$CPPFLAGS"
USER_CXXFLAGS="$CXXFLAGS"
USER_LDFLAGS="$LDFLAGS"
if test "$with_extra_includes" != ""; then
DIRS=`echo $with_extra_includes | cut -d '=' -f 2 | sed 's,;, -I,g'`
EXTRA_CFLAGS="-I$DIRS"
CFLAGS="$CFLAGS -I$DIRS"
CXXFLAGS="$CXXFLAGS -I$DIRS"
CPPFLAGS="$CPPFLAGS -I$DIRS"
fi
EXTRA_LDFLAGS=
if test "$with_extra_libs" != ""; then
DIRS=`echo $with_extra_libs | cut -d '=' -f 2 | sed 's,;, -L,g'`
EXTRA_LDFLAGS="-L$DIRS"
LDFLAGS="$LDFLAGS -L$DIRS"
fi
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(USER_CFLAGS)
AC_SUBST(USER_CPPFLAGS)
AC_SUBST(USER_CXXFLAGS)
AC_SUBST(USER_LDFLAGS)
dnl
dnl Debugging and profiling options
dnl
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug],[compile with debug information (no)]))
if test x"$enable_debug" = x"yes"; then
dnl debug information
DEBUG_CFLAGS="-g -DDEBUG"
OPTIMIZATION_CFLAGS=""
else
DEBUG_CFLAGS=""
OPTIMIZATION_CFLAGS="-O3"
fi
AC_ARG_ENABLE([profiling],
AC_HELP_STRING([--enable-profiling],[compile with profiling information (no)]))
if test x"$enable_profiling" = x"yes"; then
dnl profiling information
PROFILING_CFLAGS="-pg"
PROFILING_LIBS="-pg"
else
PROFILING_CFLAGS=""
PROFILING_LIBS=""
fi
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(PROFILING_CFLAGS)
AC_SUBST(PROFILING_LIBS)
AC_SUBST(OPTIMIZATION_CFLAGS)
dnl
dnl Check the gcc version for the genreation of dependecy information
dnl
AC_CACHE_CHECK([gcc version],
[ac_cv_gcc_version],[
ac_cv_gcc_version="`$CXX -dumpversion`"
])
case "$ac_cv_gcc_version" in
2.*)
GCC_DEP_STYLE=v2
;;
3.*)
GCC_DEP_STYLE=v3
;;
*)
GCC_DEP_STYLE=v3
;;
esac
AC_SUBST(GCC_DEP_STYLE)
dnl
dnl Check for mingw
dnl
AC_CACHE_CHECK([if being compiled with mingw32],
[ac_cv_mingw32],[
if test "x`$CXX --version | grep -i mingw`" = "x" ; then
ac_cv_mingw32=no
else
ac_cv_mingw32=yes
fi])
if test "x$ac_cv_mingw32" = "xyes"; then
export MINGW=1
MINGW_GUIAPP=-mwindows
LIBMTXCOMMONDLL=1
EXEEXT=.exe
else
LIBMTXCOMMONDLL=0
fi
AC_SUBST(MINGW)
AC_SUBST(MINGW_LIBS)
AC_SUBST(MINGW_GUIAPP)
AC_SUBST(LIBMTXCOMMONDLL)
AC_SUBST(EXEEXT)
dnl
dnl Test if the 64bit integer types are available, and if not if they
dnl can be typedef'ed manually.
dnl
AC_MSG_CHECKING(for int64_t)
AC_LANG_PUSH(C++)
AC_CACHE_VAL(ac_cv_has_int64_t,[
AC_TRY_COMPILE([
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
],
[int64_t foo;],
ac_cv_has_int64_t=yes,
ac_cv_has_int64_t=no)
])
AC_MSG_RESULT($ac_cv_has_int64_t)
AC_MSG_CHECKING(for uint64_t)
AC_CACHE_VAL(ac_cv_has_uint64_t,[
AC_TRY_COMPILE([
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
],
[int64_t foo;],
ac_cv_has_uint64_t=yes,
ac_cv_has_uint64_t=no)
])
AC_MSG_RESULT($ac_cv_has_uint64_t)
AC_LANG_POP
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
if test x$ac_cv_has_int64_t = "xyes" ; then
TYPE64="int64_t"
else
case 8 in
$ac_cv_sizeof_int) TYPE64="int";;
$ac_cv_sizeof_long) TYPE64="long";;
$ac_cv_sizeof_long_long) TYPE64="long long";;
esac
AC_DEFINE(HAVE_NO_INT64_T, 1, [int64_t does not exist])
AC_DEFINE_UNQUOTED(INT64_TYPE, $TYPE64,
[the type to define int64_t manually])
fi
if test x$ac_cv_has_uint64_t = "xyes" ; then
TYPEU64="int64_t"
else
case 8 in
$ac_cv_sizeof_int) TYPEU64="unsigned int";;
$ac_cv_sizeof_long) TYPEU64="unsigned long";;
$ac_cv_sizeof_long_long) TYPEU64="unsigned long long";;
esac
AC_DEFINE(HAVE_NO_UINT64_T, 1, [uint64_t does not exist])
AC_DEFINE_UNQUOTED(UINT64_TYPE, $TYPEU64,
[the type to define uint64_t manually])
fi
if test -z "$TYPE64"; then
AC_MSG_ERROR(No 64 bit type found on this platform!)
fi
if test -z "$TYPEU64"; then
AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
fi
dnl
dnl Verify that PRId64 and PRIu64 are available
dnl
AC_MSG_CHECKING(for PRId64 and PRIu64)
AC_CACHE_VAL(ac_cv_has_prix64,[
AC_TRY_COMPILE([
#define __STDC_FORMAT_MACROS
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
],
[char *dummy = "text " PRId64 " text " PRIu64;],
ac_cv_has_prix64=yes,
ac_cv_has_prix64=no)
])
AC_MSG_RESULT($ac_cv_has_prix64)
if test x$ac_cv_has_prix64 = "xno" ; then
echo "*** On your system the #define PRId64 and/or PRIu64 was not found."
echo "*** These are required for compilation. Please contact the author."
exit 1
fi
dnl
dnl Check for posix_fadvise and its definitions
dnl
AC_ARG_ENABLE(posix-fadvise,
AC_HELP_STRING([--disable-posix-fadvise],[do not use posix_fadvise (auto)]),,
[enable_posix_fadvise=yes])
if test x"$enable_posix_fadvise" != "xno" ; then
AC_CACHE_CHECK([for posix_fadvise], [ac_cv_posix_fadvise],[
ac_cv_posix_fadvise="no"
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([
#include <fcntl.h>
],[
posix_fadvise(0, 0, 0, POSIX_FADV_WILLNEED);
posix_fadvise(0, 0, 0, POSIX_FADV_DONTNEED);
],[ac_cv_posix_fadvise="yes"])
AC_LANG_POP
])
if test x"$ac_cv_posix_fadvise" = "xyes" ; then
AC_DEFINE([HAVE_POSIX_FADVISE], 1, [define if posix_advise and its definitions are available])
fi
fi
dnl
dnl Test for libiconv
dnl
dnl This macros shamelessly stolen from
dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
dnl Written by Bruno Haible.
dnl
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
dnl
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
am_cv_func_iconv=yes)
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS -liconv"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
am_cv_lib_iconv=yes
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL(am_cv_proto_iconv, [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$]{ac_t:-
}[$]am_cv_proto_iconv)
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
[Define as const if the declaration of iconv() needs const.])
else
echo '*** The iconv library is needed but could not be found.'
echo '*** Please install it and re-run configure. You can find iconv'
echo '*** at http://www.gnu.org/software/libiconv/'
exit 1
fi
ICONV_LIBS=
if test "$am_cv_lib_iconv" = yes; then
ICONV_LIBS="-liconv"
fi
AC_SUBST(ICONV_LIBS)
dnl
dnl Check for nl_langinfo or at least locale_charset
dnl
if test x"$MINGW" != "x1" ; then
AC_MSG_CHECKING(for nl_langinfo)
AC_CACHE_VAL(ac_cv_has_nl_langinfo,[
AC_TRY_COMPILE([
#include <langinfo.h>
],
[nl_langinfo(CODESET);],
ac_cv_has_nl_langinfo=yes,
ac_cv_has_nl_langinfo=no)
])
AC_MSG_RESULT($ac_cv_has_nl_langinfo)
if test x"$ac_cv_has_nl_langinfo" = "xyes" ; then
AC_DEFINE(HAVE_NL_LANGINFO, 1, [nl_langinfo is available])
else
AC_MSG_CHECKING(for locale_charset)
AC_CACHE_VAL(ac_cv_has_locale_charset,[
AC_TRY_COMPILE([
#include <libcharset.h>
],
[locale_charset();],
ac_cv_has_locale_charset=yes,
ac_cv_has_locale_charset=no)
])
AC_MSG_RESULT($ac_cv_has_locale_charset)
if test x"$ac_cv_has_locale_charset" = "xyes" ; then
AC_DEFINE(HAVE_LOCALE_CHARSET, 1, [locale_charset is available])
else
echo '*** Your system has neither nl_langinfo nor locale_charset.'
echo '*** Please install libcharset which is part of libiconv'
echo '*** available at http://www.gnu.org/software/libiconv/'
exit 1
fi
fi
fi
dnl
dnl Check for libogg
dnl
AC_CHECK_LIB(ogg, ogg_sync_init,
[ OGG_LIBS="-logg"
ogg_found=yes ],
[ ogg_found=no ],)
if test "$ogg_found" = "no"; then
AC_MSG_ERROR([Could not find the Ogg library])
fi
AC_CHECK_HEADERS(ogg/ogg.h, , ogg_found=no)
if test "$ogg_found" = "no"; then
AC_MSG_ERROR([Could not find the Ogg header files])
fi
AC_SUBST(OGG_LIBS)
dnl
dnl Check for libvorbis
dnl
AC_CHECK_LIB(vorbis, vorbis_synthesis_init,
[ VORBIS_LIBS="-lvorbis -lm"
vorbis_found=yes ],
[ vorbis_found=no ],
$OGG_LIBS -lm)
if test "$vorbis_found" = "no"; then
AC_MSG_ERROR([Could not find the Vorbis library])
fi
AC_CHECK_HEADERS(vorbis/codec.h, , vorbis_found=no)
if test "$vorbis_found" = "no"; then
AC_MSG_ERROR([Could not find the Vorbis header files])
fi
AC_SUBST(VORBIS_LIBS)
dnl
dnl Check for libFLAC
dnl
AC_ARG_WITH([flac],
AC_HELP_STRING([--without-flac], [do not build with flac support]),
[ with_flac=${withval} ], [ with_flac=yes ])
if test "$with_flac" != "no"; then
AC_CHECK_LIB(FLAC, FLAC__stream_decoder_new,
[ FLAC_LIBS="-lFLAC $OGG_LIBS -lm"
flac_found=yes ],
[ flac_found=no ],
$OGG_LIBS -lm)
else
flac_found=no
fi
if test "$flac_found" = "yes"; then
AC_CHECK_MEMBER(FLAC__StreamMetadata_StreamInfo.sample_rate, ,
[ flac_found=no ],
[ #include <FLAC/format.h>
])
fi
if test x"$flac_found" = xyes ; then
AC_CHECK_LIB(FLAC, FLAC__stream_decoder_skip_single_frame,
[ flac_decoder_skip_found=yes ],
[ flac_decoder_skip_found=no ],
$FLAC_LIBS)
if test x"$flac_decoder_skip_found" = xyes; then
opt_features_yes="$opt_features_yes\n * FLAC audio (1.1.1 or newer)"
AC_DEFINE(HAVE_FLAC_DECODER_SKIP, [1], [Define if FLAC__stream_decoder_skip_single_frame exists])
else
opt_features_yes="$opt_features_yes\n * FLAC audio (1.1.0 or older)"
fi
AC_DEFINE(HAVE_FLAC_FORMAT_H, [1], [Define if the FLAC headers are present])
else
FLAC_LIBS=""
opt_features_no="$opt_features_no\n * FLAC audio"
fi
AC_SUBST(FLAC_LIBS)
dnl
dnl Check for libpcre
dnl
AC_PATH_PROG(PCRE_CONFIG, pcre-config, no, $PATH:/usr/local/bin)
if test x"$PCRE_CONFIG" = "xno" ; then
AC_MSG_ERROR([Cound not find the pcre-config program])
fi
PCRE_CFLAGS="`$PCRE_CONFIG --cflags`"
PCRE_LIBS="`$PCRE_CONFIG --libs` -lpcrecpp"
AC_CACHE_CHECK([for libpcrecpp],[ac_cv_pcre_links],[
ac_save_LIBS="$LIBS"
ac_save_CXXFLAGS="$CXXFLAGS"
LIBS="$LIBS $PCRE_LIBS"
CXXFLAGS="$CXXFLAGS $PCRE_CFLAGS"
AC_LANG_PUSH(C++)
AC_TRY_LINK([
#include <pcrecpp.h>
],
[pcrecpp::RE re("test");],
ac_cv_pcre_links=yes,
ac_cv_pcre_links=no)
AC_LANG_POP
LIBS="$ac_save_LIBS"
CXXFLAGS="$ac_save_CXXFLAGS"
])
if test x"$ac_cv_pcre_links" = "xno"; then
AC_MSG_ERROR([Could not find the PCRE C++ library])
fi
AC_SUBST(PCRE_CFLAGS)
AC_SUBST(PCRE_LIBS)
dnl
dnl Test for libebml, and define EBML_CFLAGS and EBML_LIBS
dnl
ebml_ver_req_major=0
ebml_ver_req_minor=7
ebml_ver_req_micro=7
AC_CACHE_CHECK([for libEBML headers version >= ${ebml_ver_req_major}.${ebml_ver_req_minor}.${ebml_ver_req_micro}],
[ac_cv_ebml_found],[
EBML_LIBS="-lebml"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
LIBS="$LIBS $EBML_LIBS"
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([
#include <ebml/EbmlVersion.h>
#include <ebml/EbmlDummy.h>
using namespace libebml;
#if LIBEBML_VERSION < ((${ebml_ver_req_major} << 16) + (${ebml_ver_req_minor} << 8) + ${ebml_ver_req_micro})
# error libebml is too old
#endif
],
[],
ac_cv_ebml_found=yes,
ac_cv_ebml_found=no)
if test "${ac_cv_ebml_found}" = "no" ; then
EBML_CFLAGS="-I/usr/local/include"
EBML_LIBS="-L/usr/local/lib $EBML_LIBS"
CXXFLAGS="-I/usr/local/include $CXXFLAGS"
LIBS="-L/usr/local/lib $LIBS"
AC_TRY_COMPILE([
#include <ebml/EbmlVersion.h>
#include <ebml/EbmlDummy.h>
using namespace libebml;
#if LIBEBML_VERSION < ((${ebml_ver_req_major} << 16) + (${ebml_ver_req_minor} << 8) + ${ebml_ver_req_micro})
# error libebml is too old
#endif
],
[],
ac_cv_ebml_found=yes,
ac_cv_ebml_found=no)
fi
AC_LANG_POP
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
])
if test x"${ac_cv_ebml_found}" != "xyes" ; then
echo '*** Your libEBML version is too old. Upgrade to at least version'
echo '*** '${ebml_ver_req_major}.${ebml_ver_req_minor}.${ebml_ver_req_micro}' and re-run configure.'
exit 1
fi
dnl
dnl Test if libebml has to be compiled with -DEBML_DLL on Windows.
dnl
ebml_check_msg_nodll="yes, without -DEBML_DLL"
ebml_check_msg_dll="yes, with -DEBML_DLL"
AC_CACHE_CHECK([if linking against libEBML works and if it requires -DEBML_DLL],
[ac_cv_ebml_dll],[
AC_LANG_PUSH(C++)
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $EBML_CFLAGS"
LIBS="$LIBS $EBML_LIBS"
AC_TRY_LINK([
#include <ebml/EbmlVersion.h>
#include <ebml/EbmlDummy.h>
using namespace libebml;
],
[EbmlDummy d;],
ac_cv_ebml_dll="${ebml_check_msg_nodll}",
ac_cv_ebml_dll="not found")
if test x"${ac_cv_mingw32}" = "xyes" ; then
if test x"${ac_cv_ebml_dll}" != "x${ebml_check_msg_nodll}" ; then
CXXFLAGS="$CXXFLAGS -DEBML_DLL"
AC_TRY_LINK([
#include <ebml/EbmlVersion.h>
#include <ebml/EbmlDummy.h>
using namespace libebml;
],
[EbmlDummy d;],
ac_cv_ebml_dll="${ebml_check_msg_dll}")
fi
fi
AC_LANG_POP
CXXFLAGS="${ac_save_CXXFLAGS}"
LIBS="${ac_save_LIBS}"
])
if test x"${ac_cv_ebml_dll}" != "x${ebml_check_msg_dll}" -a x"${ac_cv_ebml_dll}" != "x${ebml_check_msg_nodll}" ; then
echo '*** The libEBML library was not found.'
exit 1
fi
if test x"${ac_cv_ebml_dll}" = "x${ebml_check_msg_dll}" ; then
EBML_CFLAGS="$EBML_CFLAGS -DEBML_DLL"
fi
AC_SUBST(EBML_CFLAGS)
AC_SUBST(EBML_LIBS)
dnl
dnl Test for libmatroska, and define MATROSKA_CFLAGS and MATROSKA_LIBS
dnl
kax_ver_req_major=0
kax_ver_req_minor=8
kax_ver_req_micro=1
AC_CACHE_CHECK([for libMatroska headers version >= ${kax_ver_req_major}.${kax_ver_req_minor}.${kax_ver_req_micro}],
[ac_cv_matroska_found],
[
MATROSKA_LIBS="-lmatroska"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CXXFLAGS="$CFLAGS $MATROSKA_CFLAGS"
LIBS="$LIBS $MATROSKA_LIBS $EBML_LIBS"
rm -f conf.matroskatest
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([
#include <ebml/EbmlConfig.h>
#include <matroska/KaxVersion.h>
#include <matroska/KaxTracks.h>
using namespace libmatroska;
#if LIBMATROSKA_VERSION < ((${kax_ver_req_major} << 16) + (${kax_ver_req_minor} << 8) + ${kax_ver_req_micro})
# error libmatroska is too old
#endif
],
[],
ac_cv_matroska_found=yes,
ac_cv_matroska_found=no)
if test x"${ac_cv_matroska_found}" != "xyes" ; then
MATROSKA_CFLAGS="-I/usr/local/include"
MATROSKA_LIBS="-L/usr/local/lib $MATROSKA_LIBS"
CXXFLAGS="-I/usr/local/include $CXXFLAGS"
LIBS="-L/usr/local/lib $LIBS"
AC_TRY_COMPILE([
#include <ebml/EbmlConfig.h>
#include <matroska/KaxVersion.h>
#include <matroska/KaxTracks.h>
using namespace libmatroska;
#if LIBMATROSKA_VERSION < ((${kax_ver_req_major} << 16) + (${kax_ver_req_minor} << 8) + ${kax_ver_req_micro})
# error libmatroska is too old
#endif
],
[],
ac_cv_matroska_found=yes,
ac_cv_matroska_found=no)
fi
AC_LANG_POP
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
])
if test x"${ac_cv_matroska_found}" != "xyes" ; then
echo '*** Your libMatroska version is too old. Upgrade to at least version'
echo '*** '${kax_ver_req_major}.${kax_ver_req_minor}.${kax_ver_req_micro}' and re-run configure.'
exit 1
fi
matroska_check_msg_nodll="yes, without -MATROSKA_DLL"
matroska_check_msg_dll="yes, with -DMATROSKA_DLL"
AC_CACHE_CHECK([if linking against libMatroska works and if it requires -DMATROSKA_DLL],
[ac_cv_matroska_dll],[
AC_LANG_PUSH(C++)
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $EBML_CFLAGS $MATROSKA_CFLAGS"
LIBS="$LIBS $MATROSKA_LIBS $EBML_LIBS"
AC_TRY_LINK([
#include <matroska/KaxVersion.h>
#include <matroska/KaxSegment.h>
using namespace libmatroska;
],
[KaxSegment s;],
ac_cv_matroska_dll="${matroska_check_msg_nodll}",
ac_cv_matroska_dll="not found")
if test x"${ac_cv_mingw32}" = "xyes" ; then
if test x"${ac_cv_matroska_dll}" != "x${matroska_check_msg_nodll}" ; then
CXXFLAGS="$CXXFLAGS -DMATROSKA_DLL"
AC_TRY_LINK([
#include <matroska/KaxVersion.h>
#include <matroska/KaxSegment.h>
using namespace libmatroska;
],
[KaxSegment s;],
ac_cv_matroska_dll="${matroska_check_msg_dll}")
fi
fi
AC_LANG_POP
CXXFLAGS="${ac_save_CXXFLAGS}"
LIBS="${ac_save_LIBS}"
])
if test x"${ac_cv_matroska_dll}" != "x${matroska_check_msg_nodll}" -a x"${ac_cv_matroska_dll}" != "x${matroska_check_msg_dll}" ; then
echo '*** The libMatroska library was not found.'
exit 1
fi
if test x"${ac_cv_matroska_dll}" = "x${matroska_check_msg_dll}" ; then
MATROSKA_CFLAGS="$MATROSKA_CFLAGS -DMATROSKA_DLL"
fi
if test x"${ac_cv_ebml_dll}" != "xyes" -o x"${ac_cv_matroska_dll}" != "xyes" ; then
LIBMTXCOMMONDLL=0
fi
AC_SUBST(MATROSKA_CFLAGS)
AC_SUBST(MATROSKA_LIBS)
dnl
dnl Check for libexpat
dnl
AC_CHECK_LIB(expat, XML_ParserCreate,
[ EXPAT_LIBS="-lexpat"
expat_found=yes ],
[ expat_found=no ],)
if test "$expat_found" = "no"; then
AC_MSG_ERROR([Could not find the Expat library])
fi
AC_CHECK_HEADERS(expat.h, , expat_found=no)
if test "$expat_found" = "no"; then
AC_MSG_ERROR([Could not find expat.h])
fi
AC_SUBST(EXPAT_CFLAGS)
AC_SUBST(EXPAT_LIBS)
dnl
dnl Check for zlib
dnl
AC_CHECK_LIB(z, zlibVersion,
[ ZLIB_LIBS="-lz"
zlib_found=yes ],
[ zlib_found=no ],)
if test "$zlib_found" = "no"; then
AC_MSG_ERROR([Could not find the zlib library])
fi
AC_CHECK_HEADERS(zlib.h, , zlib_found=no)
AC_SUBST(ZLIB_LIBS)
dnl
dnl Check for liblzo
dnl
AC_ARG_ENABLE([lzo],
AC_HELP_STRING([--enable-lzo],[compile in support for LZO compression (auto)]))
if test "x$enable_lzo" != "xno"; then
AC_CHECK_LIB(lzo2, lzo1x_1_compress,
[ LZO_LIBS="-llzo2"
lzo_found=yes ],
[ AC_CHECK_LIB(lzo, lzo1x_1_compress,
[ LZO_LIBS="-llzo"
lzo_found=yes ],
[ lzo_found=no ],)
],)
if test "x$lzo_found" = "xyes"; then
AC_CHECK_HEADERS([lzo1x.h lzo/lzo1x.h])
if test "x$ac_cv_header_lzo1x_h" != "xyes" -a "x$ac_cv_header_lzo_lzo1x_h" != "xyes"; then
lzo_found=no
fi
fi
fi
if test x"$lzo_found" = xyes ; then
opt_features_yes="$opt_features_yes\n * LZO compression"
AC_DEFINE([HAVE_LZO], [1], [Define this if LZO compression is present])
else
opt_features_no="$opt_features_no\n * LZO compression"
fi
AC_SUBST(LZO_LIBS)
dnl
dnl Check for libbz2
dnl
AC_ARG_ENABLE([bz2],
AC_HELP_STRING([--enable-bz2],[compile in support for BZ2 compression (auto)]))
if test x"$enable_bz2" = x"yes" -o x"$enable_bz2" = "x"; then
AC_CHECK_LIB(bz2, BZ2_bzCompress,
[ BZ2_LIBS="-lbz2"
bz2_found=yes ],
[ bz2_found=no ],)
if test "$bz2_found" = "yes"; then
AC_CHECK_HEADERS(bzlib.h, , bz2_found=no)
fi
fi
if test x"$bz2_found" = xyes ; then
opt_features_yes="$opt_features_yes\n * BZ2 compression"
else
opt_features_no="$opt_features_no\n * BZ2 compression"
fi
AC_SUBST(BZ2_LIBS)
dnl
dnl Check for wxWidgets
dnl
AC_ARG_ENABLE([gui],
AC_HELP_STRING([--enable-gui],[compile mkvinfo's GUI and mmg (yes)]))
wxw_min_ver=2.6.0
if test x"$enable_gui" = x"yes" -o x"$enable_gui" = "x"; then
AC_ARG_WITH(wx_config,
AC_HELP_STRING([--with-wx-config=prog],
[use prog instead of looking for wx-config]),
[ WX_CONFIG="$with_wx_config" ],)
AC_PATH_PROG(WX_CONFIG, wx-config, no, $PATH:/usr/local/bin)
if test x"$WX_CONFIG" != "xno" ; then
AC_MSG_CHECKING(for wxWidgets $wxw_min_ver or newer)
wxwversion=`$WX_CONFIG --version`
if check_version $wxw_min_ver $wxwversion ; then
WXWIDGETS_CFLAGS=`$WX_CONFIG --cxxflags`
WXWIDGETS_LIBS=`$WX_CONFIG --libs | \
sed -e 's/-Wl,--subsystem,windows//' -e 's/-mwindows//'`
AC_CACHE_VAL(am_cv_wx_compilation, [
AC_LANG_PUSH(C++)
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $WXWIDGETS_CFLAGS"
LIBS="$LDFLAGS $WXWIDGETS_LIBS"
AC_TRY_LINK([
#include <wx/dnd.h>
#include <wx/treectrl.h>
], [
wxDragResult result = wxDragError;
wxTreeItemId id;
], [ am_cv_wx_compilation=1 ], [ am_cv_wx_compilation=0 ])
AC_LANG_POP()
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
])
if test x"$am_cv_wx_compilation" = x1; then
if test "x$MINGW" = "x1" ; then
WXWIDGETS_INCLUDES=""
set - `echo $WXWIDGETS_CFLAGS`
while test "x$1" != "x" ; do
case "$1" in
-I*)
WXWIDGETS_INCLUDES="$WXWIDGETS_INCLUDES $1"
;;
esac
shift
done
fi
AC_DEFINE(HAVE_WXWIDGETS, 1, [Define if wxWindows is present])
AC_MSG_RESULT($wxwversion ok)
have_wxwindows=yes
USE_WXWIDGETS=yes
opt_features_yes="$opt_features_yes\n * GUIs"
else
AC_MSG_RESULT(no: test program could not be compiled)
fi
else
AC_MSG_RESULT(no: version $wxwversion is too old)
fi
else
AC_MSG_RESULT(no: wx-config was not found)
fi
else
echo '*** Not checking for wxWidgets: disabled by user request'
fi
if test x"$have_wxwindows" != "xyes" ; then
opt_features_no="$opt_features_no\n * GUIs"
fi
AC_SUBST(WXWIDGETS_CFLAGS)
AC_SUBST(WXWIDGETS_INCLUDES)
AC_SUBST(WXWIDGETS_LIBS)
AC_SUBST(USE_WXWIDGETS)
dnl
dnl Check for Qt 4 or newer
dnl
AC_ARG_ENABLE([qt],
AC_HELP_STRING([--enable-qt],[compile the Qt version of the GUIs]))
qt_min_ver=4.0.0
if test x"$enable_qt" = "xyes" -a \
'(' x"$enable_gui" = x"yes" -o x"$enable_gui" = "x" ')'; then
dnl Find moc.
AC_ARG_WITH(moc,
AC_HELP_STRING([--with-moc=prog],[use prog instead of looking for moc]),
[ MOC="$with_moc" ],)
if ! test -z "$MOC"; then
AC_MSG_CHECKING(for moc)
AC_MSG_RESULT(using supplied $MOC)
else
AC_PATH_PROG(MOC, moc-qt4,, $PATH)
if test -z "$MOC"; then
AC_PATH_PROG(MOC, moc,, $PATH)
fi
fi
if test -z "$MOC" -o ! -x "$MOC"; then
echo "*** The 'moc' binary was not found or is not executable."
exit 1
fi
dnl Check its version.
AC_MSG_CHECKING(for the Qt version $MOC uses)
moc_ver=`"$MOC" -v 2>&1 | sed -e 's:.*Qt ::' -e 's:[[^0-9\.]]::g'`
if test -z "moc_ver"; then
AC_MSG_RESULT(unknown; please contact the author)
elif ! check_version $qt_min_ver $moc_ver; then
AC_MSG_RESULT(too old: $moc_ver)
else
AC_MSG_RESULT($moc_ver)
moc_found=1
fi
AC_ARG_WITH(uic,
AC_HELP_STRING([--with-uic=prog],[use prog instead of looking for uic]),
[ UIC="$with_uic" ],)
if test x"$moc_found" = "x1"; then
if ! test -z "$UIC"; then
AC_MSG_CHECKING(for uic)
AC_MSG_RESULT(using supplied $UIC)
else
AC_PATH_PROG(UIC, uic-qt4,, $PATH)
if test -z "$UIC"; then
AC_PATH_PROG(UIC, uic,, $PATH)
fi
fi
if test -z "$UIC" -o ! -x "$UIC"; then
echo "*** The 'uic' binary was not found or is not executable."
exit 1
fi
dnl Check its version.
AC_MSG_CHECKING(for the Qt version $UIC uses)
uic_ver=`"$UIC" -v 2>&1 | sed -e 's:.*Qt ::' -e 's:[[^0-9\.]]::g'`
if test -z "uic_ver"; then
AC_MSG_RESULT(unknown; please contact the author)
elif ! check_version $qt_min_ver $uic_ver; then
AC_MSG_RESULT(too old: $uic_ver)
else
AC_MSG_RESULT($uic_ver)
uic_found=1
fi
fi
AC_MSG_CHECKING(for Qt $qt_min_ver or newer)
if test x"$moc_found" != "x1"; then
AC_MSG_RESULT(no: moc not found)
elif test x"$uic_found" != "x1"; then
AC_MSG_RESULT(no: uic not found)
elif ! pkg-config QtGui --atleast-version=$qt_min_ver || \
! pkg-config QtCore --atleast-version=$qt_min_ver ; then
AC_MSG_RESULT(no: pkg-config says "too old")
else
dnl Try compiling and linking an application.
QT_CFLAGS="`pkg-config QtCore --cflags` `pkg-config QtGui --cflags`"
QT_LIBS="`pkg-config QtGui --libs`"
AC_LANG_PUSH(C++)
AC_CACHE_VAL(am_cv_qt_compilation, [
run_qt_test=1
while true; do
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $QT_CFLAGS"
LIBS="$LDFLAGS $QT_LIBS"
unset ac_cv_qt_compilation
AC_TRY_LINK([
#include <QtCore>
class Config : public QCoreApplication {
public:
Config(int &argc, char **argv);
};
Config::Config(int &argc, char **argv)
: QCoreApplication(argc,argv) {setApplicationName("config");}
], [
int ai = 0;
char **ac = 0;
Config app(ai,ac);
qWarning(qPrintable(app.applicationName()));
return 0;
], [ am_cv_qt_compilation=1 ], [ am_cv_qt_compilation=0 ])
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
if test x"$am_cv_qt_compilation" = x1; then
break
elif test x"$run_qt_test" = "x1"; then
dnl On some systems (notably OpenSuSE 10.0) the pkg-config for the
dnl --cflags don't include the QtCore and QtGui subdirectories.
dnl Add them now.
set - $QT_CFLAGS
while test ! -z "$1" ; do
case "$1" in
-I*)
QT_CFLAGS="$QT_CFLAGS $1/QtCore $1/QtGui"
;;
esac
shift
done
run_qt_test=2
elif test x"$run_qt_test" = "x2"; then
QT_CFLAGS="$QT_CFLAGS -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/local/include/QtCore -I/usr/local/include/QtGui"
run_qt_test=3
else
break
fi
done
])
AC_LANG_POP()
if test x"$am_cv_qt_compilation" = x1; then
AC_DEFINE(HAVE_QT, 1, [Define if Qt is present])
have_qt=yes
USE_QT=yes
opt_features_yes="$opt_features_yes (Qt version)"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no: test program could not be compiled)
fi
fi
fi
AC_SUBST(MOC)
AC_SUBST(UIC)
AC_SUBST(QT_CFLAGS)
AC_SUBST(QT_LIBS)
AC_SUBST(USE_QT)
dnl
dnl Which translations should be installed?
dnl
dnl AC_CHECK_FUNCS(gettext, gettext_found=yes, gettext_found=no)
dnl if test x"$gettext_found" != xyes ; then
dnl AC_CHECK_LIB(intl, gettext,
dnl [ LIBINTL_LIBS="-lintl";
dnl gettext_found=yes ], gettext_found=no)
dnl fi
dnl if test x"$gettext_found" = xyes ; then
dnl AC_CHECK_HEADERS(libintl.h, libintl_h_found=yes, libintl_h_found=no)
dnl if test x"$libintl_h_found" = xyes ; then
dnl AC_MSG_CHECKING(the translations to install)
dnl if test x"$LINGUAS" = x ; then
dnl TRANSLATIONS_POS="`echo po/*.po`"
dnl else
dnl for i in $LINGUAS; do
dnl if test -f "po/$i.po" ; then
dnl TRANSLATIONS_POS="$TRANSLATIONS_POS po/$i.po"
dnl fi
dnl done
dnl fi
dnl TRANSLATIONS="`echo "$TRANSLATIONS_POS" | \
dnl sed -e 's/po\///g' -e 's/\.po//g'`"
dnl AC_MSG_RESULT($TRANSLATIONS)
dnl fi
dnl opt_features_yes="$opt_features_yes\n * translations (gettext)"
dnl else
dnl opt_features_no="$opt_features_yes\n * translations (gettext)"
dnl fi
AC_SUBST(LIBINTL_LIBS)
AC_SUBST(TRANSLATIONS_POS)
AC_SUBST(TRANSLATIONS)
dnl
dnl Check for libmagic
dnl
AC_CHECK_LIB(magic, magic_open,
[ MAGIC_LIBS="-lmagic -lz"
magic_found=yes ],
[ magic_found=no ],
-lz)
if test "x$magic_found" = "xyes" ; then
AC_CHECK_HEADERS([magic.h])
if test "x$ac_cv_header_magic_h" = "xyes" ; then
opt_features_yes="$opt_features_yes\n * libMagic file type detection"
else
opt_features_no="$opt_features_no\n * libMagic file type detection"
fi
fi
AC_SUBST(MAGIC_LIBS)
AC_OUTPUT(Makefile avilib-0.6.10/Makefile librmff/Makefile src/Makefile src/common/Makefile src/input/Makefile src/output/Makefile src/mpegparser/Makefile src/mmg/Makefile src/extract/Makefile src/merge/Makefile src/info/Makefile)
echo ''
echo 'The mkvtoolnix configuration is complete.'
echo -e 'Optional features that are built: '"$opt_features_yes"
echo -e 'Optional features that are NOT built: '"$opt_features_no"