summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2010-10-21 21:49:53 (GMT)
committerAndreas Oberritter <obi@opendreambox.org>2010-11-16 15:08:51 (GMT)
commitc97e30c087c5435db3861d53f89fd59576be03f6 (patch)
treec71cefeb73d9e04e35170b12dc5d82e5cdb41b5d /m4
parentfb91533bb1d293bdb0691bfcc1d15da9268782fe (diff)
move m4 macros to subdirectory, update ax_python_devel.m4
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_python_devel.m4325
-rw-r--r--m4/tuxbox.m4361
2 files changed, 686 insertions, 0 deletions
diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4
new file mode 100644
index 0000000..a62b860
--- /dev/null
+++ b/m4/ax_python_devel.m4
@@ -0,0 +1,325 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PYTHON_DEVEL([version])
+#
+# DESCRIPTION
+#
+# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
+# in your configure.ac.
+#
+# This macro checks for Python and tries to get the include path to
+# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
+# output variables. It also exports $(PYTHON_EXTRA_LIBS) and
+# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
+#
+# You can search for some particular version of Python by passing a
+# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
+# note that you *have* to pass also an operator along with the version to
+# match, and pay special attention to the single quotes surrounding the
+# version number. Don't use "PYTHON_VERSION" for this: that environment
+# variable is declared as precious and thus reserved for the end-user.
+#
+# This macro should work for all versions of Python >= 2.1.0. As an end
+# user, you can disable the check for the python version by setting the
+# PYTHON_NOVERSIONCHECK environment variable to something else than the
+# empty string.
+#
+# If you need to use this macro for an older Python version, please
+# contact the authors. We're always open for feedback.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
+# Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
+# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
+# Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>
+# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
+# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 8
+
+AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
+AC_DEFUN([AX_PYTHON_DEVEL],[
+ #
+ # Allow the use of a (user set) custom python version
+ #
+ AC_ARG_VAR([PYTHON_VERSION],[The installed Python
+ version to use, for example '2.3'. This string
+ will be appended to the Python interpreter
+ canonical name.])
+
+ AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
+ if test -z "$PYTHON"; then
+ AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for a version of Python >= 2.1.0
+ #
+ AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[[0]]; \
+ print (ver >= '2.1.0')"`
+ if test "$ac_supports_python_ver" != "True"; then
+ if test -z "$PYTHON_NOVERSIONCHECK"; then
+ AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([
+This version of the AC@&t@_PYTHON_DEVEL macro
+doesn't work properly with versions of Python before
+2.1.0. You may need to re-run configure, setting the
+variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
+PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
+Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
+to something else than an empty string.
+])
+ else
+ AC_MSG_RESULT([skip at user request])
+ fi
+ else
+ AC_MSG_RESULT([yes])
+ fi
+
+ #
+ # if the macro parameter ``version'' is set, honour it
+ #
+ if test -n "$1"; then
+ AC_MSG_CHECKING([for a version of Python $1])
+ ac_supports_python_ver=`$PYTHON -c "import sys; \
+ ver = sys.version.split ()[[0]]; \
+ print (ver $1)"`
+ if test "$ac_supports_python_ver" = "True"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([this package requires Python $1.
+If you have it installed, but it isn't the default Python
+interpreter in your system path, please pass the PYTHON_VERSION
+variable to configure. See ``configure --help'' for reference.
+])
+ PYTHON_VERSION=""
+ fi
+ fi
+
+ #
+ # Check if you have distutils, else fail
+ #
+ AC_MSG_CHECKING([for the distutils Python package])
+ ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+ if test -z "$ac_distutils_result"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "distutils".
+Please check your Python installation. The error was:
+$ac_distutils_result])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # Check for Python include path
+ #
+ AC_MSG_CHECKING([for Python include path])
+ if test -z "$PYTHON_CPPFLAGS"; then
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_inc ());"`
+ if test -n "${python_path}"; then
+ python_path="-I$python_path"
+ fi
+ PYTHON_CPPFLAGS=$python_path
+ fi
+ AC_MSG_RESULT([$PYTHON_CPPFLAGS])
+ AC_SUBST([PYTHON_CPPFLAGS])
+
+ #
+ # Check for Python library path
+ #
+ AC_MSG_CHECKING([for Python library path])
+ if test -z "$PYTHON_LDFLAGS"; then
+ # (makes two attempts to ensure we've got a version number
+ # from the interpreter)
+ ac_python_version=`cat<<EOD | $PYTHON -
+
+# join all versioning strings, on some systems
+# major/minor numbers could be in different list elements
+from distutils.sysconfig import *
+ret = ''
+for e in get_config_vars ('VERSION'):
+ if (e != None):
+ ret += e
+print (ret)
+EOD`
+
+ if test -z "$ac_python_version"; then
+ if test -n "$PYTHON_VERSION"; then
+ ac_python_version=$PYTHON_VERSION
+ else
+ ac_python_version=`$PYTHON -c "import sys; \
+ print (sys.version[[:3]])"`
+ fi
+ fi
+
+ # Make the versioning information available to the compiler
+ AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
+ [If available, contains the Python version number currently in use.])
+
+ # First, the library directory:
+ ac_python_libdir=`cat<<EOD | $PYTHON -
+
+# There should be only one
+import distutils.sysconfig
+for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
+ if e != None:
+ print (e)
+ break
+EOD`
+
+ # Before checking for libpythonX.Y, we need to know
+ # the extension the OS we're on uses for libraries
+ # (we take the first one, if there's more than one fix me!):
+ ac_python_soext=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
+
+ # Now, for the library:
+ ac_python_soname=`$PYTHON -c \
+ "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
+
+ # Strip away extension from the end to canonicalize its name:
+ ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
+
+ # This small piece shamelessly adapted from PostgreSQL python macro;
+ # credits goes to momjian, I think. I'd like to put the right name
+ # in the credits, if someone can point me in the right direction... ?
+ #
+ if test -n "$ac_python_libdir" -a -n "$ac_python_library" \
+ -a x"$ac_python_library" != x"$ac_python_soname"
+ then
+ # use the official shared library
+ ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library"
+ else
+ # old way: use libpython from python_configdir
+ ac_python_libdir=`$PYTHON -c \
+ "from distutils.sysconfig import get_python_lib as f; \
+ import os; \
+ print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
+ PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
+ fi
+
+ if test -z "PYTHON_LDFLAGS"; then
+ AC_MSG_ERROR([
+ Cannot determine location of your Python DSO. Please check it was installed with
+ dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand.
+ ])
+ fi
+ fi
+ AC_MSG_RESULT([$PYTHON_LDFLAGS])
+ AC_SUBST([PYTHON_LDFLAGS])
+
+ #
+ # Check for site packages
+ #
+ AC_MSG_CHECKING([for Python site-packages path])
+ if test -z "$PYTHON_SITE_PKG"; then
+ PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
+ print (distutils.sysconfig.get_python_lib(0,0));"`
+ fi
+ AC_MSG_RESULT([$PYTHON_SITE_PKG])
+ AC_SUBST([PYTHON_SITE_PKG])
+
+ #
+ # libraries which must be linked in when embedding
+ #
+ AC_MSG_CHECKING(python extra libraries)
+ if test -z "$PYTHON_EXTRA_LIBS"; then
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
+ fi
+ AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
+ AC_SUBST(PYTHON_EXTRA_LIBS)
+
+ #
+ # linking flags needed when embedding
+ #
+ AC_MSG_CHECKING(python extra linking flags)
+ if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+ conf = distutils.sysconfig.get_config_var; \
+ print (conf('LINKFORSHARED'))"`
+ fi
+ AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
+ AC_SUBST(PYTHON_EXTRA_LDFLAGS)
+
+ #
+ # final check to see if everything compiles alright
+ #
+ AC_MSG_CHECKING([consistency of all components of python development environment])
+ # save current global flags
+ ac_save_LIBS="$LIBS"
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
+ CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
+ AC_LANG_PUSH([C])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[#include <Python.h>]],
+ [[Py_Initialize();]])
+ ],[pythonexists=yes],[pythonexists=no])
+ AC_LANG_POP([C])
+ # turn back to default flags
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBS="$ac_save_LIBS"
+
+ AC_MSG_RESULT([$pythonexists])
+
+ if test ! "x$pythonexists" = "xyes"; then
+ AC_MSG_FAILURE([
+ Could not link test program to Python. Maybe the main Python library has been
+ installed in some non-standard library path. If so, pass it to configure,
+ via the LDFLAGS environment variable.
+ Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
+ ============================================================================
+ ERROR!
+ You probably have to install the development version of the Python package
+ for your distribution. The exact name of this package varies among them.
+ ============================================================================
+ ])
+ PYTHON_VERSION=""
+ fi
+
+ #
+ # all done!
+ #
+])
diff --git a/m4/tuxbox.m4 b/m4/tuxbox.m4
new file mode 100644
index 0000000..fb3b7d9
--- /dev/null
+++ b/m4/tuxbox.m4
@@ -0,0 +1,361 @@
+AC_DEFUN([TUXBOX_APPS],[
+
+INSTALL="$INSTALL -p"
+
+AC_GNU_SOURCE
+AC_SYS_LARGEFILE
+
+AC_ARG_WITH(target,
+ [ --with-target=TARGET target for compilation [[native,cdk]]],
+ [TARGET="$withval"],[TARGET="native"])
+
+AC_ARG_WITH(targetprefix,
+ [ --with-targetprefix=PATH prefix relative to target root (only applicable in cdk mode)],
+ [targetprefix="$withval"],[targetprefix="NONE"])
+
+AC_ARG_WITH(debug,
+ [ --without-debug disable debugging code],
+ [DEBUG="$withval"],[DEBUG="yes"])
+
+if test "$DEBUG" = "yes"; then
+ DEBUG_CFLAGS="-g3 -ggdb"
+ AC_DEFINE(DEBUG,1,[Enable debug messages])
+fi
+
+AC_MSG_CHECKING(target)
+
+if test "$TARGET" = "native"; then
+ AC_MSG_RESULT(native)
+
+ if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
+ CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
+ CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
+ fi
+ if test "$prefix" = "NONE"; then
+ prefix=/usr/local
+ fi
+ targetprefix=$prefix
+elif test "$TARGET" = "cdk"; then
+ AC_MSG_RESULT(cdk)
+
+ if test "$CC" = "" -a "$CXX" = ""; then
+ CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
+ fi
+ if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
+ CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
+ CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
+ fi
+ if test "$prefix" = "NONE"; then
+ AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
+ fi
+ if test "$targetprefix" = "NONE"; then
+ targetprefix=""
+ fi
+ if test "$host_alias" = ""; then
+ cross_compiling=yes
+ host_alias=powerpc-tuxbox-linux-gnu
+ fi
+else
+ AC_MSG_RESULT(none)
+ AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
+fi
+
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+check_path () {
+ return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
+}
+
+])
+
+AC_DEFUN([TUXBOX_APPS_DIRECTORY_ONE],[
+AC_ARG_WITH($1,[ $6$7 [[PREFIX$4$5]]],[
+ _$2=$withval
+ if test "$TARGET" = "cdk"; then
+ $2=`eval echo "${targetprefix}$withval"`
+ else
+ $2=$withval
+ fi
+],[
+ $2="\${$3}$5"
+ if test "$TARGET" = "cdk"; then
+ _$2=`eval echo "${target$3}$5"`
+ else
+ _$2=`eval echo "${$3}$5"`
+ fi
+])
+
+dnl automake <= 1.6 don't support this
+dnl AC_SUBST($2)
+AC_DEFINE_UNQUOTED($2,"$_$2",$7)
+])
+
+AC_DEFUN([TUXBOX_APPS_DIRECTORY],[
+AC_REQUIRE([TUXBOX_APPS])
+
+if test "$TARGET" = "cdk"; then
+ datadir="\${prefix}/share"
+ tuxboxdatadir="\${prefix}/share/tuxbox"
+ zoneinfodir="\${datadir}/zoneinfo"
+ sysconfdir="\${prefix}/etc"
+ localstatedir="\${prefix}/var"
+ localedir="\${prefix}/var"
+ libdir="\${prefix}/lib"
+ targetdatadir="\${targetprefix}/share"
+ targetsysconfdir="\${targetprefix}/etc"
+ targetlocalstatedir="\${targetprefix}/var"
+ targetlibdir="\${targetprefix}/lib"
+fi
+
+TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
+ [--with-configdir=PATH ],[where to find the config files])
+
+TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
+ [--with-datadir=PATH ],[where to find data])
+
+TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
+ [--with-fontdir=PATH ],[where to find the fonts])
+
+TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
+ [--with-libdir=PATH ],[where to find the internal libs])
+])
+
+dnl automake <= 1.6 needs this specifications
+AC_SUBST(CONFIGDIR)
+AC_SUBST(DATADIR)
+AC_SUBST(FONTDIR)
+AC_SUBST(LIBDIR)
+dnl end workaround
+
+AC_DEFUN([TUXBOX_APPS_DVB],[
+AC_ARG_WITH(dvbincludes,
+ [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
+ [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
+
+if test "$DVBINCLUDES"; then
+ CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
+fi
+
+AC_CHECK_HEADERS(ost/dmx.h,[
+ DVB_API_VERSION=1
+ AC_MSG_NOTICE([found dvb version 1])
+])
+
+if test -z "$DVB_API_VERSION"; then
+AC_CHECK_HEADERS(linux/dvb/version.h,[
+ AC_LANG_PREPROC_REQUIRE()
+ AC_REQUIRE([AC_PROG_EGREP])
+ AC_LANG_CONFTEST([AC_LANG_SOURCE([[
+#include <linux/dvb/version.h>
+version DVB_API_VERSION
+ ]])])
+ DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
+ rm -f conftest*
+
+ AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
+])
+fi
+
+if test "$DVB_API_VERSION"; then
+ AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
+ AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
+else
+ AC_MSG_ERROR([can't find dvb headers])
+fi
+])
+
+AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[
+AC_PATH_PROG($1_CONFIG,$2,no)
+if test "$$1_CONFIG" != "no"; then
+ if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
+ AC_MSG_$3([could not find a suitable version of $2]);
+ else
+ $1_CFLAGS=$($$1_CONFIG --cflags)
+ $1_LIBS=$($$1_CONFIG --libs)
+ fi
+fi
+
+AC_SUBST($1_CFLAGS)
+AC_SUBST($1_LIBS)
+])
+
+AC_DEFUN([TUXBOX_APPS_LIB_CONFIG],[
+_TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
+if test "$$1_CONFIG" = "no"; then
+ AC_MSG_ERROR([could not find $2]);
+fi
+])
+
+AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[
+_TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
+])
+
+AC_DEFUN([TUXBOX_APPS_PKGCONFIG],[
+AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
+if test "$PKG_CONFIG" = "no" ; then
+ AC_MSG_ERROR([could not find pkg-config]);
+fi
+])
+
+AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG],[
+PKG_CHECK_MODULES($1,$2)
+AC_SUBST($1_CFLAGS)
+AC_SUBST($1_LIBS)
+])
+
+AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL],[
+PKG_CHECK_MODULES($1,$2,$3="yes",$3="no")
+if test "$$3" = "yes"; then
+ AC_DEFINE($3, 1, [$2 available])
+else
+ $1_CFLAGS=""
+ $1_LIBS=""
+fi
+AC_SUBST($1_CFLAGS)
+AC_SUBST($1_LIBS)
+])
+
+AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG],[
+_TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
+if test -z "$$1_CFLAGS" ; then
+ AC_MSG_ERROR([could not find package $2]);
+fi
+])
+
+AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[
+_TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
+])
+
+AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[
+AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
+if test "$HAVE_$1" = "yes"; then
+ $1_LIBS=-l$2
+fi
+
+AC_SUBST($1_LIBS)
+])
+
+AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[
+_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
+if test "$HAVE_$1" = "no"; then
+ AC_MSG_ERROR([could not find $2]);
+fi
+])
+
+AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[
+_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
+])
+
+AC_DEFUN([TUXBOX_APPS_GETTEXT],[
+AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+ :)
+AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+
+AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
+ (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+ :)
+
+AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
+
+AC_MSG_CHECKING([whether NLS is requested])
+AC_ARG_ENABLE(nls,
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+AC_MSG_RESULT($USE_NLS)
+AC_SUBST(USE_NLS)
+
+if test "$USE_NLS" = "yes"; then
+ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
+ AC_TRY_LINK([
+ #include <libintl.h>
+ #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+ #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+ #endif
+ extern int _nl_msg_cat_cntr;
+ extern int *_nl_domain_bindings;
+ ],[
+ bindtextdomain ("", "");
+ return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
+ ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
+ )]
+ )
+
+ if test "$gt_cv_func_gnugettext_libc" = "yes"; then
+ AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
+ gt_use_preinstalled_gnugettext=yes
+ else
+ USE_NLS=no
+ fi
+fi
+
+if test -f "$srcdir/po/LINGUAS"; then
+ ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
+fi
+
+POFILES=
+GMOFILES=
+UPDATEPOFILES=
+DUMMYPOFILES=
+for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+done
+INST_LINGUAS=
+if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test -n "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+fi
+CATALOGS=
+if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ done
+fi
+AC_SUBST(POFILES)
+AC_SUBST(GMOFILES)
+AC_SUBST(UPDATEPOFILES)
+AC_SUBST(DUMMYPOFILES)
+AC_SUBST(CATALOGS)
+])
+
+dnl backward compatiblity
+AC_DEFUN([AC_GNU_SOURCE],
+[AH_VERBATIM([_GNU_SOURCE],
+[/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif])dnl
+AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+AC_DEFINE([_GNU_SOURCE])
+])
+
+AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])