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,[
250 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
251 if test -z "$$1_CFLAGS" ; then
252 AC_MSG_ERROR([could not find package $2]);
256 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG_CHECK,[
257 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
260 AC_DEFUN(_TUXBOX_APPS_LIB_SYMBOL,[
261 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
262 if test "$HAVE_$1" = "yes"; then
269 AC_DEFUN(TUXBOX_APPS_LIB_SYMBOL,[
270 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
271 if test "$HAVE_$1" = "no"; then
272 AC_MSG_ERROR([could not find $2]);
276 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_SYMBOL,[
277 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
280 AC_DEFUN(TUXBOX_APPS_GETTEXT,[
281 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
282 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
283 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
285 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
287 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
288 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
289 (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)],
292 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
294 AC_MSG_CHECKING([whether NLS is requested])
296 [ --disable-nls do not use Native Language Support],
297 USE_NLS=$enableval, USE_NLS=yes)
298 AC_MSG_RESULT($USE_NLS)
301 if test "$USE_NLS" = "yes"; then
302 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
305 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
306 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
308 extern int _nl_msg_cat_cntr;
309 extern int *_nl_domain_bindings;
311 bindtextdomain ("", "");
312 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
313 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
317 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
318 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
319 gt_use_preinstalled_gnugettext=yes
325 if test -f "$srcdir/po/LINGUAS"; then
326 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
333 for lang in $ALL_LINGUAS; do
334 POFILES="$POFILES $srcdirpre$lang.po"
335 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
336 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
337 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
340 if test -n "$ALL_LINGUAS"; then
341 for presentlang in $ALL_LINGUAS; do
343 if test -n "$LINGUAS"; then
344 desiredlanguages="$LINGUAS"
346 desiredlanguages="$ALL_LINGUAS"
348 for desiredlang in $desiredlanguages; do
349 case "$desiredlang" in
350 "$presentlang"*) useit=yes;;
353 if test $useit = yes; then
354 INST_LINGUAS="$INST_LINGUAS $presentlang"
359 if test -n "$INST_LINGUAS"; then
360 for lang in $INST_LINGUAS; do
361 CATALOGS="$CATALOGS $lang.gmo"
366 AC_SUBST(UPDATEPOFILES)
367 AC_SUBST(DUMMYPOFILES)
371 dnl backward compatiblity
372 AC_DEFUN([AC_GNU_SOURCE],
373 [AH_VERBATIM([_GNU_SOURCE],
374 [/* Enable GNU extensions on systems that have them. */
378 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
379 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
380 AC_DEFINE([_GNU_SOURCE])
383 AC_DEFUN([AC_PROG_EGREP],
384 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
385 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
386 then ac_cv_prog_egrep='grep -E'
387 else ac_cv_prog_egrep='egrep'
389 EGREP=$ac_cv_prog_egrep
393 AC_DEFUN([AC_PYTHON_DEVEL],[
395 # should allow for checking of python version here...
397 AC_REQUIRE([AM_PATH_PYTHON])
399 # Check for Python include path
400 AC_MSG_CHECKING([for Python include path])
401 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
402 for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
403 python_path=`find $i -type f -name Python.h -print | sed "1q"`
404 if test -n "$python_path" ; then
408 python_path=`echo $python_path | sed "s,/Python.h$,,"`
409 AC_MSG_RESULT([$python_path])
410 if test -z "$python_path" ; then
411 AC_MSG_ERROR([cannot find Python include path])
413 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
415 # Check for Python library path
416 AC_MSG_CHECKING([for Python library path])
417 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
418 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
419 python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
420 if test -n "$python_path" ; then
424 python_path=`echo $python_path | sed "s,/libpython.*$,,"`
425 AC_MSG_RESULT([$python_path])
426 if test -z "$python_path" ; then
427 AC_MSG_ERROR([cannot find Python library path])
429 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
431 python_site=`echo $python_path | sed "s/config/site-packages/"`
432 AC_SUBST([PYTHON_SITE_PKG],[$python_site])