diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index ad82e3904d6e2f258a1ce1f3ccdb55321721f923..7d2962287e9bfd97264a11f9ac9d86a4ae4bf268 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.40 2003-05-22 22:18:03 geuzaine Exp $ +// $Id: Message.cpp,v 1.41 2003-11-23 06:58:01 geuzaine Exp $ // // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle // @@ -39,6 +39,18 @@ extern GUI *WID; extern Context_T CTX; +// Some old systems don't have vsnprintf... Just call vsprintf instead. + +#if defined(HAVE_NO_VSNPRINTF) +int vsnprintf(char *str, size_t size, const char* fmt, ...){ + va_list args; + va_start(args, fmt); + int ret = vsprintf(str, fmt, args); + va_end(args); + return ret; +} +#endif + // Handle signals. It is a crime to call stdio functions in a signal // handler. But who cares? ;-) diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 2c4c974190ac89f1b16ba3ac1c3c24e20c193cf9..236888a85deee897c9ec1db6a2c289eafd1a968b 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -1,4 +1,4 @@ -// $Id: Geo.cpp,v 1.34 2003-05-22 21:41:12 geuzaine Exp $ +// $Id: Geo.cpp,v 1.35 2003-11-23 06:58:01 geuzaine Exp $ // // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle // @@ -31,6 +31,18 @@ extern Context_T CTX; #define BUFFSIZE 128000 +// Some old systems don't have snprintf... Just call sprintf instead. + +#if defined(HAVE_NO_SNPRINTF) +int snprintf(char *str, size_t size, const char* fmt, ...){ + va_list args; + va_start(args, fmt); + int ret = sprintf(str, fmt, args); + va_end(args); + return ret; +} +#endif + // This is truly horrible :-) char x_text[100] = "0.0", y_text[100] = "0.0", z_text[100] = "0.0"; diff --git a/configure b/configure index 39ee864ec4ae031ad8378972d35e72f1b453a9ca..24c16c942ef093d3142ab3ec1996ba947c1cea0f 100755 --- a/configure +++ b/configure @@ -3000,6 +3000,163 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for vsnprintf" >&5 +echo $ECHO_N "checking for vsnprintf... $ECHO_C" >&6 +if test "${ac_cv_func_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vsnprintf (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vsnprintf (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vsnprintf) || defined (__stub___vsnprintf) +choke me +#else +char (*f) () = vsnprintf; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != vsnprintf; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_vsnprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_vsnprintf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_func_vsnprintf" >&6 +if test $ac_cv_func_vsnprintf = yes; then + : +else + FLAGS="-DHAVE_NO_VSNPRINTF ${FLAGS}" +fi + +echo "$as_me:$LINENO: checking for snprintf" >&5 +echo $ECHO_N "checking for snprintf... $ECHO_C" >&6 +if test "${ac_cv_func_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char snprintf (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char snprintf (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_snprintf) || defined (__stub___snprintf) +choke me +#else +char (*f) () = snprintf; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != snprintf; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_snprintf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_snprintf" >&5 +echo "${ECHO_T}$ac_cv_func_snprintf" >&6 +if test $ac_cv_func_snprintf = yes; then + : +else + FLAGS="-DHAVE_NO_SNPRINTF ${FLAGS}" +fi + + GMSH_DIRS="Common DataStr Geo Mesh Numeric Parallel Parser Plugin" diff --git a/configure.in b/configure.in index c36d90e822c071e189b1c6daccc86dd31d764543..5ad83496d612257ebd577c41c3ee8529313c8029 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.45 2003-11-20 18:01:22 geuzaine Exp $ +dnl $Id: configure.in,v 1.46 2003-11-23 06:58:01 geuzaine Exp $ dnl dnl Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle dnl @@ -112,6 +112,10 @@ AR="${AR} ruvs" dnl Check for standard math library AC_CHECK_LIB(m,main) +dnl Check for various functions +AC_CHECK_FUNC(vsnprintf,,FLAGS="-DHAVE_NO_VSNPRINTF ${FLAGS}") +AC_CHECK_FUNC(snprintf,,FLAGS="-DHAVE_NO_SNPRINTF ${FLAGS}") + dnl See if we need a .exe extension on executables AC_EXEEXT