From: Bruno Haible Date: Sun, 11 Mar 2001 17:45:56 +0000 (+0000) Subject: Don't use the undocumented 'getline' function on HP-UX. X-Git-Tag: v0.10.36~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74632c82ae900d30941904144fcccf8751ddf0f8;p=thirdparty%2Fgettext.git Don't use the undocumented 'getline' function on HP-UX. --- diff --git a/ChangeLog b/ChangeLog index 9bf9a7628..6ccb91e40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-03-11 Bruno Haible + + * configure.in: Use AM_FUNC_GETLINE instead of + AC_REPLACE_FUNCS(getline). Needed for HP-UX 10. + 2001-03-11 Bruno Haible * configure.in: Pass 'need-ngettext' to AM_GNU_GETTEXT. diff --git a/configure.in b/configure.in index bd6dd502a..6ed747afb 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.13) -AC_REVISION($Revision: 1.17 $) +AC_REVISION($Revision: 1.18 $) AC_INIT(src/msgfmt.c) AM_INIT_AUTOMAKE(gettext, 0.10.36) RELEASE_DATE=2001-03-09 dnl in "date +%Y-%m-%d" format @@ -50,9 +50,10 @@ dnl Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_VPRINTF AC_CHECK_FUNCS([getcwd mblen memcpy strchr strerror uname]) -AC_REPLACE_FUNCS([getline memmove memset stpcpy stpncpy strcspn \ +AC_REPLACE_FUNCS([memmove memset stpcpy stpncpy strcspn \ strncasecmp strstr strtoul vasprintf]) -if test $ac_cv_func_getline != yes; then +AM_FUNC_GETLINE +if test $am_cv_func_working_getline != yes; then AC_CHECK_FUNCS(getdelim) fi diff --git a/m4/ChangeLog b/m4/ChangeLog index 2780a2dee..5a2a50726 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,8 @@ +2001-03-11 Bruno Haible + + * getline.m4: New file, from fileutils-4.0.41 with modifications. + * Makefile.am (EXTRA_DIST): Add it. + 2001-03-11 Bruno Haible * gettext.m4 (AM_WITH_NLS): Accept a second argument 'need-ngettext'. diff --git a/m4/Makefile.am b/m4/Makefile.am index caeb64758..e930fd74e 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -7,6 +7,6 @@ aclocal_DATA = codeset.m4 gettext.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest # find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \ # |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012' EXTRA_DIST = README \ -c-bs-a.m4 codeset.m4 gettext.m4 iconv.m4 inttypes_h.m4 isc-posix.m4 \ -lcmessage.m4 libtool.m4 progtest.m4 setlocale.m4 signed.m4 uintmax_t.m4 \ -ulonglong.m4 +c-bs-a.m4 codeset.m4 getline.m4 gettext.m4 iconv.m4 inttypes_h.m4 \ +isc-posix.m4 lcmessage.m4 libtool.m4 progtest.m4 setlocale.m4 signed.m4 \ +uintmax_t.m4 ulonglong.m4 diff --git a/m4/getline.m4 b/m4/getline.m4 new file mode 100644 index 000000000..ebf437b82 --- /dev/null +++ b/m4/getline.m4 @@ -0,0 +1,42 @@ +#serial 4 + +dnl See if there's a working, system-supplied version of the getline function. +dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems +dnl have a function by that name in -linet that doesn't have anything +dnl to do with the function we need. +AC_DEFUN([AM_FUNC_GETLINE], +[dnl + am_getline_needs_run_time_check=no + AC_CHECK_FUNC(getline, + dnl Found it in some library. Verify that it works. + am_getline_needs_run_time_check=yes, + am_cv_func_working_getline=no) + if test $am_getline_needs_run_time_check = yes; then + AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, + [echo fooN |tr -d '\012'|tr N '\012' > conftest.data + AC_TRY_RUN([ +# include +# include +# include + int main () + { /* Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len; + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + len = getline (&line, &siz, in); + exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); + } + ], am_cv_func_working_getline=yes dnl The library version works. + , am_cv_func_working_getline=no dnl The library version does NOT work. + , am_cv_func_working_getline=no dnl We're cross compiling. + )]) + fi + + if test $am_cv_func_working_getline = no; then + LIBOBJS="$LIBOBJS getline.${ac_objext}" + AC_SUBST(LIBOBJS) + fi +])