1 AC_DEFUN([TUXBOX_APPS],[
2 AM_CONFIG_HEADER(config.h)
11 [ --with-target=TARGET target for compilation [[native,cdk]]],
12 [TARGET="$withval"],[TARGET="native"])
15 AM_CONDITIONAL(TARGET_NATIVE,test "$TARGET" = "native")
16 AM_CONDITIONAL(TARGET_CDK,test "$TARGET" = "cdk")
18 AC_ARG_WITH(targetprefix,
19 [ --with-targetprefix=PATH prefix relative to target root (only applicable in cdk mode)],
20 [targetprefix="$withval"],[targetprefix="NONE"])
23 [ --without-debug disable debugging code],
24 [DEBUG="$withval"],[DEBUG="yes"])
26 if test "$DEBUG" = "yes"; then
27 DEBUG_CFLAGS="-g3 -ggdb"
28 AC_DEFINE(DEBUG,1,[Enable debug messages])
31 AC_MSG_CHECKING(target)
33 if test "$TARGET" = "native"; then
36 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
37 CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
38 CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
40 if test "$prefix" = "NONE"; then
44 elif test "$TARGET" = "cdk"; then
47 if test "$CC" = "" -a "$CXX" = ""; then
48 CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
50 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
51 CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
52 CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
54 if test "$prefix" = "NONE"; then
55 AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
57 if test "$targetprefix" = "NONE"; then
60 if test "$host_alias" = ""; then
62 host_alias=powerpc-tuxbox-linux-gnu
66 AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
73 return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
78 AC_DEFUN([TUXBOX_APPS_DIRECTORY_ONE],[
79 AC_ARG_WITH($1,[ $6$7 [[PREFIX$4$5]]],[
81 if test "$TARGET" = "cdk"; then
82 $2=`eval echo "${targetprefix}$withval"`
88 if test "$TARGET" = "cdk"; then
89 _$2=`eval echo "${target$3}$5"`
91 _$2=`eval echo "${$3}$5"`
95 dnl automake <= 1.6 don't support this
97 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
100 AC_DEFUN([TUXBOX_APPS_DIRECTORY],[
101 AC_REQUIRE([TUXBOX_APPS])
103 if test "$TARGET" = "cdk"; then
104 datadir="\${prefix}/share"
105 sysconfdir="\${prefix}/etc"
106 localstatedir="\${prefix}/var"
107 libdir="\${prefix}/lib"
108 targetdatadir="\${targetprefix}/share"
109 targetsysconfdir="\${targetprefix}/etc"
110 targetlocalstatedir="\${targetprefix}/var"
111 targetlibdir="\${targetprefix}/lib"
112 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,localstatedir,/var,/tuxbox/config,
113 [--with-configdir=PATH ],[where to find the config files])
115 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
116 [--with-configdir=PATH ],[where to find the config files])
120 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
121 [--with-datadir=PATH ],[where to find data])
123 TUXBOX_APPS_DIRECTORY_ONE(localedir,LOCALEDIR,datadir,/share,/locale,
124 [--with-localedir=PATH ],[where to find locales])
126 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
127 [--with-fontdir=PATH ],[where to find the fonts])
129 TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games,
130 [--with-gamesdir=PATH ],[where games data is stored])
132 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,/tuxbox,
133 [--with-libdir=PATH ],[where to find the internal libs])
135 TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins,
136 [--with-plugindir=PATH ],[where to find the plugins])
138 TUXBOX_APPS_DIRECTORY_ONE(tuxboxdatadir,TUXBOXDATADIR,datadir,/share,/tuxbox,
139 [--with-tuxboxdatadir=PATH],[where to find tuxbox data])
141 TUXBOX_APPS_DIRECTORY_ONE(zoneinfodir,ZONEINFODIR,datadir,/share,/zoneinfo,
142 [--with-zoneinfodir=PATH ],[where to find zoneinfo db])
145 dnl automake <= 1.6 needs this specifications
148 AC_SUBST(ZONEINFODIR)
154 AC_SUBST(TUXBOXDATADIR)
157 AC_DEFUN([TUXBOX_APPS_ENDIAN],[
158 AC_CHECK_HEADERS(endian.h)
162 AC_DEFUN([TUXBOX_APPS_DRIVER],[
163 if test "$TARGET" = "cdk"; then
165 [ --with-driver=PATH path for driver sources [[NONE]]],
166 [DRIVER="$withval"],[DRIVER=""])
168 if test -d "$DRIVER/include"; then
169 AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources])
171 AC_MSG_ERROR([can't find driver sources])
176 CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
180 AC_DEFUN([TUXBOX_APPS_DVB],[
181 AC_ARG_WITH(dvbincludes,
182 [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
183 [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
185 if test "$DVBINCLUDES"; then
186 CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
189 AC_CHECK_HEADERS(ost/dmx.h,[
191 AC_MSG_NOTICE([found dvb version 1])
194 if test -z "$DVB_API_VERSION"; then
195 AC_CHECK_HEADERS(linux/dvb/version.h,[
196 AC_LANG_PREPROC_REQUIRE()
197 AC_REQUIRE([AC_PROG_EGREP])
198 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
199 #include <linux/dvb/version.h>
200 version DVB_API_VERSION
202 DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
205 AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
209 if test "$DVB_API_VERSION"; then
210 AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
211 AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
213 AC_MSG_ERROR([can't find dvb headers])
217 AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[
218 AC_PATH_PROG($1_CONFIG,$2,no)
219 if test "$$1_CONFIG" != "no"; then
220 if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
221 AC_MSG_$3([could not find a suitable version of $2]);
223 $1_CFLAGS=$($$1_CONFIG --cflags)
224 $1_LIBS=$($$1_CONFIG --libs)
232 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG],[
233 _TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
234 if test "$$1_CONFIG" = "no"; then
235 AC_MSG_ERROR([could not find $2]);
239 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[
240 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
243 AC_DEFUN([TUXBOX_APPS_PKGCONFIG],[
244 AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
245 if test "$PKG_CONFIG" = "no" ; then
246 AC_MSG_ERROR([could not find pkg-config]);
250 AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG],[
251 if test "$TARGET" = "cdk"; then
252 AC_REQUIRE([TUXBOX_APPS_PKGCONFIG])
253 AC_MSG_CHECKING(for package $2)
254 if PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --exists "$2" ; then
256 $1_CFLAGS=$(PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --cflags "$2")
257 $1_LIBS=$(PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --libs "$2")
262 PKG_CHECK_MODULES($1,$2)
268 AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG],[
269 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
270 if test -z "$$1_CFLAGS" ; then
271 AC_MSG_ERROR([could not find package $2]);
275 AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[
276 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
279 AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[
280 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
281 if test "$HAVE_$1" = "yes"; then
288 AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[
289 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
290 if test "$HAVE_$1" = "no"; then
291 AC_MSG_ERROR([could not find $2]);
295 AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[
296 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
299 AC_DEFUN([TUXBOX_APPS_GETTEXT],[
300 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
301 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
302 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
304 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
306 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
307 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
308 (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)],
311 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
313 AC_MSG_CHECKING([whether NLS is requested])
315 [ --disable-nls do not use Native Language Support],
316 USE_NLS=$enableval, USE_NLS=yes)
317 AC_MSG_RESULT($USE_NLS)
320 if test "$USE_NLS" = "yes"; then
321 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
324 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
325 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
327 extern int _nl_msg_cat_cntr;
328 extern int *_nl_domain_bindings;
330 bindtextdomain ("", "");
331 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
332 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
336 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
337 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
338 gt_use_preinstalled_gnugettext=yes
344 if test -f "$srcdir/po/LINGUAS"; then
345 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
352 for lang in $ALL_LINGUAS; do
353 POFILES="$POFILES $srcdirpre$lang.po"
354 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
355 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
356 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
359 if test -n "$ALL_LINGUAS"; then
360 for presentlang in $ALL_LINGUAS; do
362 if test -n "$LINGUAS"; then
363 desiredlanguages="$LINGUAS"
365 desiredlanguages="$ALL_LINGUAS"
367 for desiredlang in $desiredlanguages; do
368 case "$desiredlang" in
369 "$presentlang"*) useit=yes;;
372 if test $useit = yes; then
373 INST_LINGUAS="$INST_LINGUAS $presentlang"
378 if test -n "$INST_LINGUAS"; then
379 for lang in $INST_LINGUAS; do
380 CATALOGS="$CATALOGS $lang.gmo"
385 AC_SUBST(UPDATEPOFILES)
386 AC_SUBST(DUMMYPOFILES)
390 dnl backward compatiblity
391 AC_DEFUN([AC_GNU_SOURCE],
392 [AH_VERBATIM([_GNU_SOURCE],
393 [/* Enable GNU extensions on systems that have them. */
397 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
398 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
399 AC_DEFINE([_GNU_SOURCE])
402 AC_DEFUN([AC_PROG_EGREP],
403 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
404 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
405 then ac_cv_prog_egrep='grep -E'
406 else ac_cv_prog_egrep='egrep'
408 EGREP=$ac_cv_prog_egrep
412 dnl This file comes from GNU gettext, and is not installed on all systems.
413 dnl Better to include it with our sources.
414 m4_include([progtest.m4])