AC_INIT(src/mkvmerge.cpp) AC_PREREQ(2.50) AC_CONFIG_HEADERS(config.h:config.h.in) PACKAGE="mkvtoolnix" VERSION="0.9.1" 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(STRIP, strip, :) AC_CHECK_TOOL(AR, ar, :) AC_CHECK_TOOL(LD, ld, :) dnl Check for headers AC_HEADER_STDC() 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, [ --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 <>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, [ --with-extra-includes=DIR Path to other include directories separated by ';'],, with_extra_include_given=no) AC_ARG_WITH(extra-libs, [ --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) dnl dnl Debugging and profiling options dnl AC_ARG_ENABLE([debug], [ --enable-debug compile with debug information]) if test x"$enable_debug" = x"yes"; then dnl debug information DEBUG_CFLAGS="-g -DDEBUG" else DEBUG_CFLAGS="" fi AC_ARG_ENABLE([profiling], [ --enable-profiling compile with profiling information]) if test x"$enable_profiling" = x"yes"; then dnl profiling information PROFILING_CFLAGS="-pg" PROFILING_LIBS="" else PROFILING_CFLAGS="" PROFILING_LIBS="" fi AC_SUBST(DEBUG_CFLAGS) AC_SUBST(PROFILING_CFLAGS) AC_SUBST(PROFILING_LIBS) dnl dnl Check for mingw dnl AC_CACHE_CHECK([if being compiled with mingw32], [ac_cv_mingw32],[ if test "x`gcc --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 fi AC_SUBST(MINGW_LIBS) AC_SUBST(MINGW_GUIAPP) 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 #include ], [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 #include ], [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 #include 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.' 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 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) 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_CHECK_LIB(FLAC, FLAC__stream_decoder_new, [ FLAC_LIBS="-lFLAC -lm" flac_found=yes ], [ flac_found=no ], "-lm") if test "$flac_found" = "yes"; then AC_CHECK_HEADERS(FLAC/format.h, , flac_found=no) else echo '*** WARNING:' echo '*** libFLAC was not found. mkvmerge will be built' echo '*** without support for FLAC tracks.' fi AC_SUBST(FLAC_LIBS) dnl dnl Test for libebml, and define EBML_CFLAGS and EBML_LIBS dnl AC_MSG_CHECKING(for EBML) EBML_LIBS="-lebml" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" LIBS="$LIBS $EBML_LIBS" rm -f conf.ebmltest AC_LANG_PUSH(C++) AC_TRY_RUN([ #include #include #include #include #include using namespace libebml; int main () { EbmlDummy d; FILE *f; f = fopen("conf.ebmltest", "wb"); if (f == NULL) return 1; fprintf(f, "%s\n", EbmlCodeVersion.c_str()); fclose(f); return 0; } ],ebml_found=yes,ebml_found=no,) if test "$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_RUN([ #include #include #include #include #include using namespace libebml; int main () { EbmlDummy d; FILE *f; f = fopen("conf.ebmltest", "wb"); if (f == NULL) return 1; fprintf(f, "%s\n", EbmlCodeVersion.c_str()); fclose(f); return 0; } ],ebml_found=yes,ebml_found=no,) fi AC_LANG_POP CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" if test "$ebml_found" = "yes" -a -f conf.ebmltest ; then AC_MSG_RESULT(yes) else rm -f conf.ebmltest AC_MSG_RESULT(no) exit 1 fi ebml_ver_req_major=0 ebml_ver_req_minor=7 ebml_ver_req_micro=0 AC_MSG_CHECKING(Ebml version >= ${ebml_ver_req_major}.${ebml_ver_req_minor}.${ebml_ver_req_micro}) ebml_version=`cat conf.ebmltest` set - `sed 's/\./\ /g' < conf.ebmltest` if test "x$1" = "x" -o $1 -lt ${ebml_ver_req_major} ; then mver_ok=0 elif test $1 -gt ${ebml_ver_req_major} ; then mver_ok=1 else if test "x$2" = "x" -o $2 -lt ${ebml_ver_req_minor} ; then mver_ok=0 elif test $2 -gt ${ebml_ver_req_minor} ; then mver_ok=1 else if test "x$3" = "x" -o $3 -lt ${ebml_ver_req_micro} ; then mver_ok=0 else mver_ok=1 fi fi fi rm -f conf.ebmltest if test "$mver_ok" = "1" ; then AC_MSG_RESULT(ok ($ebml_version)) else AC_MSG_RESULT(too old ($ebml_version)) echo '*** Your Ebml 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 AC_SUBST(EBML_CFLAGS) AC_SUBST(EBML_LIBS) dnl dnl Test for libmatroska, and define MATROSKA_CFLAGS and MATROSKA_LIBS dnl AC_MSG_CHECKING(for Matroska) 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_RUN([ #include #include #include #include #include using namespace libmatroska; int main () { KaxTracks tracks; FILE *f; f = fopen("conf.matroskatest", "wb"); if (f == NULL) return 1; fprintf(f, "%s\n", KaxCodeVersion.c_str()); fclose(f); return 0; } ],matroska_found=yes,matroska_found=no,) if test "$matroska_found" = "no" ; 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_RUN([ #include #include #include #include #include using namespace libmatroska; int main () { KaxTracks tracks; FILE *f; f = fopen("conf.matroskatest", "wb"); if (f == NULL) return 1; fprintf(f, "%s\n", KaxCodeVersion.c_str()); fclose(f); return 0; } ],matroska_found=yes,matroska_found=no,) fi AC_LANG_POP CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" if test "$matroska_found" = "yes" -a -f conf.matroskatest ; then AC_MSG_RESULT(yes) else rm -f conf.matroskatest AC_MSG_RESULT(no) exit 1 fi kax_ver_req_major=0 kax_ver_req_minor=7 kax_ver_req_micro=0 AC_MSG_CHECKING(Matroska version >= ${kax_ver_req_major}.${kax_ver_req_minor}.${kax_ver_req_micro}) matroska_version=`cat conf.matroskatest` set - `sed 's/\./\ /g' < conf.matroskatest` if test "x$1" = "x" -o $1 -lt ${kax_ver_req_major} ; then mver_ok=0 elif test $1 -gt ${kax_ver_req_major} ; then mver_ok=1 else if test "x$2" = "x" -o $2 -lt ${kax_ver_req_minor} ; then mver_ok=0 elif test $2 -gt ${kax_ver_req_minor} ; then mver_ok=1 else if test "x$3" = "x" -o $3 -lt ${kax_ver_req_micro} ; then mver_ok=0 else mver_ok=1 fi fi fi rm -f conf.matroskatest if test "$mver_ok" = "1" ; then AC_MSG_RESULT(ok ($matroska_version)) else AC_MSG_RESULT(too old ($matroska_version)) echo '*** Your Matroska 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 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_CHECK_LIB(lzo, lzo1x_1_compress, [ LZO_LIBS="-llzo" lzo_found=yes ], [ lzo_found=no ],) if test "$lzo_found" = "yes"; then AC_CHECK_HEADERS(lzo1x.h, , lzo_found=no) fi AC_SUBST(LZO_LIBS) dnl dnl Check for libbz2 dnl 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 AC_SUBST(BZ2_LIBS) dnl dnl Check for wxWindows dnl AC_MSG_CHECKING(for wxWindows) if wx-config --cxxflags > /dev/null 2>&1; then wxwversion=`wx-config --version` wxw_ver_req_major=2 wxw_ver_req_minor=4 wxw_ver_req_micro=0 set - `echo $wxwversion | sed 's/\./\ /g'` if test "x$1" = "x" -o $1 -lt ${wxw_ver_req_major} ; then wxwver_ok=0 elif test $1 -gt ${wxw_ver_req_major} ; then wxwver_ok=1 else if test "x$2" = "x" -o $2 -lt ${wxw_ver_req_minor} ; then wxwver_ok=0 elif test $2 -gt ${wxw_ver_req_minor} ; then wxwver_ok=1 else if test "x$3" = "x" -o $3 -lt ${wxw_ver_req_micro} ; then wxwver_ok=0 else wxwver_ok=1 fi fi fi if test "$wxwver_ok" = "1" ; then WXWINDOWS_CFLAGS=`wx-config --cxxflags` WXWINDOWS_LDFLAGS=`wx-config --ldflags` WXWINDOWS_LIBS=`wx-config --libs` AC_DEFINE(HAVE_WXWINDOWS, 1, [Define if wxWindows is present]) MMG_SUBDIRS=mmg AC_MSG_RESULT($wxwversion ok) have_wxwindows=yes USE_WXWINDOWS=yes else AC_MSG_RESULT(no: version $wxwversion is too old) fi else AC_MSG_RESULT(no: wx-config was not found) fi AC_SUBST(WXWINDOWS_CFLAGS) AC_SUBST(WXWINDOWS_LDFLAGS) AC_SUBST(WXWINDOWS_LIBS) AC_SUBST(MMG_SUBDIRS) AC_SUBST(USE_WXWINDOWS) CFLAGS="$USER_CPPFLAGS @EXTRA_CFLAGS@ $USER_CFLAGS -Wall -Wno-sign-compare -Wno-comment -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @EXTRA_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@ @MATROSKA_CFLAGS@ @EBML_CFLAGS@" CXXFLAGS="$USER_CPPFLAGS @EXTRA_CFLAGS@ $USER_CXXFLAGS -Wall -Wno-sign-compare -Wno-comment -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @EXTRA_CFLAGS@ @DEBUG_CFLAGS@ @PROFILING_CFLAGS@ @MATROSKA_CFLAGS@ @EBML_CFLAGS@ @WXWINDOWS_CFLAGS@" LDFLAGS="$USER_LDFLAGS @EXTRA_LDFLAGS@" AC_SUBST(LDFLAGS) AC_OUTPUT(Makefile avilib-0.6.10/Makefile librmff/Makefile src/Makefile src/common/Makefile src/input/Makefile src/output/Makefile src/mmg/Makefile)