GCC 3.3 allows LyX 1.2.3 to build on HP-UX 11.x with the addition of weak symbol support. When configuring 1.2.3, snprintf/vsnprintf are not detected properly because the test is done using the C++ compiler and AC_CHECK_FUNCS doesn't provide a sensible prototype: char snprintf ();
This results in the following error: configure:16494: error: nonnull argument with out-of-range operand number (arg 1, operand 3) configure:16494: error: declaration of C function `char snprintf()' conflicts with /opt/TWWfsw/gcc33/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3/include/stdio.h:607: error: previous declaration `int snprintf(char*, long unsigned int, const char*, ...)' here configure:16518: $? = 1 The patch below fixes this by using a more accurate prototype for snprintf/vsnprintf. I suppose another solution is to switch to C for the AC_CHECK_FUNCS check. -- albert chin ([EMAIL PROTECTED]) -- snip snip --- configure.in.orig Mon Feb 17 12:32:15 2003 +++ configure.in Mon Feb 17 12:59:39 2003 @@ -315,7 +315,49 @@ AC_DEFINE(BROKEN_HEADERS, 1, [Define on SunOS 4 and SCO, were some functions are missing from the headers]) fi -AC_CHECK_FUNCS(snprintf vsnprintf) + +AC_MSG_CHECKING([for snprintf]) +AC_TRY_COMPILE([#include <stdio.h>],[ + char buffer[2]; + + snprintf (buffer, 2, "a");],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SNPRINTF, 1, + [Define if you have the `snprintf' function.])],[ + AC_TRY_COMPILE([#include <stdio.h> + +extern "C" int snprintf (char *, size_t, char const *, ...);],[ + char buffer[2]; + + snprintf (buffer, 2, "a");],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SNPRINTF, 1, + [Define if you have the `snprintf' function.])],[ + AC_MSG_RESULT(no)])]) + +AC_MSG_CHECKING([for vsnprintf]) +AC_TRY_COMPILE([#include <stdarg.h> +#include <stdio.h>],[ + char buffer[2]; + va_list ap; + + vsnprintf (buffer, 2, "a", ap);],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VSNPRINTF, 1, + [Define if you have the `vsnprintf' function.])],[ + AC_TRY_COMPILE([#include <stdarg.h> +#include <stdio.h> + +extern "C" int vsnprintf (char *, size_t, char const *, va_list);],[ + char buffer[2]; + va_list ap; + + vsnprintf (buffer, 2, "a", ap);],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VSNPRINTF, 1, + [Define if you have the `vsnprintf' function.])],[ + AC_MSG_RESULT(no)])]) + LYX_CHECK_DECL(snprintf, stdio.h) LYX_CHECK_DECL(vsnprintf, stdio.h) LYX_CHECK_DECL(istreambuf_iterator, iterator)