10 [ --with-target=TARGET target for compilation [[native,cdk]]],
11 [TARGET="$withval"],[TARGET="native"])
13 AC_ARG_WITH(targetprefix,
14 [ --with-targetprefix=PATH prefix relative to target root (only applicable in cdk mode)],
15 [targetprefix="$withval"],[targetprefix="NONE"])
18 [ --without-debug disable debugging code],
19 [DEBUG="$withval"],[DEBUG="yes"])
21 if test "$DEBUG" = "yes"; then
22 DEBUG_CFLAGS="-g3 -ggdb"
23 AC_DEFINE(DEBUG,1,[Enable debug messages])
26 AC_MSG_CHECKING(target)
28 if test "$TARGET" = "native"; then
31 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
32 CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
33 CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
35 if test "$prefix" = "NONE"; then
39 elif test "$TARGET" = "cdk"; then
42 if test "$CC" = "" -a "$CXX" = ""; then
43 CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
45 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
46 CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
47 CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
49 if test "$prefix" = "NONE"; then
50 AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
52 if test "$targetprefix" = "NONE"; then
55 if test "$host_alias" = ""; then
57 host_alias=powerpc-tuxbox-linux-gnu
61 AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
68 return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
73 AC_DEFUN(TUXBOX_APPS_DIRECTORY_ONE,[
74 AC_ARG_WITH($1,[ $6$7 [[PREFIX$4$5]]],[
76 if test "$TARGET" = "cdk"; then
77 $2=`eval echo "${targetprefix}$withval"`
83 if test "$TARGET" = "cdk"; then
84 _$2=`eval echo "${target$3}$5"`
86 _$2=`eval echo "${$3}$5"`
90 dnl automake <= 1.6 don't support this
92 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
95 AC_DEFUN(TUXBOX_APPS_DIRECTORY,[
96 AC_REQUIRE([TUXBOX_APPS])
98 if test "$TARGET" = "cdk"; then
99 datadir="\${prefix}/share"
100 tuxboxdatadir="\${prefix}/share/tuxbox"
101 zoneinfodir="\${datadir}/zoneinfo"
102 sysconfdir="\${prefix}/etc"
103 localstatedir="\${prefix}/var"
104 localedir="\${prefix}/var"
105 libdir="\${prefix}/lib"
106 targetdatadir="\${targetprefix}/share"
107 targetsysconfdir="\${targetprefix}/etc"
108 targetlocalstatedir="\${targetprefix}/var"
109 targetlibdir="\${targetprefix}/lib"
112 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
113 [--with-configdir=PATH ],[where to find the config files])
115 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
116 [--with-datadir=PATH ],[where to find data])
118 TUXBOX_APPS_DIRECTORY_ONE(localedir,LOCALEDIR,datadir,/share,/locale,
119 [--with-localedir=PATH ],[where to find locales])
121 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
122 [--with-fontdir=PATH ],[where to find the fonts])
124 TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games,
125 [--with-gamesdir=PATH ],[where games data is stored])
127 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
128 [--with-libdir=PATH ],[where to find the internal libs])
130 TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins,
131 [--with-plugindir=PATH ],[where to find the plugins])
133 TUXBOX_APPS_DIRECTORY_ONE(tuxboxdatadir,TUXBOXDATADIR,datadir,/share,,
134 [--with-tuxboxdatadir=PATH],[where to find tuxbox data])
136 TUXBOX_APPS_DIRECTORY_ONE(zoneinfodir,ZONEINFODIR,datadir,/share,/zoneinfo,
137 [--with-zoneinfodir=PATH ],[where to find zoneinfo db])
140 dnl automake <= 1.6 needs this specifications
143 AC_SUBST(ZONEINFODIR)
149 AC_SUBST(TUXBOXDATADIR)
152 AC_DEFUN(TUXBOX_APPS_ENDIAN,[
153 AC_CHECK_HEADERS(endian.h)
157 AC_DEFUN(TUXBOX_APPS_DRIVER,[
159 # [ --with-driver=PATH path for driver sources [[NONE]]],
160 # [DRIVER="$withval"],[DRIVER=""])
162 #if test -d "$DRIVER/include"; then
163 # AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources])
165 # AC_MSG_ERROR([can't find driver sources])
170 #CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
173 AC_DEFUN([TUXBOX_APPS_DVB],[
174 AC_ARG_WITH(dvbincludes,
175 [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
176 [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
178 if test "$DVBINCLUDES"; then
179 CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
182 AC_CHECK_HEADERS(ost/dmx.h,[
184 AC_MSG_NOTICE([found dvb version 1])
187 if test -z "$DVB_API_VERSION"; then
188 AC_CHECK_HEADERS(linux/dvb/version.h,[
189 AC_LANG_PREPROC_REQUIRE()
190 AC_REQUIRE([AC_PROG_EGREP])
191 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
192 #include <linux/dvb/version.h>
193 version DVB_API_VERSION
195 DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
198 AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
202 if test "$DVB_API_VERSION"; then
203 AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
204 AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
206 AC_MSG_ERROR([can't find dvb headers])
210 AC_DEFUN(_TUXBOX_APPS_LIB_CONFIG,[
211 AC_PATH_PROG($1_CONFIG,$2,no)
212 if test "$$1_CONFIG" != "no"; then
213 if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
214 AC_MSG_$3([could not find a suitable version of $2]);
216 $1_CFLAGS=$($$1_CONFIG --cflags)
217 $1_LIBS=$($$1_CONFIG --libs)
225 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG,[
226 _TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
227 if test "$$1_CONFIG" = "no"; then
228 AC_MSG_ERROR([could not find $2]);
232 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_CHECK,[
233 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
236 AC_DEFUN(TUXBOX_APPS_PKGCONFIG,[
237 AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
238 if test "$PKG_CONFIG" = "no" ; then
239 AC_MSG_ERROR([could not find pkg-config]);
243 AC_DEFUN(_TUXBOX_APPS_LIB_PKGCONFIG,[
244 PKG_CHECK_MODULES($1,$2)
249 AC_DEFUN(_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL,[
250 PKG_CHECK_MODULES($1,$2,$3="yes",$3="no")
251 if test "$$3" = "yes"; then
252 AC_DEFINE($3, 1, [$2 available])
261 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG,[
262 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
263 if test -z "$$1_CFLAGS" ; then
264 AC_MSG_ERROR([could not find package $2]);
268 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG_CHECK,[
269 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
272 AC_DEFUN(_TUXBOX_APPS_LIB_SYMBOL,[
273 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
274 if test "$HAVE_$1" = "yes"; then
281 AC_DEFUN(TUXBOX_APPS_LIB_SYMBOL,[
282 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
283 if test "$HAVE_$1" = "no"; then
284 AC_MSG_ERROR([could not find $2]);
288 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_SYMBOL,[
289 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
292 AC_DEFUN(TUXBOX_APPS_GETTEXT,[
293 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
294 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
295 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
297 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
299 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
300 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
301 (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)],
304 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
306 AC_MSG_CHECKING([whether NLS is requested])
308 [ --disable-nls do not use Native Language Support],
309 USE_NLS=$enableval, USE_NLS=yes)
310 AC_MSG_RESULT($USE_NLS)
313 if test "$USE_NLS" = "yes"; then
314 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
317 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
318 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
320 extern int _nl_msg_cat_cntr;
321 extern int *_nl_domain_bindings;
323 bindtextdomain ("", "");
324 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
325 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
329 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
330 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
331 gt_use_preinstalled_gnugettext=yes
337 if test -f "$srcdir/po/LINGUAS"; then
338 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
345 for lang in $ALL_LINGUAS; do
346 POFILES="$POFILES $srcdirpre$lang.po"
347 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
348 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
349 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
352 if test -n "$ALL_LINGUAS"; then
353 for presentlang in $ALL_LINGUAS; do
355 if test -n "$LINGUAS"; then
356 desiredlanguages="$LINGUAS"
358 desiredlanguages="$ALL_LINGUAS"
360 for desiredlang in $desiredlanguages; do
361 case "$desiredlang" in
362 "$presentlang"*) useit=yes;;
365 if test $useit = yes; then
366 INST_LINGUAS="$INST_LINGUAS $presentlang"
371 if test -n "$INST_LINGUAS"; then
372 for lang in $INST_LINGUAS; do
373 CATALOGS="$CATALOGS $lang.gmo"
378 AC_SUBST(UPDATEPOFILES)
379 AC_SUBST(DUMMYPOFILES)
383 dnl backward compatiblity
384 AC_DEFUN([AC_GNU_SOURCE],
385 [AH_VERBATIM([_GNU_SOURCE],
386 [/* Enable GNU extensions on systems that have them. */
390 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
391 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
392 AC_DEFINE([_GNU_SOURCE])
395 AC_DEFUN([AC_PROG_EGREP],
396 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
397 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
398 then ac_cv_prog_egrep='grep -E'
399 else ac_cv_prog_egrep='egrep'
401 EGREP=$ac_cv_prog_egrep
405 AC_DEFUN([AC_PYTHON_DEVEL],[
407 # should allow for checking of python version here...
409 AC_REQUIRE([AM_PATH_PYTHON])
411 # Check for Python include path
412 AC_MSG_CHECKING([for Python include path])
413 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
414 for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
415 python_path=`find $i -type f -name Python.h -print | sed "1q"`
416 if test -n "$python_path" ; then
420 python_path=`echo $python_path | sed "s,/Python.h$,,"`
421 AC_MSG_RESULT([$python_path])
422 if test -z "$python_path" ; then
423 AC_MSG_ERROR([cannot find Python include path])
425 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
427 # Check for Python library path
428 AC_MSG_CHECKING([for Python library path])
429 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
430 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
431 python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
432 if test -n "$python_path" ; then
436 python_path=`echo $python_path | sed "s,/libpython.*$,,"`
437 AC_MSG_RESULT([$python_path])
438 if test -z "$python_path" ; then
439 AC_MSG_ERROR([cannot find Python library path])
441 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
443 python_site=`echo $python_path | sed "s/config/site-packages/"`
444 AC_SUBST([PYTHON_SITE_PKG],[$python_site])