]> git.sesse.net Git - vlc/blobdiff - configure.ac
Fix segfault: press Shift+A without an opened AOUT would crash.
[vlc] / configure.ac
index a4a7d5008207c9b8cc16d907372abd72316c60e6..d0fe51fc81a3e86385140e49d8d4f4e5faadf245 100644 (file)
@@ -18,6 +18,7 @@ AC_PREREQ(2.59c)
 AC_CONFIG_SRCDIR(src/libvlc.c)
 AC_CONFIG_AUX_DIR(autotools)
 AC_CONFIG_MACRO_DIR(m4)
+AC_CONFIG_LIBOBJ_DIR(compat)
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
@@ -453,6 +454,24 @@ AM_ICONV
 VLC_ADD_CFLAGS([libvlc],[${INCICONV}])
 VLC_ADD_LIBS([libvlc],[${LTLIBICONV}])
 
+dnl Check for broken versions of mingw-runtime compatability library
+if test "${SYS}" = "mingw32"
+then
+    AC_MSG_CHECKING(for broken mingw-runtime)
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <_mingw.h>
+#if (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION < 14)
+# error Attempting to use mingw-runtime with broken vsnprintf support
+#endif
+        ]])],
+        [AC_MSG_RESULT([Ok])],
+        [AC_MSG_ERROR([Broken mingw-runtime, need > 3.13])],
+])
+    dnl force use of mingw provided c99 *printf over msvcrt
+    CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
+    CPPFLAGS_save="${CPPFLAGS_save} -D__USE_MINGW_ANSI_STDIO=1"
+fi
+
 dnl Check for the need to include the mingwex lib for mingw32
 if test "${SYS}" = "mingw32"
 then
@@ -503,6 +522,24 @@ AC_LANG_PUSH(C++)
 AC_LANG_POP(C++)
 fi
 
+dnl
+dnl Buggy glibc prevention. Purposedly not cached.
+dnl Ubuntu alone has 20 bug numbers for this...
+dnl
+AC_MSG_CHECKING(for buggy GNU/libc versions)
+AC_PREPROC_IFELSE([
+#include <limits.h>
+#if defined (__GLIBC__) && (__GLIBC__ == 2) \
+  && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
+# error GNU/libc with dcgettext killer bug!
+#endif
+], [
+  AC_MSG_RESULT([not present])
+], [
+  AC_MSG_RESULT([found])
+  AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable work-around for this. Check with your distribution vendor on how to update the glibc run-time.])
+])
+
 dnl Plugin compilation stuff
 
 VLC_LIBRARY_SUFFIX
@@ -514,12 +551,11 @@ dnl Check for system libs needed
 need_libc=false
 
 dnl Check for usual libc functions
-AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise uselocale])
-AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
-AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
-AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
+AC_CHECK_FUNCS([gettimeofday isatty swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex getenv putenv setenv ctime_r lrintf daemon fork lstat posix_fadvise posix_madvise uselocale])
 AC_FUNC_ALLOCA
 AC_CHECK_FUNCS(fcntl)
+AC_REPLACE_FUNCS([asprintf atof atoll gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtoll vasprintf])
+AC_CHECK_FUNCS([stricmp strnicmp])
 
 dnl Check for Linux system calls
 AC_CHECK_FUNCS([vmsplice])
@@ -811,8 +847,8 @@ AC_EGREP_HEADER(strncasecmp,strings.h,[
   AC_MSG_RESULT(no)])
 
 dnl Check for headers
-AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h stdbool.h getopt.h strings.h inttypes.h sys/int_types.h wchar.h locale.h)
-AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h xlocale.h)
+AC_CHECK_HEADERS(getopt.h strings.h locale.h)
+AC_CHECK_HEADERS(fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h xlocale.h)
 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h netinet/udplite.h sys/eventfd.h])
 AC_CHECK_HEADERS([net/if.h], [], [],
   [
@@ -5928,6 +5964,7 @@ AC_CONFIG_FILES([
   share/Makefile
   share/vlc_win32_rc.rc
   share/libvlc_win32_rc.rc
+  compat/Makefile
   src/Makefile
   src/test/Makefile
   bin/Makefile