1 # aclocal.m4 - Local additions to Autoconf macros.
2 # Copyright (C) 1995 - 2006 Michael Riepe
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # @(#) $Id: aclocal.m4,v 1.27 2007/09/07 12:07:59 michael Exp $
22 dnl mr_PACKAGE(package-name)
23 AC_DEFUN(mr_PACKAGE, [changequote(<<, >>)dnl
26 VERSION=`cat $srcdir/VERSION`
29 AC_ARG_ENABLE(maintainer-mode,
30 [ --enable-maintainer-mode
31 enable maintainer-specific make rules (default: auto)],
32 [mr_enable_maintainer_mode="$enableval"],
33 [case :${I_AM_THE_MAINTAINER_OF}: in
34 *:$1:*) mr_enable_maintainer_mode=yes;;
35 *) mr_enable_maintainer_mode=no;;
37 if test x"$mr_enable_maintainer_mode" = x"yes"; then
40 MAINT='maintainer-only-'
45 AC_DEFUN(mr_ENABLE_NLS, [
48 # Needed for `make dist' even if NLS is disabled.
52 for mr_lang in $ALL_LINGUAS; do
53 GMOFILES="$GMOFILES $mr_lang.gmo"
54 MSGFILES="$MSGFILES $mr_lang.msg"
55 POFILES="$POFILES $mr_lang.po"
61 AC_MSG_CHECKING([whether NLS is requested])
63 [ --enable-nls use Native Language Support (default: yes)],
64 [mr_enable_nls="$enableval"],
66 AC_MSG_RESULT($mr_enable_nls)
71 if test "$mr_enable_nls" = yes; then
72 mr_PATH=`echo ":$PATH" | sed -e 's,:[^:]*openwin[^:]*,,g' -e 's,^:,,'`
73 AC_CACHE_CHECK([for dgettext],
74 mr_cv_func_dgettext, [
75 AC_TRY_LINK([#include <libintl.h>],
76 [char *s = dgettext("", ""); return 0],
77 [mr_cv_func_dgettext=yes],
78 [mr_cv_func_dgettext=no])
80 if test "$mr_cv_func_dgettext" = yes; then
81 AC_PATH_PROG(MSGFMT, msgfmt, no, $mr_PATH)
82 if test "$MSGFMT" != no; then
83 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT, $mr_PATH)
84 AC_PATH_PROG(XGETTEXT, xgettext, xgettext, $mr_PATH)
85 AC_PATH_PROG(MSGMERGE, msgmerge, msgmerge, $mr_PATH)
86 AC_CACHE_CHECK([for GNU gettext],
89 [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr],
90 [mr_cv_gnu_gettext=yes],
91 [mr_cv_gnu_gettext=no])
93 if test "$mr_cv_gnu_gettext" = yes; then
94 AC_CACHE_CHECK([for losing catgets-based GNU gettext],
95 mr_cv_catgets_based_gettext, [
97 [extern int _msg_tbl_length; return _msg_tbl_length],
98 [mr_cv_catgets_based_gettext=yes],
99 [mr_cv_catgets_based_gettext=no])
101 if test "$mr_cv_catgets_based_gettext" = yes; then
102 # This loses completely. Turn it off and use catgets.
103 LIBS=`echo $LIBS | sed 's,-lintl,,g'`
104 mr_cv_func_dgettext=no
106 # Is there a better test for this case?
107 AC_CACHE_CHECK([for pure GNU gettext],
108 mr_cv_pure_gnu_gettext, [
110 [extern int gettext(); return gettext()],
111 [mr_cv_pure_gnu_gettext=yes],
112 [mr_cv_pure_gnu_gettext=no])
114 if test "$mr_cv_pure_gnu_gettext" = yes; then
116 localedir='$(prefix)/share/locale'
119 localedir='$(prefix)/lib/locale'
124 # System provided gettext
127 localedir='$(prefix)/lib/locale'
130 # Gettext but no msgfmt. Try catgets.
131 mr_cv_func_dgettext=no
134 if test "$mr_cv_func_dgettext" = yes; then
135 AC_DEFINE(HAVE_DGETTEXT)
137 AC_CACHE_CHECK([for catgets], mr_cv_func_catgets, [
138 AC_TRY_LINK([#include <nl_types.h>],
139 [catgets(catopen("",0),0,0,"");return 0;],
140 [mr_cv_func_catgets=yes],
141 [mr_cv_func_catgets=no])
143 if test "$mr_cv_func_catgets" = yes; then
144 AC_PATH_PROG(GENCAT, gencat, no, $mr_PATH)
145 if test "$GENCAT" != no; then
146 AC_DEFINE(HAVE_CATGETS)
147 AC_PATH_PROG(GMSGFMT, [gmsgfmt msgfmt], msgfmt, $mr_PATH)
148 AC_PATH_PROG(XGETTEXT, xgettext, xgettext, $mr_PATH)
151 localedir='$(prefix)/lib/locale'
154 AC_MSG_WARN([no NLS support, disabled])
165 if test "$mr_enable_nls" = yes; then
166 AC_MSG_CHECKING([for catalogs to be installed])
168 for mr_lang in ${LINGUAS=$ALL_LINGUAS}; do
169 case " $ALL_LINGUAS " in
171 mr_linguas="$mr_linguas$mr_lang "
172 CATALOGS="$CATALOGS $mr_lang$CATOBJEXT"
176 AC_MSG_RESULT($mr_linguas)
183 AC_DEFUN(mr_TARGET_ELF, [
185 AC_CACHE_CHECK([for native ELF system],
187 [AC_TRY_RUN(changequote(<<, >>)dnl
190 main(int argc, char **argv) {
195 if ((fp = fopen(*argv, "r")) == NULL) {
198 n = fread(buf, 1, sizeof(buf), fp);
207 }>>, changequote([, ])dnl
208 mr_cv_target_elf=yes,
210 mr_cv_target_elf=no)])])
212 AC_DEFUN(mr_ENABLE_SHARED, [
221 AC_MSG_CHECKING([whether to build a shared library])
222 AC_ARG_ENABLE(shared,
223 [ --enable-shared build shared library (default: yes)],
224 [mr_enable_shared="$enableval"],
225 [mr_enable_shared=yes])
226 AC_MSG_RESULT($mr_enable_shared)
227 if test "$mr_enable_shared" = yes; then
228 AC_MSG_CHECKING([whether GNU naming conventions are requested])
229 AC_ARG_ENABLE(gnu-names,
230 [ --enable-gnu-names use GNU library naming conventions (default: no)],
231 [mr_enable_gnu_names="$enableval"],
232 [mr_enable_gnu_names=no])
233 AC_MSG_RESULT($mr_enable_gnu_names)
234 AC_REQUIRE([AC_CANONICAL_HOST])
235 AC_REQUIRE([AC_PROG_CC])
236 AC_PATH_PROG(LD, ld, ld)
239 if test "$GCC" = yes; then
241 if test "$mr_cv_target_elf" = yes; then
242 PICFLAGS='-fPIC -DPIC'
243 if test "$mr_enable_gnu_names" = yes
244 then SHLIB_SFX='-$(VERSION).so'
245 else SHLIB_SFX='.so.$(VERSION)'
248 SONAME_SFX='.so.$(MAJOR)'
249 LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
250 INSTALL_SHLIB='$(INSTALL_PROGRAM)'
253 AC_MSG_WARN([shared libraries not supported for $host])
256 elif ${CC} -V 2>&1 | grep 'Intel(R) C++ Compiler' >/dev/null 2>&1; then
257 AC_MSG_WARN([Use --disable-shared if $CC fails to build the shared library])
258 PICFLAGS='-fPIC -DPIC'
259 if test "$mr_enable_gnu_names" = yes
260 then SHLIB_SFX='-$(VERSION).so'
261 else SHLIB_SFX='.so.$(VERSION)'
264 SONAME_SFX='.so.$(MAJOR)'
265 LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
266 INSTALL_SHLIB='$(INSTALL_PROGRAM)'
269 AC_MSG_WARN([GNU CC required for building shared libraries])
275 if test "$mr_cv_target_elf" = yes; then
276 PICFLAGS='-fPIC -DPIC'
277 if test "$mr_enable_gnu_names" = yes
278 then SHLIB_SFX='-$(VERSION).so'
279 else SHLIB_SFX='.so.$(VERSION)'
282 SONAME_SFX='.so.$(MAJOR)'
283 LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
284 INSTALL_SHLIB='$(INSTALL_PROGRAM)'
287 AC_MSG_WARN([shared libraries not supported for $host])
292 if test "$GCC" = yes; then
293 PICFLAGS='-fPIC -DPIC'
295 PICFLAGS='-K PIC -DPIC'
297 if test "$mr_enable_gnu_names" = yes
298 then SHLIB_SFX='-$(MAJOR).so'
299 else SHLIB_SFX='.so.$(MAJOR)'
301 SONAME_SFX='.so.$(MAJOR)'
303 LINK_SHLIB='$(LD) -G -z text -h $(SONAME)'
304 INSTALL_SHLIB='$(INSTALL_PROGRAM)'
307 AC_MSG_WARN([shared libraries not supported for $host])
319 AC_SUBST(INSTALL_SHLIB)
321 DO_SHLIB="$mr_enable_shared"
325 AC_DEFUN(mr_ENABLE_DEBUG, [
328 [ --enable-debug include extra debugging code (default: no)],
329 [mr_enable_debug="$enableval"],
330 [mr_enable_debug=no])
331 if test "$mr_enable_debug" = yes; then
332 AC_DEFINE(ENABLE_DEBUG)
336 # vi: set ts=8 sw=2 :