added g_strlcat() and g_strlcpy() wrappers, supplied by David Wheeler
[platform/upstream/glib.git] / configure.in
index aa9c917..3722b19 100644 (file)
@@ -337,7 +337,6 @@ AC_SUBST(STRIP_END)
 size_includes=["
 #include <stdarg.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
 "]
@@ -399,7 +398,7 @@ fi
 AC_MSG_CHECKING(for sys_siglist)
 AC_TRY_LINK(, [
 extern char *sys_siglist[];
-strlen (sys_siglist[0]);
+exit (sys_siglist[0]);
 ], glib_ok=yes, glib_ok=no)
 AC_MSG_RESULT($glib_ok)
 if test $glib_ok = no; then
@@ -457,8 +456,24 @@ AC_TRY_COMPILE([#include <langinfo.h>],
    AC_DEFINE(HAVE_CODESET)
    have_codeset=yes,
    have_codeset=no)
-
 AC_MSG_RESULT($have_codeset)
+
+
+dnl ****************************************
+dnl *** strlcpy/strlcat                  ***
+dnl ****************************************
+# Check for strlcpy
+AC_MSG_CHECKING(for strlcpy/strlcat)
+AC_TRY_LINK([#include <stdlib.h>
+#include <string.h>], [
+char *p = malloc(10);
+(void) strlcpy(p, "hi", 10);
+(void) strlcat(p, "bye", 10);
+], glib_ok=yes, glib_ok=no)
+AC_MSG_RESULT($glib_ok)
+if test $glib_ok = yes; then
+    AC_DEFINE(HAVE_STRLCPY)
+fi
   
 
 dnl **********************
@@ -1113,10 +1128,6 @@ case "$CONFIG_OTHER" in
 #ifndef GLIBCONFIG_H
 #define GLIBCONFIG_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
 _______EOF
 
        if test x$glib_limits_h = xyes; then
@@ -1137,6 +1148,10 @@ _______EOF
 
        cat >> $outfile <<_______EOF
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 #define G_MINFLOAT     $glib_mf
 #define G_MAXFLOAT     $glib_Mf
 #define G_MINDOUBLE    $glib_md
@@ -1191,9 +1206,23 @@ ${glib_extension}typedef unsigned $gint64 guint64;
 #define G_GINT64_FORMAT $gint64_format
 #define G_GUINT64_FORMAT $guint64_format
 #define G_GINT64_CONSTANT(val) $gint64_constant
+
 _______EOF
        fi
 
+       case x$glib_size_t in
+        x2) echo "typedef gint16  gssize;" >> $outfile
+            echo "typedef guint16 gsize;"  >> $outfile
+            ;;
+        x4) echo "typedef gint32  gssize;" >> $outfile
+            echo "typedef guint32 gsize;"  >> $outfile
+            ;;
+        x8) echo "typedef gint64  gssize;" >> $outfile
+            echo "typedef guint64 gsize;"  >> $outfile
+            ;;
+       *)  echo "#error size of size_t is unknown" >> $outfile
+            ;;
+        esac
 
        if test -z "$glib_unknown_void_p"; then
          cat >>$outfile <<_______EOF
@@ -1410,6 +1439,7 @@ $ac_cv_sizeof_long_long)
   gint64_constant='(G_GNUC_EXTENSION (val##LL))'
   ;;
 esac
+glib_size_t=$glib_cv_sizeof_size_t
 
 gintbits=`expr $ac_cv_sizeof_int \* 8`
 glongbits=`expr $ac_cv_sizeof_long \* 8`