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

Rafaël Carré git at videolan.org
Mon Feb 27 19:20:44 CET 2012


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

(v)asprintf : don't use AC_REPLACE_FUNCS

Use our own check which also recognizes static inline functions
(cherry picked from commit 84a1a3461adf901ff134a09eb4341cc301fdc6dd)

Conflicts:

	configure.ac

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

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

diff --git a/configure.ac b/configure.ac
index c5de680..c40f46c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -516,11 +516,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 strptime 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