1 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
2 AC_DEFUN(BFD_BINARY_FOPEN,
3 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
6 i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
8 AC_DEFINE(USE_BINARY_FOPEN) ;;
11 dnl Get a default for CC_FOR_BUILD to put into Makefile.
12 AC_DEFUN(BFD_CC_FOR_BUILD,
13 [# Put a plausible default for CC_FOR_BUILD in Makefile.
14 if test -z "$CC_FOR_BUILD"; then
15 if test "x$cross_compiling" = "xno"; then
21 AC_SUBST(CC_FOR_BUILD)
22 # Also set EXEEXT_FOR_BUILD.
23 if test "x$cross_compiling" = "xno"; then
24 EXEEXT_FOR_BUILD='$(EXEEXT)'
26 AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
27 [cat > ac_c_test.c << 'EOF'
29 /* Nothing needed here */
32 ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
33 bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
35 test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
37 test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
39 AC_SUBST(EXEEXT_FOR_BUILD)])dnl
41 dnl See whether we need a declaration for a function.
42 AC_DEFUN(BFD_NEED_DECLARATION,
43 [AC_MSG_CHECKING([whether $1 must be declared])
44 AC_CACHE_VAL(bfd_cv_decl_needed_$1,
60 [char *(*pfn) = (char *(*)) $1],
61 bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
62 AC_MSG_RESULT($bfd_cv_decl_needed_$1)
63 if test $bfd_cv_decl_needed_$1 = yes; then
64 bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
65 AC_DEFINE_UNQUOTED($bfd_tr_decl)
70 # This file is derived from `gettext.m4'. The difference is that the
71 # included macros assume Cygnus-style source and build trees.
73 # Macro to add for using GNU gettext.
74 # Ulrich Drepper <drepper@cygnus.com>, 1995.
76 # This file file be copied and used freely without restrictions. It can
77 # be used in projects which are not available under the GNU Public License
78 # but which still want to provide support for the GNU gettext functionality.
79 # Please note that the actual code is *not* freely available.
84 [AC_MSG_CHECKING([whether NLS is requested])
85 dnl Default is enabled NLS
87 [ --disable-nls do not use Native Language Support],
88 USE_NLS=$enableval, USE_NLS=yes)
89 AC_MSG_RESULT($USE_NLS)
92 USE_INCLUDED_LIBINTL=no
94 dnl If we use NLS figure out what method
95 if test "$USE_NLS" = "yes"; then
97 AC_MSG_CHECKING([whether included gettext is requested])
98 AC_ARG_WITH(included-gettext,
99 [ --with-included-gettext use the GNU gettext library included here],
100 nls_cv_force_use_gnu_gettext=$withval,
101 nls_cv_force_use_gnu_gettext=no)
102 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
104 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
105 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
106 dnl User does not insist on using GNU NLS library. Figure out what
107 dnl to use. If gettext or catgets are available (in this order) we
108 dnl use this. Else we have to fall back to GNU NLS library.
109 dnl catgets is only used if permitted by option --with-catgets.
114 AC_CHECK_HEADER(libintl.h,
115 [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
116 [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
117 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
119 if test "$gt_cv_func_gettext_libc" != "yes"; then
120 AC_CHECK_LIB(intl, bindtextdomain,
121 [AC_CACHE_CHECK([for gettext in libintl],
122 gt_cv_func_gettext_libintl,
123 [AC_TRY_LINK([], [return (int) gettext ("")],
124 gt_cv_func_gettext_libintl=yes,
125 gt_cv_func_gettext_libintl=no)])])
128 if test "$gt_cv_func_gettext_libc" = "yes" \
129 || test "$gt_cv_func_gettext_libintl" = "yes"; then
130 AC_DEFINE(HAVE_GETTEXT)
131 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
132 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
133 if test "$MSGFMT" != "no"; then
134 AC_CHECK_FUNCS(dcgettext)
135 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
136 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
137 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
138 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
139 return _nl_msg_cat_cntr],
149 dnl In the standard gettext, we would now check for catgets.
150 dnl However, we never want to use catgets for our releases.
152 if test "$CATOBJEXT" = "NONE"; then
153 dnl Neither gettext nor catgets in included in the C library.
154 dnl Fall back on GNU gettext library.
155 nls_cv_use_gnu_gettext=yes
159 if test "$nls_cv_use_gnu_gettext" = "yes"; then
160 dnl Mark actions used to generate GNU NLS library.
161 INTLOBJS="\$(GETTOBJS)"
162 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
163 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
164 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
165 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
166 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
168 USE_INCLUDED_LIBINTL=yes
172 INTLDEPS='$(top_builddir)/../intl/libintl.a'
174 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
175 nls_cv_header_intl=libintl.h
176 nls_cv_header_libgt=libgettext.h
179 dnl Test whether we really found GNU xgettext.
180 if test "$XGETTEXT" != ":"; then
181 dnl If it is no GNU xgettext we define it as : so that the
182 dnl Makefiles still can work.
183 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
187 [found xgettext programs is not GNU xgettext; ignore it])
192 # We need to process the po/ directory.
196 nls_cv_header_intl=libintl.h
197 nls_cv_header_libgt=libgettext.h
200 # If this is used in GNU gettext we have to set USE_NLS to `yes'
201 # because some of the sources are only built for this goal.
202 if test "$PACKAGE" = gettext; then
204 USE_INCLUDED_LIBINTL=yes
207 dnl These rules are solely for the distribution goal. While doing this
208 dnl we only have to keep exactly one list of the available catalogs
210 for lang in $ALL_LINGUAS; do
211 GMOFILES="$GMOFILES $lang.gmo"
212 POFILES="$POFILES $lang.po"
215 dnl Make all variables we use known to autoconf.
216 AC_SUBST(USE_INCLUDED_LIBINTL)
219 AC_SUBST(DATADIRNAME)
229 AC_DEFUN(CY_GNU_GETTEXT,
230 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
231 AC_REQUIRE([AC_PROG_CC])dnl
232 AC_REQUIRE([AC_PROG_RANLIB])dnl
233 AC_REQUIRE([AC_ISC_POSIX])dnl
234 AC_REQUIRE([AC_HEADER_STDC])dnl
235 AC_REQUIRE([AC_C_CONST])dnl
236 AC_REQUIRE([AC_C_INLINE])dnl
237 AC_REQUIRE([AC_TYPE_OFF_T])dnl
238 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
239 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
240 AC_REQUIRE([AC_FUNC_MMAP])dnl
242 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
243 unistd.h values.h sys/param.h])
244 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
245 __argz_count __argz_stringify __argz_next])
247 if test "${ac_cv_func_stpcpy+set}" != "set"; then
248 AC_CHECK_FUNCS(stpcpy)
250 if test "${ac_cv_func_stpcpy}" = "yes"; then
251 AC_DEFINE(HAVE_STPCPY)
257 if test "x$CATOBJEXT" != "x"; then
258 if test "x$ALL_LINGUAS" = "x"; then
261 AC_MSG_CHECKING(for catalogs to be installed)
263 for lang in ${LINGUAS=$ALL_LINGUAS}; do
264 case "$ALL_LINGUAS" in
265 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
269 AC_MSG_RESULT($LINGUAS)
272 dnl Construct list of names of catalog files to be constructed.
273 if test -n "$LINGUAS"; then
274 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
278 dnl The reference to <locale.h> in the installed <libintl.h> file
279 dnl must be resolved because we cannot expect the users of this
280 dnl to define HAVE_LOCALE_H.
281 if test $ac_cv_header_locale_h = yes; then
282 INCLUDE_LOCALE_H="#include <locale.h>"
285 /* The system does not provide the header <locale.h>. Take care yourself. */"
287 AC_SUBST(INCLUDE_LOCALE_H)
289 dnl Determine which catalog format we have (if any is needed)
290 dnl For now we know about two different formats:
291 dnl Linux libc-5 and the normal X/Open format
292 if test -f $srcdir/po2tbl.sed.in; then
293 if test "$CATOBJEXT" = ".cat"; then
294 AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
296 dnl Transform the SED scripts while copying because some dumb SEDs
297 dnl cannot handle comments.
298 sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
300 dnl po2tbl.sed is always needed.
301 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
302 $srcdir/po2tbl.sed.in > po2tbl.sed
305 dnl In the intl/Makefile.in we have a special dependency which makes
306 dnl only sense for gettext. We comment this out for non-gettext
308 if test "$PACKAGE" = "gettext"; then
318 MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
319 AC_SUBST(MKINSTALLDIRS)
321 dnl *** For now the libtool support in intl/Makefile is not for real.
325 dnl Generate list of files to be processed by xgettext which will
326 dnl be included in po/Makefile. But only do this if the po directory
327 dnl exists in srcdir.
328 if test -d $srcdir/po; then
329 test -d po || mkdir po
330 if test "x$srcdir" != "x."; then
331 if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
332 posrcprefix="$srcdir/"
334 posrcprefix="../$srcdir/"
340 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
341 < $srcdir/po/POTFILES.in > po/POTFILES
345 # Search path for a program which passes the given test.
346 # Ulrich Drepper <drepper@cygnus.com>, 1996.
348 # This file file be copied and used freely without restrictions. It can
349 # be used in projects which are not available under the GNU Public License
350 # but which still want to provide support for the GNU gettext functionality.
351 # Please note that the actual code is *not* freely available.
355 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
356 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
357 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
358 [# Extract the first word of "$2", so it can be a program name with args.
359 set dummy $2; ac_word=[$]2
360 AC_MSG_CHECKING([for $ac_word])
361 AC_CACHE_VAL(ac_cv_path_$1,
364 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
367 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
368 for ac_dir in ifelse([$5], , $PATH, [$5]); do
369 test -z "$ac_dir" && ac_dir=.
370 if test -f $ac_dir/$ac_word; then
372 ac_cv_path_$1="$ac_dir/$ac_word"
378 dnl If no 4th arg is given, leave the cache variable unset,
379 dnl so AC_PATH_PROGS will keep looking.
380 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
385 if test -n "[$]$1"; then
393 # Check whether LC_MESSAGES is available in <locale.h>.
394 # Ulrich Drepper <drepper@cygnus.com>, 1995.
396 # This file file be copied and used freely without restrictions. It can
397 # be used in projects which are not available under the GNU Public License
398 # but which still want to provide support for the GNU gettext functionality.
399 # Please note that the actual code is *not* freely available.
403 AC_DEFUN(AM_LC_MESSAGES,
404 [if test $ac_cv_header_locale_h = yes; then
405 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
406 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
407 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
408 if test $am_cv_val_LC_MESSAGES = yes; then
409 AC_DEFINE(HAVE_LC_MESSAGES)
414 dnl Check for existence of a type $1 in sys/procfs.h
416 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
417 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
418 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
419 [AC_TRY_COMPILE([#include <sys/procfs.h>],
421 bfd_cv_have_sys_procfs_type_$1=yes
422 AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])),
423 bfd_cv_have_sys_procfs_type_$1=no
425 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
429 dnl Check for existence of member $2 in type $1 in sys/procfs.h
431 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
432 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
433 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
434 [AC_TRY_COMPILE([#include <sys/procfs.h>],
435 [$1 avar; void* aref = (void*) &avar.$2],
436 bfd_cv_have_sys_procfs_type_member_$1_$2=yes
437 AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z])),
438 bfd_cv_have_sys_procfs_type_member_$1_$2=no
440 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)