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(fontdir,FONTDIR,datadir,/share,/fonts,
118 [--with-fontdir=PATH ],[where to find the fonts])
120 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
121 [--with-libdir=PATH ],[where to find the internal libs])
124 dnl automake <= 1.6 needs this specifications
131 AC_DEFUN([TUXBOX_APPS_DVB],[
132 AC_ARG_WITH(dvbincludes,
133 [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
134 [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
136 if test "$DVBINCLUDES"; then
137 CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
140 AC_CHECK_HEADERS(ost/dmx.h,[
142 AC_MSG_NOTICE([found dvb version 1])
145 if test -z "$DVB_API_VERSION"; then
146 AC_CHECK_HEADERS(linux/dvb/version.h,[
147 AC_LANG_PREPROC_REQUIRE()
148 AC_REQUIRE([AC_PROG_EGREP])
149 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
150 #include <linux/dvb/version.h>
151 version DVB_API_VERSION
153 DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
156 AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
161 AC_DEFINE(BUILD_VUPLUS,1,[Define to 1 for 750])
163 if test "$DVB_API_VERSION"; then
164 AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
165 AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
167 AC_MSG_ERROR([can't find dvb headers])
171 AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[
172 AC_PATH_PROG($1_CONFIG,$2,no)
173 if test "$$1_CONFIG" != "no"; then
174 if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
175 AC_MSG_$3([could not find a suitable version of $2]);
177 $1_CFLAGS=$($$1_CONFIG --cflags)
178 $1_LIBS=$($$1_CONFIG --libs)
186 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG],[
187 _TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
188 if test "$$1_CONFIG" = "no"; then
189 AC_MSG_ERROR([could not find $2]);
193 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[
194 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
197 AC_DEFUN([TUXBOX_APPS_PKGCONFIG],[
198 AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
199 if test "$PKG_CONFIG" = "no" ; then
200 AC_MSG_ERROR([could not find pkg-config]);
204 AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG],[
205 PKG_CHECK_MODULES($1,$2)
210 AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL],[
211 PKG_CHECK_MODULES($1,$2,$3="yes",$3="no")
212 if test "$$3" = "yes"; then
213 AC_DEFINE($3, 1, [$2 available])
222 AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG],[
223 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
224 if test -z "$$1_CFLAGS" ; then
225 AC_MSG_ERROR([could not find package $2]);
229 AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[
230 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
233 AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[
234 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
235 if test "$HAVE_$1" = "yes"; then
242 AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[
243 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
244 if test "$HAVE_$1" = "no"; then
245 AC_MSG_ERROR([could not find $2]);
249 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[
250 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
253 AC_DEFUN([TUXBOX_APPS_GETTEXT],[
254 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
255 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
256 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
258 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
260 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
261 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
262 (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)],
265 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
267 AC_MSG_CHECKING([whether NLS is requested])
269 [ --disable-nls do not use Native Language Support],
270 USE_NLS=$enableval, USE_NLS=yes)
271 AC_MSG_RESULT($USE_NLS)
274 if test "$USE_NLS" = "yes"; then
275 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
278 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
279 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
281 extern int _nl_msg_cat_cntr;
282 extern int *_nl_domain_bindings;
284 bindtextdomain ("", "");
285 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
286 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
290 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
291 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
292 gt_use_preinstalled_gnugettext=yes
298 if test -f "$srcdir/po/LINGUAS"; then
299 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
306 for lang in $ALL_LINGUAS; do
307 POFILES="$POFILES $srcdirpre$lang.po"
308 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
309 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
310 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
313 if test -n "$ALL_LINGUAS"; then
314 for presentlang in $ALL_LINGUAS; do
316 if test -n "$LINGUAS"; then
317 desiredlanguages="$LINGUAS"
319 desiredlanguages="$ALL_LINGUAS"
321 for desiredlang in $desiredlanguages; do
322 case "$desiredlang" in
323 "$presentlang"*) useit=yes;;
326 if test $useit = yes; then
327 INST_LINGUAS="$INST_LINGUAS $presentlang"
332 if test -n "$INST_LINGUAS"; then
333 for lang in $INST_LINGUAS; do
334 CATALOGS="$CATALOGS $lang.gmo"
339 AC_SUBST(UPDATEPOFILES)
340 AC_SUBST(DUMMYPOFILES)
344 dnl backward compatiblity
345 AC_DEFUN([AC_GNU_SOURCE],
346 [AH_VERBATIM([_GNU_SOURCE],
347 [/* Enable GNU extensions on systems that have them. */
351 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
352 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
353 AC_DEFINE([_GNU_SOURCE])
356 AC_DEFUN([AC_PROG_EGREP],
357 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
358 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
359 then ac_cv_prog_egrep='grep -E'
360 else ac_cv_prog_egrep='egrep'
362 EGREP=$ac_cv_prog_egrep
366 AC_DEFUN([AC_PYTHON_DEVEL],[
368 # should allow for checking of python version here...
370 if test $cross_compiling = "yes"; then
371 # Check for Python include path
372 AC_MSG_CHECKING([for Python include path])
374 # FIXME: yes, this is wrong. sorry about that. (tmbinc)
375 cross_PYTHON_VERSION=$PYTHON_VERSION
377 for i in $CPPFLAGS ; do
378 p=`echo $i | sed "s,^-I,,"`
379 p=`echo $p | sed "s,^-isystem,,"`
380 if test -f "$p/python$cross_PYTHON_VERSION/Python.h"; then
381 python_path="$p/python$cross_PYTHON_VERSION"
385 AC_MSG_RESULT([$python_path])
386 if test -z "$python_path" ; then
387 AC_MSG_ERROR([cannot find Python include path])
389 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
391 # Check for Python library path
392 AC_MSG_CHECKING([for Python library path])
394 for i in $LDFLAGS; do
395 l=`echo $i | sed "s,^-L,,"`
396 python_path=`find $l -type f -name libpython$cross_PYTHON_VERSION.* -print | sed "1q"`
397 if test -n "$python_path" ; then
401 python_path=`echo $python_path | sed "s,/libpython.*$,,"`
402 AC_MSG_RESULT([$python_path])
403 if test -z "$python_path" ; then
404 AC_MSG_ERROR([cannot find Python library path])
406 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$cross_PYTHON_VERSION"])
408 python_site=`echo $python_path | sed "s/config/site-packages/"`
409 AC_SUBST([PYTHON_SITE_PKG],[$python_site])
411 AC_REQUIRE([AM_PATH_PYTHON])
413 # Check for Python include path
414 AC_MSG_CHECKING([for Python include path])
415 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
416 for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
417 python_path=`find $i -type f -name Python.h -print | sed "1q"`
418 if test -n "$python_path" ; then
422 python_path=`echo $python_path | sed "s,/Python.h$,,"`
423 AC_MSG_RESULT([$python_path])
424 if test -z "$python_path" ; then
425 AC_MSG_ERROR([cannot find Python include path])
427 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
429 # Check for Python library path
430 AC_MSG_CHECKING([for Python library path])
431 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
432 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
433 python_path=`find $i -type f -name libpython$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$PYTHON_VERSION"])
445 python_site=`echo $python_path | sed "s/config/site-packages/"`
446 AC_SUBST([PYTHON_SITE_PKG],[$python_site])