]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Don't use the undocumented 'getline' function on HP-UX.
authorBruno Haible <bruno@clisp.org>
Sun, 11 Mar 2001 17:45:56 +0000 (17:45 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 11 Mar 2001 17:45:56 +0000 (17:45 +0000)
ChangeLog
configure.in
m4/ChangeLog
m4/Makefile.am
m4/getline.m4 [new file with mode: 0644]

index 9bf9a76280eb8652a227b6147a063771e2d56c06..6ccb91e40329b025fbc48fe873a81c283900409a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-11  Bruno Haible  <haible@clisp.cons.org>
+
+       * configure.in: Use AM_FUNC_GETLINE instead of
+       AC_REPLACE_FUNCS(getline). Needed for HP-UX 10.
+
 2001-03-11  Bruno Haible  <haible@clisp.cons.org>
 
        * configure.in: Pass 'need-ngettext' to AM_GNU_GETTEXT.
index bd6dd502a95036c96dea7d58101f73a9e07d195f..6ed747afbffc069cab8cd5dd8681ee9ad6726c74 100644 (file)
@@ -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
 
index 2780a2dee8c089c7a743c0236eaf2ed12503d4a1..5a2a507264c0aa14c7709d6437caafa2fcbaf9e2 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-11  Bruno Haible  <haible@clisp.cons.org>
+
+       * getline.m4: New file, from fileutils-4.0.41 with modifications.
+       * Makefile.am (EXTRA_DIST): Add it.
+
 2001-03-11  Bruno Haible  <haible@clisp.cons.org>
 
        * gettext.m4 (AM_WITH_NLS): Accept a second argument 'need-ngettext'.
index caeb647589cae8a5af3ed4cf5db775abc302dcb6..e930fd74eb0405c86bb6adde23e88d76bfffc64e 100644 (file)
@@ -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 (file)
index 0000000..ebf437b
--- /dev/null
@@ -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 <stdio.h>
+#    include <sys/types.h>
+#    include <string.h>
+    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
+])