fixes bug #258 (again)
[enigma2.git] / acinclude.m4
index e58d27518bf679bda0caa8acaa2a4662ffb2aac1..6f1cb0a3dce0c6e991a0c545c22b1a4892e5c474 100644 (file)
@@ -1,5 +1,4 @@
-AC_DEFUN(TUXBOX_APPS,[
-AM_MAINTAINER_MODE
+AC_DEFUN([TUXBOX_APPS],[
 
 INSTALL="$INSTALL -p"
 
 
 INSTALL="$INSTALL -p"
 
@@ -70,7 +69,7 @@ check_path () {
 
 ])
 
 
 ])
 
-AC_DEFUN(TUXBOX_APPS_DIRECTORY_ONE,[
+AC_DEFUN([TUXBOX_APPS_DIRECTORY_ONE],[
 AC_ARG_WITH($1,[  $6$7 [[PREFIX$4$5]]],[
        _$2=$withval
        if test "$TARGET" = "cdk"; then
 AC_ARG_WITH($1,[  $6$7 [[PREFIX$4$5]]],[
        _$2=$withval
        if test "$TARGET" = "cdk"; then
@@ -92,7 +91,7 @@ dnl AC_SUBST($2)
 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
 ])
 
 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
 ])
 
-AC_DEFUN(TUXBOX_APPS_DIRECTORY,[
+AC_DEFUN([TUXBOX_APPS_DIRECTORY],[
 AC_REQUIRE([TUXBOX_APPS])
 
 if test "$TARGET" = "cdk"; then
 AC_REQUIRE([TUXBOX_APPS])
 
 if test "$TARGET" = "cdk"; then
@@ -115,61 +114,20 @@ TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
        [--with-datadir=PATH     ],[where to find data])
 
 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
        [--with-datadir=PATH     ],[where to find data])
 
-TUXBOX_APPS_DIRECTORY_ONE(localedir,LOCALEDIR,datadir,/share,/locale,
-       [--with-localedir=PATH ],[where to find locales])
-
 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
        [--with-fontdir=PATH     ],[where to find the fonts])
 
 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
        [--with-fontdir=PATH     ],[where to find the fonts])
 
-TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games,
-       [--with-gamesdir=PATH    ],[where games data is stored])
-
 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
        [--with-libdir=PATH      ],[where to find the internal libs])
 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
        [--with-libdir=PATH      ],[where to find the internal libs])
-
-TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins,
-       [--with-plugindir=PATH   ],[where to find the plugins])
-
-TUXBOX_APPS_DIRECTORY_ONE(tuxboxdatadir,TUXBOXDATADIR,datadir,/share,,
-       [--with-tuxboxdatadir=PATH],[where to find tuxbox data])
-
-TUXBOX_APPS_DIRECTORY_ONE(zoneinfodir,ZONEINFODIR,datadir,/share,/zoneinfo,
-       [--with-zoneinfodir=PATH ],[where to find zoneinfo db])
 ])
 
 dnl automake <= 1.6 needs this specifications
 AC_SUBST(CONFIGDIR)
 AC_SUBST(DATADIR)
 ])
 
 dnl automake <= 1.6 needs this specifications
 AC_SUBST(CONFIGDIR)
 AC_SUBST(DATADIR)
-AC_SUBST(ZONEINFODIR)
 AC_SUBST(FONTDIR)
 AC_SUBST(FONTDIR)
-AC_SUBST(GAMESDIR)
 AC_SUBST(LIBDIR)
 AC_SUBST(LIBDIR)
-AC_SUBST(LOCALEDIR)
-AC_SUBST(PLUGINDIR)
-AC_SUBST(TUXBOXDATADIR)
 dnl end workaround
 
 dnl end workaround
 
-AC_DEFUN(TUXBOX_APPS_ENDIAN,[
-AC_CHECK_HEADERS(endian.h)
-AC_C_BIGENDIAN
-])
-
-AC_DEFUN(TUXBOX_APPS_DRIVER,[
-#AC_ARG_WITH(driver,
-#      [  --with-driver=PATH      path for driver sources [[NONE]]],
-#      [DRIVER="$withval"],[DRIVER=""])
-#
-#if test -d "$DRIVER/include"; then
-#      AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources])
-#else
-#      AC_MSG_ERROR([can't find driver sources])
-#fi
-
-#AC_SUBST(DRIVER)
-
-#CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
-])
-
 AC_DEFUN([TUXBOX_APPS_DVB],[
 AC_ARG_WITH(dvbincludes,
        [  --with-dvbincludes=PATH  path for dvb includes [[NONE]]],
 AC_DEFUN([TUXBOX_APPS_DVB],[
 AC_ARG_WITH(dvbincludes,
        [  --with-dvbincludes=PATH  path for dvb includes [[NONE]]],
@@ -207,7 +165,7 @@ else
 fi
 ])
 
 fi
 ])
 
-AC_DEFUN(_TUXBOX_APPS_LIB_CONFIG,[
+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_PATH_PROG($1_CONFIG,$2,no)
 if test "$$1_CONFIG" != "no"; then
        if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
@@ -222,42 +180,54 @@ AC_SUBST($1_CFLAGS)
 AC_SUBST($1_LIBS)
 ])
 
 AC_SUBST($1_LIBS)
 ])
 
-AC_DEFUN(TUXBOX_APPS_LIB_CONFIG,[
+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
 ])
 
 _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,[
+AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[
 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
 ])
 
 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
 ])
 
-AC_DEFUN(TUXBOX_APPS_PKGCONFIG,[
+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_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,[
+AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG],[
 PKG_CHECK_MODULES($1,$2)
 AC_SUBST($1_CFLAGS)
 AC_SUBST($1_LIBS)
 ])
 
 PKG_CHECK_MODULES($1,$2)
 AC_SUBST($1_CFLAGS)
 AC_SUBST($1_LIBS)
 ])
 
-AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG,[
+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
 ])
 
 _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,[
+AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[
 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
 ])
 
 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
 ])
 
-AC_DEFUN(_TUXBOX_APPS_LIB_SYMBOL,[
+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
 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
 if test "$HAVE_$1" = "yes"; then
        $1_LIBS=-l$2
@@ -266,18 +236,18 @@ fi
 AC_SUBST($1_LIBS)
 ])
 
 AC_SUBST($1_LIBS)
 ])
 
-AC_DEFUN(TUXBOX_APPS_LIB_SYMBOL,[
+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
 ])
 
 _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,[
+AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[
 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
 ])
 
 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
 ])
 
-AC_DEFUN(TUXBOX_APPS_GETTEXT,[
+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)],
 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)],
@@ -391,43 +361,85 @@ AC_DEFUN([AC_PROG_EGREP],
 ])
 
 AC_DEFUN([AC_PYTHON_DEVEL],[
 ])
 
 AC_DEFUN([AC_PYTHON_DEVEL],[
-        #
-        # should allow for checking of python version here...
-        #
-        AC_REQUIRE([AM_PATH_PYTHON])
-
-        # Check for Python include path
-        AC_MSG_CHECKING([for Python include path])
-        python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
-        for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
-                python_path=`find $i -type f -name Python.h -print | sed "1q"`
-                if test -n "$python_path" ; then
-                        break
-                fi
-        done
-        python_path=`echo $python_path | sed "s,/Python.h$,,"`
-        AC_MSG_RESULT([$python_path])
-        if test -z "$python_path" ; then
-                AC_MSG_ERROR([cannot find Python include path])
-        fi
-        AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
-
-        # Check for Python library path
-        AC_MSG_CHECKING([for Python library path])
-        python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
-        for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
-                python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
-                if test -n "$python_path" ; then
-                        break
-                fi
-        done
-        python_path=`echo $python_path | sed "s,/libpython.*$,,"`
-        AC_MSG_RESULT([$python_path])
-        if test -z "$python_path" ; then
-                AC_MSG_ERROR([cannot find Python library path])
-        fi
-        AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
-        #
-        python_site=`echo $python_path | sed "s/config/site-packages/"`
-        AC_SUBST([PYTHON_SITE_PKG],[$python_site])
+       #
+       # should allow for checking of python version here...
+       #
+       if test $cross_compiling = "yes"; then
+               # Check for Python include path
+               AC_MSG_CHECKING([for Python include path])
+               
+               # FIXME: yes, this is wrong. sorry about that. (tmbinc)
+               cross_PYTHON_VERSION=$PYTHON_VERSION
+               python_path=
+               for i in $CPPFLAGS ; do
+                       p=`echo $i | sed "s,^-I,,"`
+                       p=`echo $p | sed "s,^-isystem,,"`
+                       if test -f "$p/python$cross_PYTHON_VERSION/Python.h"; then
+                               python_path="$p/python$cross_PYTHON_VERSION"
+                               break
+                       fi
+               done
+               AC_MSG_RESULT([$python_path])
+               if test -z "$python_path" ; then
+                                               AC_MSG_ERROR([cannot find Python include path])
+               fi
+               AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
+
+               # Check for Python library path
+               AC_MSG_CHECKING([for Python library path])
+               python_path=
+               for i in $LDFLAGS; do
+                       l=`echo $i | sed "s,^-L,,"`
+                       python_path=`find $l -type f -name libpython$cross_PYTHON_VERSION.* -print | sed "1q"`
+                       if test -n "$python_path" ; then
+                               break
+                       fi
+               done
+               python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+               AC_MSG_RESULT([$python_path])
+               if test -z "$python_path" ; then
+                                               AC_MSG_ERROR([cannot find Python library path])
+               fi
+               AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$cross_PYTHON_VERSION"])
+               #
+               python_site=`echo $python_path | sed "s/config/site-packages/"`
+               AC_SUBST([PYTHON_SITE_PKG],[$python_site])
+       else
+               AC_REQUIRE([AM_PATH_PYTHON])
+
+               # Check for Python include path
+               AC_MSG_CHECKING([for Python include path])
+               python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
+               for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
+                       python_path=`find $i -type f -name Python.h -print | sed "1q"`
+                       if test -n "$python_path" ; then
+                               break
+                       fi
+               done
+               python_path=`echo $python_path | sed "s,/Python.h$,,"`
+               AC_MSG_RESULT([$python_path])
+               if test -z "$python_path" ; then
+                       AC_MSG_ERROR([cannot find Python include path])
+               fi
+               AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
+
+               # Check for Python library path
+               AC_MSG_CHECKING([for Python library path])
+               python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
+               for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
+                       python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
+                       if test -n "$python_path" ; then
+                               break
+                       fi
+               done
+               python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+               AC_MSG_RESULT([$python_path])
+               if test -z "$python_path" ; then
+                       AC_MSG_ERROR([cannot find Python library path])
+               fi
+               AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
+               #
+               python_site=`echo $python_path | sed "s/config/site-packages/"`
+               AC_SUBST([PYTHON_SITE_PKG],[$python_site])
+       fi
 ])
 ])