1 AC_DEFUN([TUXBOX_APPS],[
9 [ --with-target=TARGET target for compilation [[native,cdk]]],
10 [TARGET="$withval"],[TARGET="native"])
12 AC_ARG_WITH(targetprefix,
13 [ --with-targetprefix=PATH prefix relative to target root (only applicable in cdk mode)],
14 [targetprefix="$withval"],[targetprefix="NONE"])
17 [ --without-debug disable debugging code],
18 [DEBUG="$withval"],[DEBUG="yes"])
20 if test "$DEBUG" = "yes"; then
21 DEBUG_CFLAGS="-g3 -ggdb"
22 AC_DEFINE(DEBUG,1,[Enable debug messages])
25 AC_MSG_CHECKING(target)
27 if test "$TARGET" = "native"; then
30 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
31 CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
32 CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
34 if test "$prefix" = "NONE"; then
38 elif test "$TARGET" = "cdk"; then
41 if test "$CC" = "" -a "$CXX" = ""; then
42 CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
44 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
45 CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
46 CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
48 if test "$prefix" = "NONE"; then
49 AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
51 if test "$targetprefix" = "NONE"; then
54 if test "$host_alias" = ""; then
56 host_alias=powerpc-tuxbox-linux-gnu
60 AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
67 return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
72 AC_DEFUN([TUXBOX_APPS_DIRECTORY_ONE],[
73 AC_ARG_WITH($1,[ $6$7 [[PREFIX$4$5]]],[
75 if test "$TARGET" = "cdk"; then
76 $2=`eval echo "${targetprefix}$withval"`
82 if test "$TARGET" = "cdk"; then
83 _$2=`eval echo "${target$3}$5"`
85 _$2=`eval echo "${$3}$5"`
89 dnl automake <= 1.6 don't support this
91 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
94 AC_DEFUN([TUXBOX_APPS_DIRECTORY],[
95 AC_REQUIRE([TUXBOX_APPS])
97 if test "$TARGET" = "cdk"; then
98 datadir="\${prefix}/share"
99 tuxboxdatadir="\${prefix}/share/tuxbox"
100 zoneinfodir="\${datadir}/zoneinfo"
101 sysconfdir="\${prefix}/etc"
102 localstatedir="\${prefix}/var"
103 localedir="\${prefix}/var"
104 libdir="\${prefix}/lib"
105 targetdatadir="\${targetprefix}/share"
106 targetsysconfdir="\${targetprefix}/etc"
107 targetlocalstatedir="\${targetprefix}/var"
108 targetlibdir="\${targetprefix}/lib"
111 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
112 [--with-configdir=PATH ],[where to find the config files])
114 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
115 [--with-datadir=PATH ],[where to find data])
117 TUXBOX_APPS_DIRECTORY_ONE(localedir,LOCALEDIR,datadir,/share,/locale,
118 [--with-localedir=PATH ],[where to find locales])
120 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
121 [--with-fontdir=PATH ],[where to find the fonts])
123 TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games,
124 [--with-gamesdir=PATH ],[where games data is stored])
126 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
127 [--with-libdir=PATH ],[where to find the internal libs])
129 TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins,
130 [--with-plugindir=PATH ],[where to find the plugins])
132 TUXBOX_APPS_DIRECTORY_ONE(tuxboxdatadir,TUXBOXDATADIR,datadir,/share,,
133 [--with-tuxboxdatadir=PATH],[where to find tuxbox data])
135 TUXBOX_APPS_DIRECTORY_ONE(zoneinfodir,ZONEINFODIR,datadir,/share,/zoneinfo,
136 [--with-zoneinfodir=PATH ],[where to find zoneinfo db])
139 dnl automake <= 1.6 needs this specifications
142 AC_SUBST(ZONEINFODIR)
148 AC_SUBST(TUXBOXDATADIR)
151 AC_DEFUN([TUXBOX_APPS_ENDIAN],[
152 AC_CHECK_HEADERS(endian.h)
156 AC_DEFUN([TUXBOX_APPS_DRIVER],[
158 # [ --with-driver=PATH path for driver sources [[NONE]]],
159 # [DRIVER="$withval"],[DRIVER=""])
161 #if test -d "$DRIVER/include"; then
162 # AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources])
164 # AC_MSG_ERROR([can't find driver sources])
169 #CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
172 AC_DEFUN([TUXBOX_APPS_DVB],[
173 AC_ARG_WITH(dvbincludes,
174 [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
175 [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
177 if test "$DVBINCLUDES"; then
178 CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
181 AC_CHECK_HEADERS(ost/dmx.h,[
183 AC_MSG_NOTICE([found dvb version 1])
186 if test -z "$DVB_API_VERSION"; then
187 AC_CHECK_HEADERS(linux/dvb/version.h,[
188 AC_LANG_PREPROC_REQUIRE()
189 AC_REQUIRE([AC_PROG_EGREP])
190 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
191 #include <linux/dvb/version.h>
192 version DVB_API_VERSION
194 DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
197 AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
201 if test "$DVB_API_VERSION"; then
202 AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
203 AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
205 AC_MSG_ERROR([can't find dvb headers])
209 AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[
210 AC_PATH_PROG($1_CONFIG,$2,no)
211 if test "$$1_CONFIG" != "no"; then
212 if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
213 AC_MSG_$3([could not find a suitable version of $2]);
215 $1_CFLAGS=$($$1_CONFIG --cflags)
216 $1_LIBS=$($$1_CONFIG --libs)
224 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG],[
225 _TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
226 if test "$$1_CONFIG" = "no"; then
227 AC_MSG_ERROR([could not find $2]);
231 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[
232 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
235 AC_DEFUN([TUXBOX_APPS_PKGCONFIG],[
236 AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
237 if test "$PKG_CONFIG" = "no" ; then
238 AC_MSG_ERROR([could not find pkg-config]);
242 AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG],[
243 PKG_CHECK_MODULES($1,$2)
248 AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL],[
249 PKG_CHECK_MODULES($1,$2,$3="yes",$3="no")
250 if test "$$3" = "yes"; then
251 AC_DEFINE($3, 1, [$2 available])
260 AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG],[
261 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
262 if test -z "$$1_CFLAGS" ; then
263 AC_MSG_ERROR([could not find package $2]);
267 AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[
268 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
271 AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[
272 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
273 if test "$HAVE_$1" = "yes"; then
280 AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[
281 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
282 if test "$HAVE_$1" = "no"; then
283 AC_MSG_ERROR([could not find $2]);
287 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[
288 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
291 AC_DEFUN([TUXBOX_APPS_GETTEXT],[
292 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
293 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
294 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
296 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
298 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
299 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
300 (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)],
303 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
305 AC_MSG_CHECKING([whether NLS is requested])
307 [ --disable-nls do not use Native Language Support],
308 USE_NLS=$enableval, USE_NLS=yes)
309 AC_MSG_RESULT($USE_NLS)
312 if test "$USE_NLS" = "yes"; then
313 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
316 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
317 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
319 extern int _nl_msg_cat_cntr;
320 extern int *_nl_domain_bindings;
322 bindtextdomain ("", "");
323 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
324 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
328 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
329 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
330 gt_use_preinstalled_gnugettext=yes
336 if test -f "$srcdir/po/LINGUAS"; then
337 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
344 for lang in $ALL_LINGUAS; do
345 POFILES="$POFILES $srcdirpre$lang.po"
346 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
347 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
348 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
351 if test -n "$ALL_LINGUAS"; then
352 for presentlang in $ALL_LINGUAS; do
354 if test -n "$LINGUAS"; then
355 desiredlanguages="$LINGUAS"
357 desiredlanguages="$ALL_LINGUAS"
359 for desiredlang in $desiredlanguages; do
360 case "$desiredlang" in
361 "$presentlang"*) useit=yes;;
364 if test $useit = yes; then
365 INST_LINGUAS="$INST_LINGUAS $presentlang"
370 if test -n "$INST_LINGUAS"; then
371 for lang in $INST_LINGUAS; do
372 CATALOGS="$CATALOGS $lang.gmo"
377 AC_SUBST(UPDATEPOFILES)
378 AC_SUBST(DUMMYPOFILES)
382 dnl backward compatiblity
383 AC_DEFUN([AC_GNU_SOURCE],
384 [AH_VERBATIM([_GNU_SOURCE],
385 [/* Enable GNU extensions on systems that have them. */
389 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
390 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
391 AC_DEFINE([_GNU_SOURCE])
394 AC_DEFUN([AC_PROG_EGREP],
395 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
396 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
397 then ac_cv_prog_egrep='grep -E'
398 else ac_cv_prog_egrep='egrep'
400 EGREP=$ac_cv_prog_egrep
404 AC_DEFUN([AC_PYTHON_DEVEL],[
406 # should allow for checking of python version here...
408 if test $cross_compiling = "yes"; then
409 # Check for Python include path
410 AC_MSG_CHECKING([for Python include path])
412 # FIXME: yes, this is wrong. sorry about that. (tmbinc)
413 cross_PYTHON_VERSION=$PYTHON_VERSION
415 for i in $CPPFLAGS ; do
416 p=`echo $i | sed "s,^-I,,"`
417 if test -f "$p/python$cross_PYTHON_VERSION/Python.h"; then
418 python_path="$p/python$cross_PYTHON_VERSION"
422 AC_MSG_RESULT([$python_path])
423 if test -z "$python_path" ; then
424 AC_MSG_ERROR([cannot find Python include path])
426 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
428 # Check for Python library path
429 AC_MSG_CHECKING([for Python library path])
431 for i in $LDFLAGS; do
432 l=`echo $i | sed "s,^-L,,"`
433 python_path=`find $l -type f -name libpython$cross_PYTHON_VERSION.* -print | sed "1q"`
434 if test -n "$python_path" ; then
438 python_path=`echo $python_path | sed "s,/libpython.*$,,"`
439 AC_MSG_RESULT([$python_path])
440 if test -z "$python_path" ; then
441 AC_MSG_ERROR([cannot find Python library path])
443 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$cross_PYTHON_VERSION"])
445 python_site=`echo $python_path | sed "s/config/site-packages/"`
446 AC_SUBST([PYTHON_SITE_PKG],[$python_site])
448 AC_REQUIRE([AM_PATH_PYTHON])
450 # Check for Python include path
451 AC_MSG_CHECKING([for Python include path])
452 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
453 for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
454 python_path=`find $i -type f -name Python.h -print | sed "1q"`
455 if test -n "$python_path" ; then
459 python_path=`echo $python_path | sed "s,/Python.h$,,"`
460 AC_MSG_RESULT([$python_path])
461 if test -z "$python_path" ; then
462 AC_MSG_ERROR([cannot find Python include path])
464 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
466 # Check for Python library path
467 AC_MSG_CHECKING([for Python library path])
468 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
469 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
470 python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
471 if test -n "$python_path" ; then
475 python_path=`echo $python_path | sed "s,/libpython.*$,,"`
476 AC_MSG_RESULT([$python_path])
477 if test -z "$python_path" ; then
478 AC_MSG_ERROR([cannot find Python library path])
480 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
482 python_site=`echo $python_path | sed "s/config/site-packages/"`
483 AC_SUBST([PYTHON_SITE_PKG],[$python_site])