168157a692af39136f005cd18a73bcae0d5779d8
[vuplus_dvbapp] / m4 / tuxbox.m4
1 AC_DEFUN([TUXBOX_APPS_DIRECTORY_ONE],[
2 AC_ARG_WITH($1,[  $6$7 [[PREFIX$4$5]]],[
3         _$2=$withval
4         if test "$TARGET" = "cdk"; then
5                 $2=`eval echo "${targetprefix}$withval"`
6         else
7                 $2=$withval
8         fi
9 ],[
10         $2="\${$3}$5"
11         if test "$TARGET" = "cdk"; then
12                 _$2=`eval echo "${target$3}$5"`
13         else
14                 _$2=`eval echo "${$3}$5"`
15         fi
16 ])
17
18 dnl automake <= 1.6 don't support this
19 dnl AC_SUBST($2)
20 AC_DEFINE_UNQUOTED($2,"$_$2",$7)
21 ])
22
23 AC_DEFUN([TUXBOX_APPS_DIRECTORY],[
24 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
25         [--with-configdir=PATH   ],[where to find the config files])
26
27 TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,,
28         [--with-datadir=PATH     ],[where to find data])
29
30 TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts,
31         [--with-fontdir=PATH     ],[where to find the fonts])
32
33 TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,,
34         [--with-libdir=PATH      ],[where to find the internal libs])
35 ])
36
37 dnl automake <= 1.6 needs this specifications
38 AC_SUBST(CONFIGDIR)
39 AC_SUBST(DATADIR)
40 AC_SUBST(FONTDIR)
41 AC_SUBST(LIBDIR)
42 dnl end workaround
43
44 AC_DEFUN([TUXBOX_APPS_DVB],[
45 AC_ARG_WITH(dvbincludes,
46         [  --with-dvbincludes=PATH  path for dvb includes [[NONE]]],
47         [DVBINCLUDES="$withval"],[DVBINCLUDES=""])
48
49 if test "$DVBINCLUDES"; then
50         CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES"
51 fi
52
53 AC_CHECK_HEADERS(ost/dmx.h,[
54         DVB_API_VERSION=1
55         AC_MSG_NOTICE([found dvb version 1])
56 ])
57
58 if test -z "$DVB_API_VERSION"; then
59 AC_CHECK_HEADERS(linux/dvb/version.h,[
60         AC_LANG_PREPROC_REQUIRE()
61         AC_REQUIRE([AC_PROG_EGREP])
62         AC_LANG_CONFTEST([AC_LANG_SOURCE([[
63 #include <linux/dvb/version.h>
64 version DVB_API_VERSION
65         ]])])
66         DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"`
67         rm -f conftest*
68
69         AC_MSG_NOTICE([found dvb version $DVB_API_VERSION])
70 ])
71 fi
72
73 if test "$DVB_API_VERSION"; then
74         AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes])
75         AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api])
76 else
77         AC_MSG_ERROR([can't find dvb headers])
78 fi
79 ])
80
81 AC_DEFUN([TUXBOX_APPS_GETTEXT],[
82 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
83         [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
84         (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
85         :)
86 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
87
88 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
89         [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
90         (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)],
91         :)
92
93 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,[$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1],:)
94
95 AC_MSG_CHECKING([whether NLS is requested])
96 AC_ARG_ENABLE(nls,
97         [  --disable-nls           do not use Native Language Support],
98         USE_NLS=$enableval, USE_NLS=yes)
99 AC_MSG_RESULT($USE_NLS)
100 AC_SUBST(USE_NLS)
101
102 if test "$USE_NLS" = "yes"; then
103         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,[
104                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
105                         #include <libintl.h>
106                         #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
107                         #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
108                         #endif
109                         extern int _nl_msg_cat_cntr;
110                         extern int *_nl_domain_bindings;
111                         ]], [[
112                         bindtextdomain ("", "");
113                         return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings;
114                         ]])],[gt_cv_func_gnugettext_libc=yes],[gt_cv_func_gnugettext_libc=no
115                 ])]
116         )
117
118         if test "$gt_cv_func_gnugettext_libc" = "yes"; then
119                 AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.])
120                 gt_use_preinstalled_gnugettext=yes
121         else
122                 USE_NLS=no
123         fi
124 fi
125
126 if test -f "$srcdir/po/LINGUAS"; then
127         ALL_LINGUAS=$(sed -e "/^#/d" "$srcdir/po/LINGUAS")
128 fi
129
130 POFILES=
131 GMOFILES=
132 UPDATEPOFILES=
133 DUMMYPOFILES=
134 for lang in $ALL_LINGUAS; do
135         POFILES="$POFILES $srcdirpre$lang.po"
136         GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
137         UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
138         DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
139 done
140 INST_LINGUAS=
141 if test -n "$ALL_LINGUAS"; then
142         for presentlang in $ALL_LINGUAS; do
143                 useit=no
144                 if test -n "$LINGUAS"; then
145                         desiredlanguages="$LINGUAS"
146                 else
147                         desiredlanguages="$ALL_LINGUAS"
148                 fi
149                 for desiredlang in $desiredlanguages; do
150                         case "$desiredlang" in
151                                 "$presentlang"*) useit=yes;;
152                         esac
153                 done
154                 if test $useit = yes; then
155                         INST_LINGUAS="$INST_LINGUAS $presentlang"
156                 fi
157         done
158 fi
159 CATALOGS=
160 if test -n "$INST_LINGUAS"; then
161         for lang in $INST_LINGUAS; do
162                 CATALOGS="$CATALOGS $lang.gmo"
163         done
164 fi
165 AC_SUBST(POFILES)
166 AC_SUBST(GMOFILES)
167 AC_SUBST(UPDATEPOFILES)
168 AC_SUBST(DUMMYPOFILES)
169 AC_SUBST(CATALOGS)
170 ])