2 AM_CONFIG_HEADER(config.h)
11 [ --with-target=TARGET target for compilation [[native,cdk]]],
12 [TARGET="$withval"],[TARGET="native"])
14 AC_ARG_WITH(targetprefix,
15 [ --with-targetprefix=PATH prefix relative to target root (only applicable in cdk mode)],
16 [targetprefix="$withval"],[targetprefix="NONE"])
19 [ --without-debug disable debugging code],
20 [DEBUG="$withval"],[DEBUG="yes"])
22 if test "$DEBUG" = "yes"; then
23 DEBUG_CFLAGS="-g3 -ggdb"
24 AC_DEFINE(DEBUG,1,[Enable debug messages])
27 AC_MSG_CHECKING(target)
29 if test "$TARGET" = "native"; then
32 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
33 CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
34 CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
36 if test "$prefix" = "NONE"; then
40 elif test "$TARGET" = "cdk"; then
43 if test "$CC" = "" -a "$CXX" = ""; then
44 CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
46 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
47 CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
48 CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
50 if test "$prefix" = "NONE"; then
51 AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
53 if test "$targetprefix" = "NONE"; then
56 if test "$host_alias" = ""; then
58 host_alias=powerpc-tuxbox-linux-gnu
62 AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
69 return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
74 AC_DEFUN(TUXBOX_APPS_DIRECTORY_ONE,[
75 AC_ARG_WITH($1,[ $6$7 [[PREFIX$4$5]]],[
77 if test "$TARGET" = "cdk"; then
78 $2=`eval echo "${targetprefix}$withval"`
84 if test "$TARGET" = "cdk"; then
85 _$2=`eval echo "${target$3}$5"`
87 _$2=`eval echo "${$3}$5"`
91 dnl automake <= 1.6 don't support this
93 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
96 AC_DEFUN(TUXBOX_APPS_DIRECTORY,[
97 AC_REQUIRE([TUXBOX_APPS])
99 if test "$TARGET" = "cdk"; then
100 datadir="\${prefix}/share"
101 tuxboxdatadir="\${prefix}/share/tuxbox"
102 zoneinfodir="\${datadir}/zoneinfo"
103 sysconfdir="\${prefix}/etc"
104 localstatedir="\${prefix}/var"
105 localedir="\${prefix}/var"
106 libdir="\${prefix}/lib"
107 targetdatadir="\${targetprefix}/share"
108 targetsysconfdir="\${targetprefix}/etc"
109 targetlocalstatedir="\${targetprefix}/var"
110 targetlibdir="\${targetprefix}/lib"
113 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
114 [--with-configdir=PATH ],[where to find the config files])
116 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
117 [--with-datadir=PATH ],[where to find data])
119 TUXBOX_APPS_DIRECTORY_ONE(localedir,LOCALEDIR,datadir,/share,/locale,
120 [--with-localedir=PATH ],[where to find locales])
122 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
123 [--with-fontdir=PATH ],[where to find the fonts])
125 TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games,
126 [--with-gamesdir=PATH ],[where games data is stored])
128 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,/tuxbox,
129 [--with-libdir=PATH ],[where to find the internal libs])
131 TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins,
132 [--with-plugindir=PATH ],[where to find the plugins])
134 TUXBOX_APPS_DIRECTORY_ONE(tuxboxdatadir,TUXBOXDATADIR,datadir,/share,/tuxbox,
135 [--with-tuxboxdatadir=PATH],[where to find tuxbox data])
137 TUXBOX_APPS_DIRECTORY_ONE(zoneinfodir,ZONEINFODIR,datadir,/share,/zoneinfo,
138 [--with-zoneinfodir=PATH ],[where to find zoneinfo db])
141 dnl automake <= 1.6 needs this specifications
144 AC_SUBST(ZONEINFODIR)
150 AC_SUBST(TUXBOXDATADIR)
153 AC_DEFUN(TUXBOX_APPS_ENDIAN,[
154 AC_CHECK_HEADERS(endian.h)
158 AC_DEFUN(TUXBOX_APPS_DRIVER,[
160 # [ --with-driver=PATH path for driver sources [[NONE]]],
161 # [DRIVER="$withval"],[DRIVER=""])
163 #if test -d "$DRIVER/include"; then
164 # AC_DEFINE(HAVE_DBOX2_DRIVER,1,[Define to 1 if you have the dbox2 driver sources])
166 # AC_MSG_ERROR([can't find driver sources])
171 #CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
174 AC_DEFUN([TUXBOX_APPS_DVB],[
175 AC_ARG_WITH(dvbincludes,
176 [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
177 [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
179 if test "$DVBINCLUDES"; then
180 CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
183 AC_CHECK_HEADERS(ost/dmx.h,[
185 AC_MSG_NOTICE([found dvb version 1])
188 if test -z "$DVB_API_VERSION"; then
189 AC_CHECK_HEADERS(linux/dvb/version.h,[
190 AC_LANG_PREPROC_REQUIRE()
191 AC_REQUIRE([AC_PROG_EGREP])
192 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
193 #include <linux/dvb/version.h>
194 version DVB_API_VERSION
196 DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
199 AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
203 if test "$DVB_API_VERSION"; then
204 AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
205 AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
207 AC_MSG_ERROR([can't find dvb headers])
211 AC_DEFUN(_TUXBOX_APPS_LIB_CONFIG,[
212 AC_PATH_PROG($1_CONFIG,$2,no)
213 if test "$$1_CONFIG" != "no"; then
214 if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
215 AC_MSG_$3([could not find a suitable version of $2]);
217 $1_CFLAGS=$($$1_CONFIG --cflags)
218 $1_LIBS=$($$1_CONFIG --libs)
226 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG,[
227 _TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
228 if test "$$1_CONFIG" = "no"; then
229 AC_MSG_ERROR([could not find $2]);
233 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_CHECK,[
234 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
237 AC_DEFUN(TUXBOX_APPS_PKGCONFIG,[
238 AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
239 if test "$PKG_CONFIG" = "no" ; then
240 AC_MSG_ERROR([could not find pkg-config]);
244 AC_DEFUN(_TUXBOX_APPS_LIB_PKGCONFIG,[
245 PKG_CHECK_MODULES($1,$2)
250 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG,[
251 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
252 if test -z "$$1_CFLAGS" ; then
253 AC_MSG_ERROR([could not find package $2]);
257 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG_CHECK,[
258 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
261 AC_DEFUN(_TUXBOX_APPS_LIB_SYMBOL,[
262 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
263 if test "$HAVE_$1" = "yes"; then
270 AC_DEFUN(TUXBOX_APPS_LIB_SYMBOL,[
271 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
272 if test "$HAVE_$1" = "no"; then
273 AC_MSG_ERROR([could not find $2]);
277 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_SYMBOL,[
278 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
281 AC_DEFUN(TUXBOX_APPS_GETTEXT,[
282 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
283 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
284 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
286 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
288 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
289 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
290 (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)],
293 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
295 AC_MSG_CHECKING([whether NLS is requested])
297 [ --disable-nls do not use Native Language Support],
298 USE_NLS=$enableval, USE_NLS=yes)
299 AC_MSG_RESULT($USE_NLS)
302 if test "$USE_NLS" = "yes"; then
303 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
306 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
307 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
309 extern int _nl_msg_cat_cntr;
310 extern int *_nl_domain_bindings;
312 bindtextdomain ("", "");
313 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
314 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
318 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
319 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
320 gt_use_preinstalled_gnugettext=yes
326 if test -f "$srcdir/po/LINGUAS"; then
327 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
334 for lang in $ALL_LINGUAS; do
335 POFILES="$POFILES $srcdirpre$lang.po"
336 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
337 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
338 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
341 if test -n "$ALL_LINGUAS"; then
342 for presentlang in $ALL_LINGUAS; do
344 if test -n "$LINGUAS"; then
345 desiredlanguages="$LINGUAS"
347 desiredlanguages="$ALL_LINGUAS"
349 for desiredlang in $desiredlanguages; do
350 case "$desiredlang" in
351 "$presentlang"*) useit=yes;;
354 if test $useit = yes; then
355 INST_LINGUAS="$INST_LINGUAS $presentlang"
360 if test -n "$INST_LINGUAS"; then
361 for lang in $INST_LINGUAS; do
362 CATALOGS="$CATALOGS $lang.gmo"
367 AC_SUBST(UPDATEPOFILES)
368 AC_SUBST(DUMMYPOFILES)
372 dnl backward compatiblity
373 AC_DEFUN([AC_GNU_SOURCE],
374 [AH_VERBATIM([_GNU_SOURCE],
375 [/* Enable GNU extensions on systems that have them. */
379 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
380 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
381 AC_DEFINE([_GNU_SOURCE])
384 AC_DEFUN([AC_PROG_EGREP],
385 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
386 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
387 then ac_cv_prog_egrep='grep -E'
388 else ac_cv_prog_egrep='egrep'
390 EGREP=$ac_cv_prog_egrep
394 AC_DEFUN([AC_PYTHON_DEVEL],[
396 # should allow for checking of python version here...
398 AC_REQUIRE([AM_PATH_PYTHON])
400 # Check for Python include path
401 AC_MSG_CHECKING([for Python include path])
402 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
403 for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
404 python_path=`find $i -type f -name Python.h -print | sed "1q"`
405 if test -n "$python_path" ; then
409 python_path=`echo $python_path | sed "s,/Python.h$,,"`
410 AC_MSG_RESULT([$python_path])
411 if test -z "$python_path" ; then
412 AC_MSG_ERROR([cannot find Python include path])
414 AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
416 # Check for Python library path
417 AC_MSG_CHECKING([for Python library path])
418 python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
419 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
420 python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
421 if test -n "$python_path" ; then
425 python_path=`echo $python_path | sed "s,/libpython.*$,,"`
426 AC_MSG_RESULT([$python_path])
427 if test -z "$python_path" ; then
428 AC_MSG_ERROR([cannot find Python library path])
430 AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
432 python_site=`echo $python_path | sed "s/config/site-packages/"`
433 AC_SUBST([PYTHON_SITE_PKG],[$python_site])