dnl ========================================================================== dnl dnl Autoconf script for XviD dnl dnl Copyright(C) 2003-2004 Edouard Gomez dnl dnl ========================================================================== dnl dnl Modified for Avisynth 3.0 dnl dnl Copyright(C) 2005 Vincent TORRI dnl dnl ========================================================================== dnl ========================================================================== dnl Prerequisites dnl ========================================================================== AC_PREREQ([2.52]) dnl ========================================================================== dnl Default initialization, install prefix and checks build type dnl ========================================================================== AC_INIT([Avisynth], [3.0], [http://forum.doom9.org]) AC_PREFIX_DEFAULT("/usr/local") AC_CONFIG_AUX_DIR([.]) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE dnl AC_CONFIG_SRCDIR([../../src/core.h]) AC_CONFIG_MACRO_DIR([m4]) dnl Do not forget to increase that when needed. API_MAJOR="3" API_MINOR="0" VERSION="${API_MAJOR}.${API_MINOR}" dnl NASM version requirement minimum_nasm_patch_version=34 nasm_prog="nasm" dnl BOOST version requirement BOOST_VERSION_MAJOR="1" BOOST_VERSION_MINOR="33" BOOST_VERSION="${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}" dnl Gstreamer version requirement GST_REQS=0.8.11 GSTPLUG_REQS=0.8.11 dnl Gtk+ version requirement GTK_REQS=2.4 dnl Default CFLAGS -- Big impact on overall speed our_cxxflags_defaults="-O2 -Wall -Wno-non-virtual-dtor -fexceptions" our_cxxflags_defaults="$our_cxxflags_defaults -fstrength-reduce" our_cxxflags_defaults="$our_cxxflags_defaults -finline-functions" our_cxxflags_defaults="$our_cxxflags_defaults -ffast-math" dnl Default GEN_SOURCES for gen_source.sh dnl On Linux, Vfw and COM files should be removed GEN_SOURCES= dnl ========================================================================== dnl Features - configure options dnl dnl modified dnl dnl ========================================================================== FEATURES="" dnl Compilers version to use AC_ARG_ENABLE( [gcc-3-3-4], AC_HELP_STRING( [--enable-gcc-3-3-4], [Use g++ 3.3.4]), [if test "$enable_gcc_3_3_4" = "yes" ; then gpp="/usr/gcc/bin/g++-3.3.4" fi], []) dnl Debug mode AC_ARG_ENABLE( [core-debug], AC_HELP_STRING( [--enable-core-debug], [Enable debug mode for avs' core (default=no)]), [if test "$enable_core_debug" = "no" ; then core_debug_mode="no" else if test "$enable_core_debug" = "yes" ; then core_debug_mode="yes" fi fi], [core_debug_mode="no"]) dnl Assembly code AC_ARG_ENABLE( [assembly], AC_HELP_STRING( [--disable-assembly], [Disable assembly code]), [if test "$enable_assembly" = "no" ; then assembly="no" else if test "$enable_assembly" = "yes" ; then assembly="yes" fi fi], [assembly="yes"]) dnl Build as a module not a shared lib on darwin AC_ARG_ENABLE( [macosx_module], AC_HELP_STRING( [--enable-macosx_module], [Build as a module on MacOS X]), [if test "$enable_macosx_module" = "yes" ; then macosx_module="yes" else macosx_module="no" fi], [macosx_module="no"]) dnl ========================================================================== dnl Check for the C compiler (could be passed on command line) dnl ========================================================================== dnl dnl First we test if CXXFLAGS have been passed on command line dnl I do that because autoconf defaults (-g -O2) suck and they would kill dnl performance. To prevent that we define a good defult CXXFLAGS at the end dnl of the script if and only if CXXFLAGS has not been passed on the command dnl line dnl AC_MSG_CHECKING(whether to use default CXXFLAGS) if test x"$CXXFLAGS" = x"" ; then force_default_cxx_options="yes" AC_MSG_RESULT([yes]) else force_default_cxx_options="no" AC_MSG_RESULT([no]) fi dnl Now we can safely check for the C++ compiler AC_LANG([C++]) AC_PROG_CXX([${gpp}]) AC_PROG_CXXCPP([${gpp}]) dnl ========================================================================== dnl Check for the visibility feature of GCC 4.0 dnl ========================================================================== GCC_VISIBILITY_FEATURE= AC_MSG_CHECKING([whether ${CXX} supports -fvisibility=hidden]) save_CXXFLAGS=${CXXFLAGS} CXXFLAGS="$CXXFLAGS -fvisibility=hidden" AC_TRY_LINK( [], [return 0;], [HAVE_GCC_VISIBILITY_FEATURE="-DHAVE_GCC_VISIBILITY_FEATURE" visibility="yes"], [visibility="no"]) AC_MSG_RESULT(${visibility}) CXXFLAGS=${save_CXXFLAGS} dnl ========================================================================== dnl Check for the install program dnl ========================================================================== AC_PROG_INSTALL dnl ========================================================================== dnl Check for the symbolic links dnl ========================================================================== AC_PROG_LN_S dnl ========================================================================== dnl Check for the ranlib program to generate static library index dnl ========================================================================== AC_PROG_RANLIB dnl ========================================================================== dnl dnl This part looks for: dnl dnl ARCHITECTURE : The platform architecture dnl - IA32 for mmx, mmx-ext, mmx2, sse assembly dnl - IA64 dnl - PPC for PowerPC assembly routines dnl - GENERIC for plain C sources only dnl dnl BUS: Address bus size (in bits) dnl - 32 dnl - 64 dnl dnl ========================================================================== dnl dnl Looking what sources have to be compiled according to the CPU type dnl ARCHITECTURE="" AC_MSG_CHECKING([for whether to use assembly code]) if test x"$assembly" = x"yes" ; then AC_MSG_RESULT([yes]) AC_MSG_CHECKING([for architecture type]) case "$target_cpu" in i[[3456]]86) AC_MSG_RESULT(ia32) ARCHITECTURE="IA32" ;; powerpc) AC_MSG_RESULT(PowerPC) dnl ATM the ppc port is out of date dnl ARCHITECTURE="PPC" assembly="no" ;; ia64) AC_MSG_RESULT(ia64) ARCHITECTURE="IA64" ;; *) AC_MSG_RESULT($target_cpu) assembly="no" ;; esac else AC_MSG_RESULT([no]) assembly="no" fi dnl ========================================================================== dnl dnl Check for OS specific variables dnl - SHARED_EXTENSION, STATIC_EXTENSION, OBJECT_EXTENSION dnl dnl ========================================================================== AC_MSG_CHECKING(for build extensions) SHARED_EXTENSION="" STATIC_EXTENSION="" OBJECT_EXTENSION="" case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) AC_MSG_RESULT([.so .a .o]) STATIC_EXTENSION="a" SHARED_EXTENSION="so" OBJECT_EXTENSION="o" ;; [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) AC_MSG_RESULT([.dll .a .obj]) STATIC_EXTENSION="a" SHARED_EXTENSION="dll" OBJECT_EXTENSION="obj" ;; darwin*|raphsody*) if test x"$macosx_module" = x"yes"; then AC_MSG_RESULT([.so .a .o]) SHARED_EXTENSION="so" else AC_MSG_RESULT([.dynlib .a .o]) SHARED_EXTENSION="dylib" fi STATIC_EXTENSION="a" OBJECT_EXTENSION="o" ;; *) AC_MSG_RESULT([Unknown OS - Using .so .a .o]) STATIC_EXTENSION="a" SHARED_EXTENSION="so" OBJECT_EXTENSION="o" ;; esac dnl ========================================================================== dnl dnl Determines best options for CC and LD dnl - STATIC_LIB, SHARED_LIB, SPECIFIC_CFLAGS, SPECIFIC_LDLAGS dnl dnl dnl dnl ========================================================================== AC_MSG_CHECKING(for platform specific LDFLAGS/CFLAGS) SPECIFIC_LDFLAGS="" SPECIFIC_CFLAGS="" PRE_SHARED_LIB="" case "$target_os" in *bsd*|linux*|irix*|solaris*) AC_MSG_RESULT([ok]) STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)" SHARED_LIB="libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)" SPECIFIC_LDFLAGS="-Wl,-soname,libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm -lrt -ldl" SPECIFIC_CFLAGS="-pthread -fPIC" GEN_SOURCES="/com\\\\/d;/vfw\\\\/d;" ;; [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) AC_MSG_RESULT([ok]) STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)" SHARED_LIB="avisynth.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-lgdi32 -lvfw32 -luuid -lole32 -lmsacm32 -shared -Wl,--out-implib,\$@.a libavisynth.def" SPECIFIC_CFLAGS="-Os -mno-cygwin" ;; darwin*|raphsody*) STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)" SPECIFIC_CFLAGS="-fPIC -fno-common -no-cpp-precomp" if test x"$macosx_module" = x"no"; then AC_MSG_RESULT([dylib options]) SHARED_LIB="libavisynth.\$(API_MAJOR).\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-dynamiclib -flat_namespace -compatibility_version \$(API_MAJOR) -current_version \$(API_MAJOR).\$(API_MINOR) -install_name \$(libdir)/\$(SHARED_LIB)" else AC_MSG_RESULT([module options]) PRE_SHARED_LIB="libavisynth.\$(SHARED_EXTENSION)-temp.o" SHARED_LIB="libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR)" SPECIFIC_LDFLAGS="-r -keep_private_externs -nostdlib && \$(CC) \$(LDFLAGS) \$(PRE_SHARED_LIB) -o libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR) -bundle -flat_namespace -undefined suppress" fi GEN_SOURCES="/vfw\\/d;" ;; beos) AC_MSG_RESULT([ok]) STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)" SHARED_LIB="libavisynth.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="-nostart" SPECIFIC_CFLAGS="-fPIC" ;; *) AC_MSG_RESULT([Unknown Platform (Using default -shared -lc -lm)]) STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)" SHARED_LIB="libavisynth.\$(SHARED_EXTENSION)" SPECIFIC_LDFLAGS="" SPECIFIC_CFLAGS="" ;; esac if test x"$PRE_SHARED_LIB" = x; then PRE_SHARED_LIB=$SHARED_LIB fi dnl ========================================================================== dnl dnl Assembler stuff dnl - AS, AFLAGS, ASSEMBLY_EXTENSION, SOURCES dnl dnl ========================================================================== AS="" AFLAGS="" ASSEMBLY_EXTENSION="" ASSEMBLY_SOURCES="" dnl dnl IA32 dnl if test "$ARCHITECTURE" = "IA32" ; then dnl dnl Checking nasm existence dnl AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes]) if test "$ac_nasm" = "yes" ; then dnl dnl Checking nasm patch version dnl AC_MSG_CHECKING([for nasm patch version]) nasm_patch=`nasm -r | cut -d '.' -f 3 | cut -d ' ' -f 1` if test -z $nasm_patch ; then nasm_patch=-1 fi AC_MSG_RESULT([$nasm_patch]) if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then AC_MSG_ERROR([nasm patch version too old - Update nasm]) else dnl dnl Checking nasm format - win32 or elf dnl AC_MSG_CHECKING([for nasm object format]) case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) AC_MSG_RESULT([elf]) NASM_FORMAT="elf" PREFIX="" ;; [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) AC_MSG_RESULT([win32]) NASM_FORMAT="win32" PREFIX="-DPREFIX" ;; esac AS=nasm AFLAGS="-I\$( conftest.S << EOF .text vxor 0,0,0 EOF if $CC -c conftest.S 2>/dev/null 1>/dev/null ; then AC_MSG_RESULT(yes) SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DARCH_IS_PPC_ALTIVEC" ASSEMBLY_SOURCES="SRC_ALTIVEC" else AC_MSG_RESULT(no) fi rm -f conftest.* fi dnl dnl IA64 dnl if test "$ARCHITECTURE" = "IA64" ; then AS="\$(CC)" AFLAGS="-c" ASSEMBLY_EXTENSION="s" ASSEMBLY_SOURCES="SRC_IA64" case `basename $CC` in *ecc*) DCT_IA64_SOURCES="SRC_IA64_IDCT_ECC" dnl If the compiler is ecc, then i don't know its options dnl fallback to "no options" if test "$force_default_cxx_options" = "yes" ; then our_cflags_defaults="" fi ;; *) DCT_IA64_SOURCES="SRC_IA64_IDCT_GCC" ;; esac fi dnl ========================================================================== dnl dnl Check arguments dnl dnl ========================================================================== dnl Check debug mode if test "$core_debug_mode" = "yes" ; then CORE_DEBUG_MODE_CFLAGS="-g" our_cxxflags_defaults="-Wall -Wno-non-virtual-dtor -fexceptions" else CORE_DEBUG_MODE_CFLAGS="-DNDEBUG" SPECIFIC_LDFLAGS="-s ${SPECIFIC_LDFLAGS}" fi dnl ========================================================================== dnl dnl Check for header files dnl dnl ========================================================================== dnl ========================================================================== dnl Standard header files dnl ========================================================================== AC_CHECK_HEADERS( [malloc.h assert.h], [], [AC_MSG_ERROR(Missing header file)]) case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) AC_CHECK_HEADER( [pthread.h], [], [AC_MSG_ERROR(Missing header file)]) AC_CHECK_HEADER( [time.h], [AC_CHECK_LIB( [rt], [clock_gettime], [], [AC_MSG_ERROR(Missing function: clock_gettime)])], [AC_MSG_ERROR(Missing header file)]) AC_CHECK_HEADER( [dlfcn.h], [AC_CHECK_LIB( [dl], [dlopen], [], [AC_MSG_ERROR(Missing function: dlopen)]) AC_CHECK_LIB( [dl], [dlclose], [], [AC_MSG_ERROR(Missing function: dlclose)]) AC_CHECK_LIB( [dl], [dlsym], [], [AC_MSG_ERROR(Missing function: dlsym)])], [AC_MSG_ERROR(Missing header file)]) ;; [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*) AC_CHECK_HEADERS( [initguid.h objbase.h windows.h vfw.h], [], [AC_MSG_ERROR(Missing header file)]) AC_CHECK_HEADERS( [winbase.h wingdi.h], [], [AC_MSG_ERROR(Missing header file)], [#include ]) ;; esac dnl ========================================================================== dnl STLPORT header and library files dnl ========================================================================== AM_CHECK_STLPORT( [${target_os}], [], [AC_MSG_ERROR("STLport is needed !")]) dnl ========================================================================== dnl BOOST header and library files dnl ========================================================================== AM_CHECK_BOOST( [${BOOST_VERSION}], [${target_os}], [], [AC_MSG_ERROR("Boost is needed !")]) dnl ========================================================================== dnl FFMPEG header and library files dnl ========================================================================== AM_CHECK_FFMPEG( [], [our_cxxflags_defaults="-ansi ${our_cxxflags_defaults}"]) dnl ========================================================================== dnl Gstreamer header and library files dnl ========================================================================== GST_MAJORMINOR=0.8 PKG_CHECK_MODULES( [GST], [gstreamer-$GST_MAJORMINOR >= $GST_REQS], [HAVE_GSTREAMER="yes"], [HAVE_GSTREAMER="no"]) PKG_CHECK_MODULES( [GSTPLUG], [gstreamer-interfaces-$GST_MAJORMINOR >= $GSTPLUG_REQS], [HAVE_GSTPLUG="yes"], [HAVE_GSTPLUG="no"]) AM_GST_ELEMENT_CHECK( [ffmpeg], [HAVE_GSTFFMPEG="yes"], [HAVE_GSTFFMPEG="no"]) case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) if test "${ffmpeg_enable}" = "no" && test "${HAVE_GSTREAMER}" = "no" ; then AC_MSG_ERROR([FFMPEG or Gstreamer support are needed when building Avisynth 3.0 on linux]) fi ;; esac dnl ========================================================================== dnl FREETYPE header and library files dnl ========================================================================== FREETYPE_CONFIG="freetype-config" AC_ARG_WITH( [freetype-config], [--with-freetype-config=FILE freetype-config script to use (eg /usr/bin/freetype-config)], [ FREETYPE_CONFIG=${withval} AC_CHECK_PROG( [FREETYPE_CONFIG_IN_PATH], [${FREETYPE_CONFIG}], [yes], [no]) if test ${FREETYPE_CONFIG_IN_PATH} = no ; then echo "ERROR:" echo "The freetype-config development script you specified:" echo "${FREETYPE_CONFIG}" echo "was not found. Please check the path and make sure " echo "the script exists and is executable." AC_MSG_ERROR([Fatal Error: no freetype-config detected.]) exit; fi with_freetype_arg="yes" FREETYPE_CFLAGS=`${FREETYPE_CONFIG} --cflags` FREETYPE_LIBS=`${FREETYPE_CONFIG} --libs` ], [ AC_CHECK_PROG(FREETYPE_CONFIG_IN_PATH, $FREETYPE_CONFIG, yes, no) if test $FREETYPE_CONFIG_IN_PATH = no; then echo "ERROR:" echo "The freetype-config development script was not found in your execute" echo "path. This may mean one of several things" echo "1. You may not have installed the freetype-devel (or freetype-dev)" echo " packages." echo "2. You may have freetype installed somewhere not covered by your path." echo "" echo "If this is the case make sure you have the packages installed, AND" echo "that the freetype-config script is in your execute path (see your" echo "shell's manual page on setting the \$PATH environment variable), OR" echo "alternatively, specify the script to use with --with-freetype-config." AC_MSG_ERROR([Fatal Error: no freetype-config detected.]) exit; fi with_freetype_arg="yes" FREETYPE_CFLAGS=`${FREETYPE_CONFIG} --cflags` FREETYPE_LIBS=`${FREETYPE_CONFIG} --libs` ]) dnl ========================================================================== dnl Gtk+ header and library files dnl ========================================================================== PROG="" HAVE_GTK="no" GTK_MAJORMINOR=2.0 PKG_CHECK_MODULES( [GTK], [gtk+-$GTK_MAJORMINOR >= $GTK_REQS], [HAVE_GTK="yes"], [HAVE_GTK="no"]) case "$target_os" in *bsd*|linux*|beos|irix*|solaris*) if test "${HAVE_GTK}" = "no" ; then AC_MSG_WARN([Test application not built]) else PROG="avisynth_test" fi ;; esac dnl ========================================================================== dnl x264 header and library files dnl ========================================================================== dnl AM_CHECK_X264( dnl [], dnl [], dnl [AC_MSG_WARN("x264 not found !")]) dnl ========================================================================== dnl dnl Now we can set CXXFLAGS if needed dnl dnl ========================================================================== if test "$force_default_cxx_options" = "yes" ; then CXXFLAGS="$our_cxxflags_defaults" fi dnl ========================================================================== dnl dnl Profiling stuff goes here dnl - adds options to SPECIFIC_CFLAGS, SPECIFIC_LDLAGS dnl - removes incompatible options from CFLAGS dnl dnl ========================================================================== SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS $GNU_PROF_LDFLAGS" SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS $GNU_PROF_CFLAGS" if test "$enable_gnuprofile" = "yes" ; then CFLAGS=`echo $CFLAGS | sed s/'-fomit-frame-pointer'/''/` fi dnl ========================================================================== dnl dnl SOURCES dnl dnl ========================================================================== GENERIC_BIN_SOURCES="SRC_BIN_GENERIC" GENERIC_LIB_SOURCES="SRC_LIB_GENERIC" dnl ========================================================================== dnl dnl Substitions dnl dnl ========================================================================== AC_SUBST(FEATURES) AC_SUBST(ARCHITECTURE) AC_SUBST(SHARED_EXTENSION) AC_SUBST(STATIC_EXTENSION) AC_SUBST(OBJECT_EXTENSION) AC_SUBST(NASM_FORMAT) AC_SUBST(AS) AC_SUBST(AFLAGS) AC_SUBST(ASSEMBLY_EXTENSION) AC_SUBST(GENERIC_SOURCES) AC_SUBST(ASSEMBLY_SOURCES) AC_SUBST(CXX) AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE) AC_SUBST(LDFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(SPECIFIC_CFLAGS) AC_SUBST(SPECIFIC_LDFLAGS) AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) AC_SUBST(CORE_DEBUG_MODE_CFLAGS) AC_SUBST(INSTALL) AC_SUBST(LN_S) AC_SUBST(RANLIB) AC_SUBST(PACKAGE) AC_SUBST(API_MAJOR) AC_SUBST(API_MINOR) AC_SUBST(VERSION) AC_SUBST(STATIC_LIB) AC_SUBST(PRE_SHARED_LIB) AC_SUBST(SHARED_LIB) AC_SUBST(GENERIC_BIN_SOURCES) AC_SUBST(GENERIC_LIB_SOURCES) AC_SUBST(PROG) AC_SUBST(exec_prefix) AC_SUBST(bindir) AC_SUBST(libdir) AC_SUBST(includedir) dnl ========================================================================== dnl dnl Output files dnl dnl ========================================================================== AC_CONFIG_FILES([config.h]) AC_CONFIG_FILES([platform.inc]) AC_CONFIG_FILES([gen_sources.sh], [chmod +x gen_sources.sh && ./gen_sources.sh]) AC_CONFIG_FILES([avisynth-3.0.pc]) AC_OUTPUT ##################################################################### ## Info echo echo "------------------------------------------------------------------------" echo " $PACKAGE $VERSION" echo "------------------------------------------------------------------------" echo echo " OS..................: $target_os" echo echo " Visibility feature..: $visibility" echo " Core debug mode.....: $core_debug_mode" echo " ASM support.........: $assembly" echo echo " FFMPEG support......: $ffmpeg_enable" echo " FFMPEG debug mode...: $ffmpeg_debug_mode" echo echo " Gstreamer support...: $HAVE_GSTREAMER" echo " Gst-Plugin.......: $HAVE_GSTPLUG" echo " Gst-FFmpeg.......: $HAVE_GSTFFMPEG" echo echo " Gtk+................: $HAVE_GTK" echo echo echo " Install path........: $prefix" echo " binaries..........: $bindir" echo " libraries.........: ${libdir}" echo " headers...........: ${includedir}/avisynth-3.0" echo " data..............: ${datadir}/avisynth-3.0" echo echo " Compilation.........: make" echo " Installation........: make install" echo if test x"$HAVE_GSTFFMPEG" = x"no" ; then echo " WARNING: Gst-FFmpeg is not installed. This means that most" echo " of the usual video streams will not be decoded" echo " (xvid, divx, x264 for example). We recommend that" echo " you install it." echo fi