Browse Source

Detects strlcpy is missing

Julien 'Lta' BALLET 11 years ago
parent
commit
143f191539
2 changed files with 11 additions and 2 deletions
  1. 4 0
      Makefile.am
  2. 7 2
      configure.ac

+ 4 - 0
Makefile.am

@@ -73,6 +73,10 @@ libdsm_la_SOURCES = \
     src/smb_transport.c     \
     src/smb_utils.c
 
+if COMPAT_STRLCPY
+libdsm_la_SOURCES += compat/strlcpy.c
+endif
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libdsm.pc
 

+ 7 - 2
configure.ac

@@ -77,9 +77,14 @@ AS_IF([test x"$HAVE_TASN1_3PLUS" = x"yes"], [
   AC_DEFINE([asn1_static_node], [ASN1_ARRAY_TYPE], [...])
 ])
 
-AC_SEARCH_LIBS([strlcpy], [bsd], [], [
-  AC_MSG_ERROR([unable to find the strlcpy() function (missing libbsd?)])
+AC_SEARCH_LIBS([strlcpy], [bsd], [
+  AC_DEFINE([HAVE_LIBBSD], [1], [Does this system have libbsd strl*** functions implementation])
+], [
+  compat_strlcpy=yes
+  AC_MSG_WARN([unable to find the strlcpy() function (missing libbsd?)])
 ])
+AM_CONDITIONAL(COMPAT_STRLCPY, [test x$compat_strlcpy = xyes])
+
 AC_CHECK_HEADERS([bsd/string.h])
 
 ## Checks for doxygen presence