AC_INIT(sabbu, [0.3.0], [kryptolus@gmail.com]) AM_INIT_AUTOMAKE(sabbu, 0.3.0) AC_CONFIG_HEADER(Source/config.h) AC_PREREQ([2.59]) AC_CONFIG_SRCDIR([Source/sabbu.cpp]) AC_ARG_WITH(ffmpeg, [ --without-ffmpeg disable video features], [DISABLE_FFMPEG=1 AC_DEFINE([DISABLE_FFMPEG], [], [Disables compilation against ffmpeg])]) AC_ARG_WITH(oss, [ --with-oss use OSS even if ALSA is available], [PREFER_OSS=1 AC_DEFINE([PREFER_OSS], [], [Use OSS even if ALSA is available])]) AC_ARG_ENABLE(Werror, [ --enable-Werror treat warnings as errors]) AC_PROG_CC AC_PROG_CXX #AC_PROG_LIBTOOL #LIBTOOL="$LIBTOOL --silent" AC_PROG_INSTALL AC_PROG_MAKE_SET AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.10.40) AM_PATH_GTK_2_0(2.0.0, , AC_MSG_ERROR(Cannot find GTK2: Is pkg-config in path?)) AM_PATH_GTK_2_0(2.6.0, , AC_MSG_ERROR(sabbu requires at least GTK 2.6 (older version of GTK detected))) AC_CHECK_LIB([gthread-2.0], [g_thread_init], [THREAD_LIBS=`pkg-config gthread-2.0 --libs`], AC_MSG_ERROR([gthread is required to build sabbu.])) AC_LANG([C++]) if test x"$with_ffmpeg" != x"no" ; then AC_CHECK_LIB([avcodec], [avcodec_open], [FFMPEG_LIBS="-lavformat -lavcodec"], AC_MSG_ERROR([ffmpeg >= 0.4.9-pre1 is required for video features. You may specify --without-ffmpeg to disable video features.])) AC_CHECK_LIB([avformat], [av_seek_frame], [FFMPEG_LIBS="-lavformat -lavcodec"], AC_MSG_ERROR([ffmpeg >= 0.4.9-pre1 is required for video features. You may specify --without-ffmpeg to disable video features.]), [-lavcodec]) AC_MSG_CHECKING([whether av_seek_frame takes 3 or 4 parameters]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[av_seek_frame(NULL, 0, 0);exit(0);]])], [AC_MSG_RESULT([3])], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[av_seek_frame(NULL, 0, 0, 0);exit(0);]])], [ # 4 parameter version works AC_MSG_RESULT([4]) AC_DEFINE([FFMPEG_SEEK_PARAM4], [], [The ffmpeg av_seek_frame function requires 4 parameters]) ], [ #4 parameter version failed too AC_MSG_RESULT([neither]) AC_MSG_ERROR([The ffmpeg library could not be compiled against. Please check config.log for details. You may disable ffmpeg with --without-ffmpeg.]) ])) fi AC_MSG_CHECKING([whether the second parameter to iconv() must be const]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[iconv_t handle; char *b1; char *b2; iconv(handle, &b1, (size_t *) 0, &b2, (size_t *) 0);exit(0);]])], [AC_MSG_RESULT([no])], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[iconv_t handle; const char *b1; char *b2; iconv(handle, &b1, (size_t *) 0, &b2, (size_t *)0);exit(0);]])], [ # const parameter version works AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST_INBUFFER], [], [The second parameter to iconv() must be const char*]) ], [ #4 parameter version failed too AC_MSG_RESULT([error]) AC_MSG_ERROR([iconv was not usable. Please check config.log for details.]) ])) AC_CHECK_LIB([sndfile], [sf_open], [SNDFILE_LIBS="-lsndfile"], AC_MSG_ERROR([libsndfile is required to build sabbu.])) AC_CHECK_HEADERS([CoreAudio/CoreAudio.h], [AUDIO_OBJS="sound_coreaudio.o";AUDIO_LIBS="-framework CoreAudio -framework AudioUnit -framework Carbon"]) if [[ -z "${AUDIO_OBJS}" ]]; then if test x"$with_oss" != x"yes" ; then AC_CHECK_LIB([asound], [snd_pcm_open], [AUDIO_OBJS="sound_alsa.o";AUDIO_LIBS="-lasound"]) fi fi if [[ -z "${AUDIO_OBJS}" ]]; then AC_CHECK_HEADER([sys/soundcard.h], [AUDIO_OBJS="sound_oss.o";AUDIO_LIBS=""]) fi if [[ -z "${AUDIO_OBJS}" ]]; then AC_MSG_ERROR([ALSA or OSS is required to build sabbu.]) fi if test "x$GCC" = "xyes"; then if test "x$enable_Werror" = "xyes"; then CPPFLAGS="$CPPFLAGS -Wall -Werror" else CPPFLAGS="$CPPFLAGS -Wall" fi CPPFLAGS="$CPPFLAGS -fno-common" fi AC_SUBST(CURL_LIBS) AC_SUBST(THREAD_LIBS) AC_SUBST(FFMPEG_LIBS) AC_SUBST(SNDFILE_LIBS) AC_SUBST(ALSA_LIBS) AC_SUBST(AUDIO_LIBS) AC_SUBST(AUDIO_OBJS) AC_SUBST(ASPELL_LIBS) CPPFLAGS="$CPPFLAGS $XML_CFLAGS" LIBS="$LIBS $XML_LIBS" SABBUCLEANFILES="*.obj *.ilk *.sbr *.pdb *.bsc *.res *.idb *.exe *.dll *.plg *.exp *.lib *.pch *~ .*~ *.aps *.ncb" AC_SUBST([SABBUCLEANFILES]) AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h locale.h stddef.h stdlib.h string.h unistd.h]) AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_STAT AC_CHECK_FUNCS([dup2 memset mkdir pow sqrt strcasecmp strchr strdup strerror strstr strtol strtoul]) AC_CONFIG_FILES([Makefile Source/Makefile Images/Makefile po/Makefile.in]) AC_OUTPUT