[vlc-commits] (v)asprintf : don't use AC_REPLACE_FUNCS

Rafaël Carré git at videolan.org
Tue Nov 29 03:39:39 CET 2011


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Nov 28 21:34:47 2011 -0500| [84a1a3461adf901ff134a09eb4341cc301fdc6dd] | committer: Rafaël Carré

(v)asprintf : don't use AC_REPLACE_FUNCS

Use our own check which also recognizes static inline functions

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84a1a3461adf901ff134a09eb4341cc301fdc6dd
---

 configure.ac |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index b37e897..a8b9d8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -480,11 +480,26 @@ need_libc=false
 dnl Check for usual libc functions
 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp uselocale])
-AC_REPLACE_FUNCS([asprintf atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy vasprintf])
+AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
 ])
 
+dnl mingw64 implements those as static inline, not functions with C linkage
+AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([#include <stdio.h>], [
+        char *c;
+        if (asprintf(&c, "%s %d", "string", 1) == -1)
+            c = NULL;
+    ])],,[AC_LIBOBJ([asprintf])])
+AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([#include <stdio.h>], [
+        char *c;
+        va_list ap;
+        if (vasprintf(&c, "%s %d", ap) == -1)
+            c = NULL;
+    ])],,[AC_LIBOBJ([vasprintf])])
+
 # Windows CE does not have strcoll()
 AC_FUNC_STRCOLL
 



More information about the vlc-commits mailing list