Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[b8d4ed]: configure.ac Maximize Restore History

Download this file

configure.ac    403 lines (357 with data), 13.2 kB

AC_INIT
AC_CONFIG_SRCDIR([src/main.c])

VERSION=0.5.0

AM_CONFIG_HEADER(include/config.h)
AM_INIT_AUTOMAKE(gxine, $VERSION)
AM_MAINTAINER_MODE
dnl AM_ACLOCAL_INCLUDE(m4)

AC_GNU_SOURCE

dnl ---------------------------------------------
dnl Check for programs.
dnl ---------------------------------------------
dnl Save CFLAGS, AC_ISC_POSIX set some unwanted default CFLAGS
saved_CFLAGS="$CFLAGS"
AC_ISC_POSIX
CFLAGS="$saved_CFLAGS"
AC_PROG_CC
AC_HEADER_STDC
dnl AC_ARG_PROGRAM

dnl ---------------------------------------------
dnl Libtool
dnl ---------------------------------------------
AC_LIBTOOL_DLOPEN
AM_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_LD_ASNEEDED

dnl ---------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ---------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t])
AC_C_BIGENDIAN
AC_C_ALWAYS_INLINE

saved_CFLAGS="$CFLAGS"
AC_MSG_CHECKING([whether $CC supports ?: with no middle operand])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[int i = 1 ? : 2;]),
	AC_MSG_RESULT(yes),
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([\?: with no middle operand is required]))
AC_MSG_CHECKING([how to specify C99 with GNU extensions for $CC])
ac_cv_c_gnu99=no
for ac_cv in -std=gnu99; do
  CFLAGS="$saved_CFLAGS $ac_cv"
  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[]),[ac_cv_c_gnu99=$ac_cv; break],)
done
AC_MSG_RESULT($ac_cv_c_gnu99)
if test "$ac_cv_c_gnu99" = "no"; then
  AC_MSG_WARN([there may be build problems])
fi
AC_SUBST(GNU99,$ac_cv_c_gnu99)
CFLAGS="$saved_CFLAGS"

dnl ---------------------------------------------
dnl gettext
dnl ---------------------------------------------
AM_GNU_GETTEXT([external])

ALL_LINGUAS="cs de zh_CN" # pt_BR ru

dnl ---------------------------------------------
dnl Checks for X11
dnl ---------------------------------------------
AC_PATH_XTRA

dnl ---------------------------------------------
dnl Check whether to build the Moz browser plugin
dnl ---------------------------------------------
AC_MSG_CHECKING(whether to build the Mozilla plugin)
AC_ARG_WITH(browser-plugin,
	    AS_HELP_STRING(--without-browser-plugin,
			   [do not build the Mozilla browser plugin]),
	    if test "$withval" = no; then browser_plugin=no; else browser_plugin=yes; fi,
	    browser_plugin=yes)
AC_MSG_RESULT($browser_plugin)
if test "$browser_plugin" = yes; then
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_CHECK_HEADER(X11/Xaw/Form.h,,
       [AC_MSG_ERROR([you need to install libxaw header files (-dev package)])],
       [#include <X11/Intrinsic.h>])
  CPPFLAGS=$saved_CPPFLAGS
fi
AM_CONDITIONAL([BROWSER_PLUGIN], [test "$browser_plugin" = yes])

dnl ---------------------------------------------
dnl check for gtk 2.6 or later
dnl ---------------------------------------------
PKG_CHECK_MODULE_ATLEAST(GLIB2, glib-2.0, 2.6.0)
PKG_CHECK_MODULE_ATLEAST(GTK2, gtk+-2.0, 2.6.0)
PKG_CHECK_MODULE_ATLEAST(GTHREAD2, gthread-2.0, 2.6.0)

saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB2_CFLAGS"
LIBS="$LIBS $GLIB2_LIBS"
AC_CACHE_CHECK([whether glib uses the system malloc by default],
  gxine_glib_system_malloc,
  AC_RUN_IFELSE([
#include <glib.h>
int main ()
{
  return g_mem_is_system_malloc () ? 0 : 'n';
}
],
    gxine_glib_system_malloc=yes,
    [if test $? != 110; then
	AC_MSG_FAILURE([failed to run test])
     fi
     gxine_glib_system_malloc=no
    ],
    gxine_glib_system_malloc=no),
)
if test "$gxine_glib_system_malloc" = "yes"; then
  AC_DEFINE(GLIB_USES_SYSTEM_MALLOC, 1,
	    [Define if glib uses the system malloc by default.])
fi
CFLAGS="$saved_CFLAGS"
LIBS="$saved_LIBS"

dnl ---------------------------------------------
dnl DPMS Extension
dnl ---------------------------------------------
AC_CHECK_LIB(Xtst, DPMSQueryExtension, 
	     AC_DEFINE(HAVE_DPMS_EXTENSION,,[Define this to use DPMS to defeat the screen blanker])
	     ac_have_dpms="yes", ac_have_dpms="no", $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
AM_CONDITIONAL([HAVE_DPMS_EXTENSION], [test x$ac_have_dpms = "xyes"])

dnl ---------------------------------------------
dnl XTest Extension
dnl ---------------------------------------------
AC_ARG_ENABLE(defeat-screensaver-via-xtest,
	    AS_HELP_STRING(--enable-defeat-screensaver-via-xtest,
			   [enable defeating the screen blanker via fake key presses (if XTest is supported)]),
	    if test "x$enableval" = xno; then xtest=no; else xtest=yes; fi,
	    xtest=no)
if test "$xtest" = yes; then
  AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, 
	       XTEST_LIBS="-lXtst"
	       AC_DEFINE(HAVE_XTESTEXTENSION,,[Define this to use XTest to defeat the screen blanker (requires libXtst)])
	       ac_have_xtest="yes", ac_have_xtest="no", $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
  AC_SUBST(XTEST_LIBS)
else
  ac_have_xtest=no
fi
AM_CONDITIONAL([HAVE_XTESTEXTENSION], [test x$ac_have_xtest = "xyes"])

dnl ---------------------------------------------
dnl Xinerama Extension
dnl ---------------------------------------------
saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK2_CFLAGS"
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
             AC_DEFINE(HAVE_XINERAMA,,[Define this if you have libXinerama])
	     ac_have_xinerama="yes", ac_have_xinerama="no", $X_LIBS $X_PRE_LIBS -lXinerama $X_EXTRA_LIBS)
AM_CONDITIONAL([HAVE_XINERAMA], [test x$ac_have_xinerama = "xyes"])
CFLAGS="$saved_CFLAGS"
LIBS="$saved_LIBS"

dnl ---------------------------------------------
dnl debug cflags
dnl ---------------------------------------------
AC_SUBST(DEBUG_CFLAGS)
DEBUG_CFLAGS="$CFLAGS -g -O0 -DDEBUG -Wall -D_GNU_SOURCE"

dnl ---------------------------------------------
dnl threads
dnl ---------------------------------------------

case $host in
  *-*-freebsd*)
    THREAD_LIBS="-pthread"
    CFLAGS="$CFLAGS -I/usr/local/include -L/usr/local/lib -D_THREAD_SAFE"
    DEBUG_CFLAGS="$DEBUG_CFLAGS"
    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
    LDFLAGS="$LDFLAGS -L/usr/local/lib"
    ;;
  *)
    AC_CHECK_LIB(pthread, pthread_create,
             THREAD_LIBS="-lpthread",
             AC_MSG_ERROR(pthread needed))
    ;;
esac
AC_SUBST(THREAD_LIBS)

dnl ---------------------------------------------
dnl Check for xine-lib
dnl ---------------------------------------------
AM_PATH_XINE(1.0.1,, AC_MSG_ERROR(*** Please install xine-lib first ***))

dnl Extract xine-lib's text domain name
LIB_PACKAGE="libxine`echo '#define ENABLE_NLS
  #include <xine/xine_internal.h>
  XINE_MAJOR_VERSION' | $CPP $CPPFLAGS - | sed -e '$! d; s/^ \+//'`"
if test "$LIB_PACKAGE" = ''; then
  AC_MSG_ERROR([Couldn't determine xine-lib's text domain name])
fi
AC_DEFINE_UNQUOTED(LIB_PACKAGE,"$LIB_PACKAGE",[xine-lib's text domain name])

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

dnl ---------------------------------------------
dnl Check for lirc
dnl ---------------------------------------------
AC_CHECK_LIRC

dnl ---------------------------------------------
dnl Check for GNU getopt_long()
dnl ---------------------------------------------
AC_MSG_CHECKING(for GNU getopt_long)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>

static struct option long_options[] = {
  {"help"    , no_argument, 0, 1 },
  {"version" , no_argument, 0, 2 },
  {0         , no_argument, 0, 0 }
};

int main (int argc, char **argv) {
  int option_index = 0;
  int c;
  opterr = 0;
  while ((c = getopt_long (argc, argv, "?hv", 
			   long_options, &option_index)) != EOF)
    ;
  return 0;
}
	],
	[AC_MSG_RESULT(yes); 
	 ac_getopt_long=yes;
	 AC_DEFINE(HAVE_GETOPT_LONG,,[Define this if you have GNU getopt_long() implemented])],
	[AC_MSG_RESULT(no); ac_getopt_long=no],
	[AC_MSG_RESULT(no); ac_getopt_long=no])
AM_CONDITIONAL(HAVE_GETOPT_LONG, test x"$ac_getopt_long" = "xyes")

dnl ---------------------------------------------
dnl Check for libsmjs (spidermonkey)
dnl ---------------------------------------------
  dnl Check for Spidermonkey in two locations.
  dnl This is necessary because in Debian, libjs.so is already taken by the
  dnl NGS Javascript interpreter (ngs-js); consequently, the Spidermonkey
  dnl library is named libsmjs.so and has its include files in
  dnl /usr/include/smjs rather than /usr/include/js.
  AC_CHECK_HEADER([smjs/jsapi.h],
		  [JS_LIBS=-lsmjs
		   AC_DEFINE(HAVE_LIBSMJS, 1,
			     [Define if you have smjs/jsapi.h or js/api.h])
		  ],
		  [AC_CHECK_HEADER([js/jsapi.h],
				   [JS_LIBS=-ljs
				    AC_DEFINE(HAVE_LIBSMJS, 1,
					[Define if you have smjs/jsapi.h or js/api.h])
				    AC_DEFINE(LIBJS_IS_SMJS, 1,
					[Define if you have <js/jsapi.h> rather than <smjs/jsapi.h>])
				   ],
				   [AC_MSG_ERROR([libjs not found])],
				   [#define XP_UNIX])
		  ],
		  [#define XP_UNIX])
AC_SUBST(JS_LIBS)

dnl ---------------------------------------------
dnl Miscellaneous build flags
dnl ---------------------------------------------

dnl AC_MSG_CHECKING([for requested GTK+ compatibility])
dnl AC_ARG_ENABLE(gtk-compat,
dnl 	    AS_HELP_STRING(--disable-gtk-compat,
dnl 			   [don't be compatible with older GTK+ or automatically use features from newer GTK+]),
dnl 	    if test "$enableval" = no; then gtkcompat=no; else gtkcompat=yes;dnl  fi,
dnl 	    gtkcompat=yes)
dnl if test "$gtkcompat" = yes; then
dnl   AC_DEFINE(GXINE_GTK_COMPAT, 1,
dnl 	    [Define if you want compatibility with older GTK+ and automatic use of some features in newer GTK+])
dnl   AC_MSG_RESULT([2.2, using newer features if available at runtime])
dnl else
dnl   AC_MSG_RESULT([installed version, using no newer features (except menu icons)])
dnl fi

AC_MSG_CHECKING([whether to use the integration wizard])
AC_ARG_ENABLE(integration-wizard,
	    AS_HELP_STRING(--disable-integration-wizard,
			   [don't configure other applications to use gxine (for packagers)]),
	    if test "$enableval" = no; then integrate=no; else integrate=yes; fi,
	    integrate=yes)
if test "$integrate" = yes; then
  AC_DEFINE(USE_INTEGRATION_WIZARD, 1,
	    [Define if you want gxine to be able to configure other apps to use it])
fi
AC_MSG_RESULT($integrate)

AC_MSG_CHECKING([whether to include deprecated features])
AC_ARG_ENABLE(deprecated,
	    AS_HELP_STRING(--disable-deprecated,
			   [exclude deprecated features, e.g. old Javascript functions]),
	    if test "$enableval" = no; then deprecated=no; else deprecated=yes; fi,
	    deprecated=yes)
if test "$deprecated" = yes; then
  AC_DEFINE(WITH_DEPRECATED, 1,
	    [Define if you want gxine to be built with deprecated features])
fi
AC_MSG_RESULT($integrate)

dnl ---------------------------------------------
dnl it seems automake 1.5 doesn't take care about this script
dnl ---------------------------------------------
if test ! -z $am_depcomp; then
	DEPCOMP="depcomp"
fi
AC_SUBST(DEPCOMP)


dnl ---------------------------------------------
dnl where to install the browser plugin
dnl ---------------------------------------------

if test "x$prefix" = xNONE; then
   prefix="${ac_default_prefix}"
fi
if test "x$exec_prefix" = xNONE; then
   exec_prefix='${prefix}'
fi

GXINE_PLUGINDIR="$libdir/gxine"
eval GXINE_PLUGINPATH=`eval echo "$GXINE_PLUGINDIR"`
AC_DEFINE_UNQUOTED(GXINE_PLUGINDIR,"$GXINE_PLUGINPATH",[where to install the browser plugin])
AC_SUBST(GXINE_PLUGINPATH)

GXINE_BINDIR="$bindir"
eval GXINE_BINPATH=`eval echo "$GXINE_BINDIR"`
AC_DEFINE_UNQUOTED(GXINE_BINDIR,"$GXINE_BINPATH",[where to install the binary])
AC_SUBST(GXINE_BINPATH)

GXINE_LOGODIR="$datadir/gxine"
eval GXINE_LOGOPATH=`eval echo "$GXINE_LOGODIR"`
AC_DEFINE_UNQUOTED(GXINE_LOGODIR,"$GXINE_LOGOPATH",[where to install the logo])
AC_SUBST(GXINE_LOGOPATH)

GXINE_PIXMAPDIR="$datadir/gxine/pixmaps"
eval GXINE_PIXMAPPATH=`eval echo "$GXINE_PIXMAPDIR"`
AC_DEFINE_UNQUOTED(GXINE_PIXMAPDIR,"$GXINE_PIXMAPPATH",[where to install pixmaps])
AC_SUBST(GXINE_PIXMAPPATH)

GXINE_ICONDIR="$datadir/pixmaps"
eval GXINE_ICONPATH=`eval echo "$GXINE_ICONDIR"`
AC_DEFINE_UNQUOTED(GXINE_ICONDIR,"$GXINE_ICONPATH",[where to install desktop icons])
AC_SUBST(GXINE_ICONPATH)

GXINE_MISCDIR="$datadir/gxine"
eval GXINE_MISCPATH=`eval echo "$GXINE_MISCDIR"`
AC_DEFINE_UNQUOTED(GXINE_MISCDIR,"$GXINE_MISCPATH",[where to install misc files (e.g. sample mediamarks)])
AC_SUBST(GXINE_MISCPATH)

GXINE_CONFDIR="$sysconfdir/gxine"
eval GXINE_CONFPATH=`eval echo "$GXINE_CONFDIR"`
AC_DEFINE_UNQUOTED(GXINE_CONFDIR,"$GXINE_CONFPATH",[where to install conf files])
AC_SUBST(GXINE_CONFPATH)

POST_VERSION=release
if test -d CVS || expr "$VERSION" : '.*-dev$' \| "$VERSION" : '.*-dev-.*$'; then
  POST_VERSION='CVS snapshot'
fi
VENDOR_PKG_VERSION="${VENDOR_PKG_VERSION:-$POST_VERSION}"
AC_MSG_NOTICE([using build identifier: "$VENDOR_PKG_VERSION"])
AC_DEFINE_UNQUOTED(VENDOR_PKG_VERSION,"$VENDOR_PKG_VERSION",[package build identifier, e.g. vendor name and package version])

AC_CONFIG_FILES([
Makefile
src/Makefile
browser-plugin/Makefile
pixmaps/Makefile
doc/Makefile
doc/man/Makefile
doc/man/de/Makefile
doc/man/en/Makefile
include/Makefile
m4/Makefile
misc/Makefile
misc/build_rpms.sh
misc/gxine.spec
misc/po/Makefile.in
po/Makefile.in
])

dnl doc/C/Makefile
AC_CONFIG_COMMANDS([default],[[chmod +x ./misc/build_rpms.sh]],[[]])
AC_OUTPUT