2 AM_CONFIG_HEADER(config.h)
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 [[PREFIX[for native], /[for cdk]]]],
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 if test "$TARGET" = "native"; then
26 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
27 CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
28 CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
30 if test "$prefix" = "NONE"; then
33 if test "$targetprefix" = "NONE"; then
34 targetprefix="\${prefix}"
35 _targetprefix="${prefix}"
37 _targetprefix="$targetprefix"
39 elif test "$TARGET" = "cdk"; then
40 if test "$CC" = "" -a "$CXX" = ""; then
41 CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
43 if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
44 CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
45 CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
47 if test "$prefix" = "NONE"; then
50 if test "$targetprefix" = "NONE"; then
54 _targetprefix="$targetprefix"
56 if test "$host_alias" = ""; then
58 host_alias=powerpc-tuxbox-linux-gnu
61 AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
67 targetdatadir="\${targetprefix}/share"
68 _targetdatadir="${_targetprefix}/share"
69 targetsysconfdir="\${targetprefix}/etc"
70 _targetsysconfdir="${_targetprefix}/etc"
71 targetlocalstatedir="\${targetprefix}/var"
72 _targetlocalstatedir="${_targetprefix}/var"
73 targetlibdir="\${targetprefix}/lib"
74 _targetlibdir="${_targetprefix}/lib"
75 AC_SUBST(targetprefix)
76 AC_SUBST(targetdatadir)
77 AC_SUBST(targetsysconfdir)
78 AC_SUBST(targetlocalstatedir)
81 return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
86 AC_DEFUN(TUXBOX_APPS_DIRECTORY,[
87 AC_REQUIRE([TUXBOX_APPS])
89 CONFIGDIR="\${localstatedir}/tuxbox/config"
90 _CONFIGDIR="${_targetlocalstatedir}/tuxbox/config"
92 AC_DEFINE_UNQUOTED(CONFIGDIR,"$_CONFIGDIR",[where to find the config files])
94 DATADIR="\${datadir}/tuxbox"
95 _DATADIR="${_targetdatadir}/tuxbox"
97 AC_DEFINE_UNQUOTED(DATADIR,"$_DATADIR",[where to find data like icons])
99 FONTDIR="\${datadir}/fonts"
100 _FONTDIR="${_targetdatadir}/fonts"
102 AC_DEFINE_UNQUOTED(FONTDIR,"$_FONTDIR",[where to find the fonts])
104 GAMESDIR="\${localstatedir}/tuxbox/games"
105 _GAMESDIR="${_targetlocalstatedir}/tuxbox/games"
107 AC_DEFINE_UNQUOTED(GAMESDIR,"$_GAMESDIR",[where games data is stored])
109 LIBDIR="\${libdir}/tuxbox"
110 _LIBDIR="${_targetlibdir}/tuxbox"
113 AC_DEFINE_UNQUOTED(LIBDIR,"$_LIBDIR",[where to find the internal libs])
115 PLUGINDIR="\${libdir}/tuxbox/plugins"
116 _PLUGINDIR="${_targetlibdir}/tuxbox/plugins"
118 AC_DEFINE_UNQUOTED(PLUGINDIR,"$_PLUGINDIR",[where to find the plugins])
120 UCODEDIR="\${localstatedir}/tuxbox/ucodes"
121 _UCODEDIR="${_targetlocalstatedir}/tuxbox/ucodes"
123 AC_DEFINE_UNQUOTED(UCODEDIR,"$_UCODEDIR",[where to find the ucodes (firmware)])
126 AC_DEFUN(TUXBOX_APPS_ENDIAN,[
127 AC_CHECK_HEADERS(endian.h)
131 AC_DEFUN(TUXBOX_APPS_DRIVER,[
133 [ --with-driver=PATH path for driver sources[[NONE]]],
134 [DRIVER="$withval"],[DRIVER=""])
136 if test -z "$DRIVER"; then
137 AC_MSG_ERROR([can't find driver sources])
139 CPPFLAGS="$CPPFLAGS -I$DRIVER/include"
143 AC_DEFUN([TUXBOX_APPS_DVB],[
144 AC_ARG_WITH(dvbincludes,
145 [ --with-dvbincludes=PATH path for dvb includes [[NONE]]],
146 [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
148 if test "$DVBINCLUDES"; then
149 CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
152 AC_CHECK_HEADERS(ost/dmx.h,[
154 AC_MSG_NOTICE([found dvb version 1])
157 if test -z "$DVB_API_VERSION"; then
158 AC_CHECK_HEADERS(linux/dvb/version.h,[
159 AC_LANG_PREPROC_REQUIRE()
160 AC_REQUIRE([AC_PROG_EGREP])
161 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
162 #include <linux/dvb/version.h>
163 version DVB_API_VERSION
165 DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
168 AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
172 if test "$DVB_API_VERSION"; then
173 AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
174 AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
176 AC_MSG_ERROR([can't find dvb headers])
181 AC_DEFUN(_TUXBOX_APPS_LIB_CONFIG,[
182 AC_PATH_PROG($1_CONFIG,$2,no)
183 if test "$$1_CONFIG" != "no"; then
184 if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
185 AC_MSG_$3([could not find a suitable version of $2]);
187 $1_CFLAGS=$($$1_CONFIG --cflags)
188 $1_LIBS=$($$1_CONFIG --libs)
196 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG,[
197 _TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
198 if test "$$1_CONFIG" = "no"; then
199 AC_MSG_ERROR([could not find $2]);
203 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_CHECK,[
204 _TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
207 AC_DEFUN(TUXBOX_APPS_PKGCONFIG,[
208 AC_PATH_PROG(PKG_CONFIG, pkg-config,no)
209 if test "$PKG_CONFIG" = "no" ; then
210 AC_MSG_ERROR([could not find pkg-config]);
214 AC_DEFUN(_TUXBOX_APPS_LIB_PKGCONFIG,[
215 AC_REQUIRE([TUXBOX_APPS_PKGCONFIG])
216 AC_MSG_CHECKING(for package $2)
217 if PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --exists "$2" ; then
219 $1_CFLAGS=$(PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --cflags "$2")
220 $1_LIBS=$(PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" $PKG_CONFIG --libs "$2")
229 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG,[
230 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
231 if test -z "$$1_CFLAGS" ; then
232 AC_MSG_ERROR([could not find package $2]);
236 AC_DEFUN(TUXBOX_APPS_LIB_PKGCONFIG_CHECK,[
237 _TUXBOX_APPS_LIB_PKGCONFIG($1,$2)
240 AC_DEFUN(_TUXBOX_APPS_LIB_SYMBOL,[
241 AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
242 if test "$HAVE_$1" = "yes"; then
249 AC_DEFUN(TUXBOX_APPS_LIB_SYMBOL,[
250 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
251 if test "$HAVE_$1" = "no"; then
252 AC_MSG_ERROR([could not find $2]);
256 AC_DEFUN(TUXBOX_APPS_LIB_CONFIG_SYMBOL,[
257 _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
260 AC_DEFUN(TUXBOX_APPS_GETTEXT,[
261 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
262 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
263 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
265 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
267 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
268 [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
269 (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)],
272 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
274 AC_MSG_CHECKING([whether NLS is requested])
276 [ --disable-nls do not use Native Language Support],
277 USE_NLS=$enableval, USE_NLS=yes)
278 AC_MSG_RESULT($USE_NLS)
281 if test "$USE_NLS" = "yes"; then
282 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
285 #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
286 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
288 extern int _nl_msg_cat_cntr;
289 extern int *_nl_domain_bindings;
291 bindtextdomain ("", "");
292 return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
293 ], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no
297 if test "$gt_cv_func_gnugettext_libc" = "yes"; then
298 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
299 gt_use_preinstalled_gnugettext=yes
305 if test -f "$srcdir/po/LINGUAS"; then
306 ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
313 for lang in $ALL_LINGUAS; do
314 POFILES="$POFILES $srcdirpre$lang.po"
315 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
316 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
317 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
320 if test -n "$ALL_LINGUAS"; then
321 for presentlang in $ALL_LINGUAS; do
323 if test -n "$LINGUAS"; then
324 desiredlanguages="$LINGUAS"
326 desiredlanguages="$ALL_LINGUAS"
328 for desiredlang in $desiredlanguages; do
329 case "$desiredlang" in
330 "$presentlang"*) useit=yes;;
333 if test $useit = yes; then
334 INST_LINGUAS="$INST_LINGUAS $presentlang"
339 if test -n "$INST_LINGUAS"; then
340 for lang in $INST_LINGUAS; do
341 CATALOGS="$CATALOGS $lang.gmo"
346 AC_SUBST(UPDATEPOFILES)
347 AC_SUBST(DUMMYPOFILES)
353 AC_DEFUN([AC_GNU_SOURCE],
354 [AH_VERBATIM([_GNU_SOURCE],
355 [/* Enable GNU extensions on systems that have them. */
359 AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
360 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
361 AC_DEFINE([_GNU_SOURCE])