[icinga-checkins] icinga.org: icinga-core/next: idoutils, core: add snprintf. h static header with definitions for configure time missed functions now available in snprintf .c .this fixes a lot of compiler warnings about undefined symbols

git at icinga.org git at icinga.org
Wed Feb 22 10:46:50 CET 2012


Module: icinga-core
Branch: next
Commit: a7a9dd5401f49d06cf13e3645ebddab7269b0cf3
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=a7a9dd5401f49d06cf13e3645ebddab7269b0cf3

Author: Thomas Dressler <tdressler at tdressler.net>
Date:   Fri Feb  3 20:56:08 2012 +0100

idoutils,core: add snprintf.h static header with definitions for configure time missed functions now available in snprintf.c .this fixes a lot of compiler warnings about undefined symbols
refs #1253

---

 configure             |    3 +--
 configure.in          |    2 +-
 include/.gitignore    |    1 -
 include/config.h.in   |    1 +
 include/snprintf.h    |   33 +++++++++++++++++++++++++++++++++
 include/snprintf.h.in |    4 ----
 6 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index be18168..142efe2 100755
--- a/configure
+++ b/configure
@@ -1966,7 +1966,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-ac_config_headers="$ac_config_headers include/config.h include/snprintf.h"
+ac_config_headers="$ac_config_headers include/config.h"
 
 
 
@@ -10721,7 +10721,6 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
-    "include/snprintf.h") CONFIG_HEADERS="$CONFIG_HEADERS include/snprintf.h" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "subst") CONFIG_FILES="$CONFIG_FILES subst" ;;
     "solaris/pkginfo") CONFIG_FILES="$CONFIG_FILES solaris/pkginfo" ;;
diff --git a/configure.in b/configure.in
index bf0be3c..aabbd52 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,7 @@ define([AC_CACHE_LOAD],)
 define([AC_CACHE_SAVE],)
 
 AC_INIT(base/icinga.c)
-AC_CONFIG_HEADER(include/config.h include/snprintf.h)
+AC_CONFIG_HEADER(include/config.h)
 AC_PREFIX_DEFAULT(/usr/local/icinga)
 
 PKG_NAME=icinga-core
diff --git a/include/.gitignore b/include/.gitignore
index e8d2ce2..132becf 100644
--- a/include/.gitignore
+++ b/include/.gitignore
@@ -1,4 +1,3 @@
 locations.h
 config.h
-snprintf.h
 dh.h
diff --git a/include/config.h.in b/include/config.h.in
index 87dbd54..0116dc0 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -388,4 +388,5 @@
 
 /*snprintf workaround*/
 #undef SNPRINTF_BROKEN
+#include "snprintf.h"
 #endif
diff --git a/include/snprintf.h b/include/snprintf.h
new file mode 100644
index 0000000..1cf80e0
--- /dev/null
+++ b/include/snprintf.h
@@ -0,0 +1,33 @@
+/* include/snprintf.h. */
+#ifndef INCLUDE_SNPRINTF_h__
+#define INCLUDE_SNPRINTF_h__
+
+#ifdef SNPRINTF_BROKEN
+/* snprintf and friends are known broken at least in solaris
+ *  * we assume functions are not there to take local one
+ *   */
+#undef HAVE_SNPRINTF
+#undef HAVE_VSNPRINTF
+#undef HAVE_C99_VSNPRINTF
+#undef HAVE_ASPRINTF
+#undef HAVE_VASPRINTF
+#undef HAVE_VA_COPY
+#endif
+
+/* yes this really must be a ||. Don't muck with this (tridge) */
+#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+int smb_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
+#define vsnprintf smb_vsnprintf
+int smb_snprintf(char *str, size_t count, const char *fmt, ...);
+#define snprintf smb_snprintf
+#endif
+
+#ifndef HAVE_VASPRINTF
+int vasprintf(char **ptr, const char *format, va_list ap);
+#endif
+#ifndef HAVE_ASPRINTF
+int asprintf(char **ptr, const char *format, ...);
+#endif
+
+#endif /* SNPRINTF */
+
diff --git a/include/snprintf.h.in b/include/snprintf.h.in
deleted file mode 100644
index 8ab5880..0000000
--- a/include/snprintf.h.in
+++ /dev/null
@@ -1,4 +0,0 @@
-/* -*- C -*- */
-#undef HAVE_SNPRINTF
-#undef NEED_VA_LIST
-#undef SNPRINTF_BROKEN





More information about the icinga-checkins mailing list