# Process this file with autoconf to produce a configure script. AC_INIT(browser_plugin, 0.0.1.svn) AC_CONFIG_SRCDIR([src/plugin.cpp]) AC_PREREQ(2.53) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) SHARED_VERSION_INFO="1:0:0" SHLIB_VERSION_ARG="" # Checks for programs AC_PROG_CC AC_PROG_CXX AC_PROG_LIBTOOL AC_PROG_INSTALL AC_PROG_MAKE_SET AC_C_CONST AC_C_BIGENDIAN dnl Add parameters for aclocal AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") dnl Overall configuration success flag browser_plugin_config_ok=yes dnl dnl Configure for target platform dnl case "$target_os" in linux* | solaris*) SHLIB_VERSION_ARG="-Wl,--version-script=Version_script" AC_SUBST(PLATFORM,"linux") ;; *) ;; esac dnl dnl Detect liboggplay dnl PKG_CHECK_MODULES(OGGPLAY, oggplay) AC_SUBST(OGGPLAY_CFLAGS) AC_SUBST(OGGPLAY_LIBS) dnl dnl Detect Imlib2 (needed for the linux plugin) dnl PKG_CHECK_MODULES(IMLIB2, imlib2) AC_SUBST(IMLIB2_LIBS) AC_SUBST(IMLIB2_CFLAGS) dnl dnl Detect alsa dnl PKG_CHECK_MODULES(ALSA, alsa, HAVE_ALSA=yes, HAVE_ALSA=no) AC_SUBST(ALSA_CFLAGS) AC_SUBST(ALSA_LIBS) dnl dnl Detect pulseaudio dnl PKG_CHECK_MODULES(PULSE, libpulse, HAVE_PULSE=yes, HAVE_PULSE=no) AC_SUBST(PULSE_CFLAGS) AC_SUBST(PULSE_LIBS) dnl dnl alsa backend configure option dnl AC_ARG_WITH(alsa, [ --with-alsa Use ALSA audio backend], [ case "$withval" in no) ;; *) HAVE_ALSA=yes HAVE_PULSE=no ;; esac] ) dnl dnl oss backend configure option dnl AC_ARG_WITH(oss, [ --with-oss Use OSS audio backend], [ case "$withval" in no) ;; *) HAVE_ALSA=no HAVE_PULSE=no ;; esac] ) AUDIO_BACKEND=oss if test "x$HAVE_ALSA" = "xyes"; then AUDIO_BACKEND=alsa fi if test "x$HAVE_PULSE" = "xyes"; then AUDIO_BACKEND=pulse fi AM_CONDITIONAL(HAVE_ALSA, test "x$AUDIO_BACKEND" = "xalsa") AM_CONDITIONAL(HAVE_PULSE, test "x$AUDIO_BACKEND" = "xpulse") dnl dnl Detect Firefox (needed for the linux plugin) dnl AC_ARG_WITH(gecko-sdk, AC_HELP_STRING([--with-gecko-sdk=SOURCE_DIR], [Path to Gecko sdk tree])) if test "x$with_gecko_sdk" != x -a "x$with_gecko_sdk" != xyes -a "x$with_gecko_sdk" != xno ; then FIREFOX_LIBS="-L$with_gecko_sdk/lib" FIREFOX_CFLAGS="-I$with_gecko_sdk/include" else PKG_CHECK_MODULES(FIREFOX, firefox-plugin firefox-xpcom firefox-nspr firefox-nss nspr nss) fi AC_SUBST(FIREFOX_LIBS) AC_SUBST(FIREFOX_CFLAGS) AC_ARG_WITH(xpidl, AC_HELP_STRING([--with-xpidl=SOURCE_DIR], [Path to XPIDL binary])) if test "x$with_xpidl" != x -a "x$with_xpidl" != xyes -a "x$with_xpidl" != xno ; then XPIDL="$with_xpidl" else if test "x$with_gecko_sdk" != x -a "x$with_gecko_sdk" != xyes -a "x$with_gecko_sdk" != xno ; then XPIDL="$with_gecko_sdk/bin/xpidl" else XPIDL=/usr/lib/firefox/xpidl fi fi AC_ARG_WITH(xpidl_include, AC_HELP_STRING([--with-xpidl_include=INCLUDE_DIR], [Path to XPIDL include dir])) if test "x$with_xpidl_include" != x -a "x$with_xpidl_include" != xyes -a "x$with_xpidl_include" != xno ; then XPIDL_INCLUDE=-I"$with_xpidl_include" else if test "x$with_gecko_sdk" != x -a "x$with_gecko_sdk" != xyes -a "x$with_gecko_sdk" != xno ; then XPIDL_INCLUDE=-I"$with_gecko_sdk/idl" else XPIDL_INCLUDE=-I/usr/share/idl/firefox fi fi AC_SUBST(XPIDL) AC_SUBST(XPIDL_INCLUDE) dnl dnl Detect X11 dnl AC_PATH_XTRA AC_SUBST(X_CFLAGS) AC_SUBST(X_LDFLAGS) AC_SUBST(X_LIBS) AC_SUBST(X_EXTRA_LIBS) dnl dnl Detect GTK (needed for the linux plugin) dnl PKG_CHECK_MODULES(GTK, gtk+-2.0) AC_SUBST(GTK_LIBS) AC_SUBST(GTL_CFLAGS) dnl dnl Detect pthreads libraries dnl PTHREAD_LIBS=error AC_CHECK_LIB(pthread, pthread_attr_init, PTHREAD_LIBS="-lpthread") if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_LIB(pthreads, pthread_attr_init, PTHREAD_LIBS="-lpthreads") fi if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_LIB(c_r, pthread_attr_init, PTHREAD_LIBS="-lc_r") fi if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="") fi AC_SUBST(PTHREAD_LIBS) SEMAPHORE_LIBS="-lpthread" AC_SUBST(SEMAPHORE_LIBS) dnl Use -Wall if we have gcc. dnl changequote(,)dnl if test "x$ac_cv_prog_gcc" = xyes ; then CFLAGS="$CFLAGS -Wall -g" fi dnl changequote([,])dnl dnl Define __SSE2__ to include MMX intrinsics (SSE2) code. dnl Sets also SSE2_CFLAGS for the compile time. SSE2_CFLAGS="-msse2 -march=pentium3" have_mmx_intrinsics=no AC_MSG_CHECKING(For MMX/SSE intrinsics in the compiler) libbrowser_plugin_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $SSE2_CFLAGS" AC_COMPILE_IFELSE([ #if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)) #error "Need GCC >= 3.4 for MMX SSE2 intrinsics" #endif #include int main () { __m64 zero =_mm_setzero_si64(); __m64 ut = _m_from_int(0); __m64 vt = _m_from_int(0); ut = _m_punpcklbw(ut, zero); vt = _m_punpcklbw(vt, zero); vt = _mm_or_si64 (ut, vt); return _mm_cvtsi64_si32 (vt); }], have_mmx_intrinsics=yes) CFLAGS=$libbrowser_plugin_save_CFLAGS AC_MSG_RESULT($have_mmx_intrinsics) if test $have_mmx_intrinsics = yes ; then AC_DEFINE(__SSE2__, 1, [use MMX SSE2 compiler intrinsics]) else SSE2_CFLAGS= fi AC_SUBST(SSE2_CFLAGS) AM_CONDITIONAL(__SSE2__, test $have_mmx_intrinsics = yes) dnl dnl Configuration tests complete -- provide summary of results. dnl if test $browser_plugin_config_ok = no ; then AC_MSG_RESULT([ ************************************************************** *** $PACKAGE $VERSION: Automatic configuration FAILED. *** The file config.log has full details. *** The following required libraries are missing or *** misconfigured on your system: ]) if test "x$HAVE_OGGPLAY" != xyes ; then AC_MSG_RESULT( [*** liboggplay, available from http://svn.annodex.net/liboggplay/trunk]) fi AC_MSG_RESULT( [*** If you install the required libraries from source, you *** need to inform the dynamic linker of their location. If *** you install them in a system-wide directory such as *** /usr/local (the default), you must ensure that *** /usr/local/lib is listed in /etc/ld.so.conf, then run *** ldconfig to update the dynamic linking system. *** Alternatively, you can set your LD_LIBRARY_PATH environment *** variable to include the library installation directory. ]) AC_MSG_RESULT( [************************************************************** ]) AC_MSG_ERROR([ *** *** After fixing the above problems, you must run ./configure again. *** ]) else AC_SUBST(SHLIB_VERSION_ARG) AC_SUBST(SHARED_VERSION_INFO) AS_AC_EXPAND(LIBDIR, ${libdir}) AS_AC_EXPAND(INCLUDEDIR, ${includedir}) AS_AC_EXPAND(BINDIR, ${bindir}) AC_OUTPUT([ Makefile src/Makefile ]) AC_MSG_RESULT([ ------------------------------------------------------------------------ $PACKAGE $VERSION: Automatic configuration OK. Browser plugin: $oggplay_plugin Installation paths: browser_plugin: .................. ${LIBDIR} audio backend: .................. ${AUDIO_BACKEND} Building: Type 'make' to compile $PACKAGE. Type 'make install' to install $PACKAGE. ------------------------------------------------------------------------ ]) fi