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