]> git.sesse.net Git - vlc/blobdiff - configure.ac
Qt4 - VLM Export in the interface. Patch by Jean-François Massol, adapted by me.
[vlc] / configure.ac
index 50bb0454f079f0ae77cf107356167174d849050f..b671462890606594b9a87183e3a3c64bce4926cb 100644 (file)
@@ -470,14 +470,14 @@ CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcd
 dnl Check for system libs needed
 need_libc=false
 
-AC_CHECK_FUNCS(gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy)
-
 dnl Check for usual libc functions
-AC_CHECK_FUNCS(strdup strndup strnlen atof)
+AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid 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])
 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
 AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
 
+AH_BOTTOM([#include <vlc_fixups.h>])
+
 AS_IF([test "${SYS}" = "linux"], [
   AC_CHECK_FUNCS(tee)
 ])
@@ -526,16 +526,21 @@ AC_CHECK_HEADERS(zlib.h, [
 ])
 
 dnl Check for socklen_t
-AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
-  [AC_TRY_COMPILE(
-     [#include <sys/types.h>
-      #include <sys/socket.h>],
-     [socklen_t len = 42; return len;],
-     ac_cv_type_socklen_t=yes,
-     ac_cv_type_socklen_t=no)])
-if test "${ac_cv_type_socklen_t}" != "no"; then
-  AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if <sys/socket.h> defines socklen_t.])
-fi
+AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
+AC_CACHE_CHECK([for socklen_t in sys/socket.h],
+ac_cv_type_socklen_t,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+[#include <sys/types.h>
+#ifdef WIN32
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#else
+# include <sys/socket.h>
+#endif]], [[socklen_t len; len = 0;]])],
+ac_cv_type_socklen_t=yes,
+ac_cv_type_socklen_t=no)])
+AS_IF([test "$ac_cv_type_socklen_t" = no],
+ [AC_DEFINE(socklen_t, int)])
 
 dnl Check for struct sockaddr_storage
 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.])
@@ -738,89 +743,30 @@ if test "${THREAD_LIB}" = "error"; then
   THREAD_LIB=""
 fi
 
-dnl Check for cthreads under GNU/Hurd for instance
-AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
+VLC_ADD_LIBS([libvlc plugin],[${THREAD_LIB}])
 
-dnl
-dnl  GNU portable threads
-dnl
-AC_ARG_ENABLE(pth,
-  [  --enable-pth            GNU Pth support (default disabled)],
-  [ if test "${enable_pth}" = "yes"; then
-    AC_CHECK_LIB(pth,pth_init)
-    AC_MSG_CHECKING(for pth_init in pth.h)
-    AC_EGREP_HEADER(pth_init,pth.h,[
-      AC_MSG_RESULT(yes)
-      AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
-                Define if <pth.h> defines pth_init)
-      THREAD_LIB="-lpth"
-    ],[
-      AC_MSG_RESULT(no)
-    ])
-    fi
+AC_CHECK_LIB(rt, clock_nanosleep, [
+  VLC_ADD_LIBS([libvlc],[-lrt])
+  AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define to 1 if you have clock_nanosleep.])
+], [
+  dnl HP/UX port
+  AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlc],[-lrt])])
 ])
 
-dnl
-dnl  State Threads
-dnl
-AC_ARG_ENABLE(st,
-  [  --enable-st             State Threads (default disabled)],
-  [ if test "${enable_st}" = "yes"; then
-    AC_CHECK_LIB(st,st_init)
-    AC_MSG_CHECKING(for st_init in st.h)
-    AC_EGREP_HEADER(st_init,st.h,[
-      AC_MSG_RESULT(yes)
-      AC_DEFINE(ST_INIT_IN_ST_H, 1,
-                Define if <st.h> defines st_init)
-      THREAD_LIB="-lst"
-    ],[
-      AC_MSG_RESULT(yes)
-    ])
-    fi
+have_nanosleep=false
+AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
+  AC_CHECK_LIB(rt,nanosleep,
+    [VLC_ADD_LIBS([libvlc],[-lrt]) have_nanosleep=:],
+    [AC_CHECK_LIB(posix4,nanosleep,
+        [VLC_ADD_LIBS([libvlc],[-lposix4]) have_nanosleep=:])]
+  )
 ])
-
-VLC_ADD_LIBS([libvlc plugin],[${THREAD_LIB}])
-
-dnl Don't link with rt when using GNU-pth
-if test "${THREAD_LIB}" != "-lpth" && test "${THREAD_LIB}" != "-lst"; then
-  AC_CHECK_LIB(rt, clock_nanosleep, [
-    VLC_ADD_LIBS([libvlc],[-lrt])
-    AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define to 1 if you have clock_nanosleep.])
-  ], [
-    dnl HP/UX port
-    AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlc],[-lrt])])
-  ])
-
-  have_nanosleep=false
-  AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
-    AC_CHECK_LIB(rt,nanosleep,
-      [VLC_ADD_LIBS([libvlc],[-lrt]) have_nanosleep=:],
-      [AC_CHECK_LIB(posix4,nanosleep,
-          [VLC_ADD_LIBS([libvlc],[-lposix4]) have_nanosleep=:])]
-    )
-  ])
-  if ${have_nanosleep}; then
-    AC_DEFINE(HAVE_NANOSLEEP, 1,
-              Define if nanosleep is available.)
-  fi
+if ${have_nanosleep}; then
+  AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if nanosleep is available.])
 fi
+fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce" 
 
 dnl Check for misc headers
-AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
-AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
-            Define if <pthread.h> defines pthread_cond_t.)],[
-  AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for pthread_once in pthread.h)
-AC_EGREP_HEADER(pthread_once,pthread.h,[
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
-            Define if <pthread.h> defines pthread_once.)],[
-  AC_MSG_RESULT(no)])
-fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
-
 AC_MSG_CHECKING(for strncasecmp in strings.h)
 AC_EGREP_HEADER(strncasecmp,strings.h,[
   AC_MSG_RESULT(yes)
@@ -831,12 +777,10 @@ AC_EGREP_HEADER(strncasecmp,strings.h,[
 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)
-AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/socket.h netinet/udplite.h])
+AC_CHECK_HEADERS([arpa/inet.h netinet/in.h netinet/udplite.h])
 AC_CHECK_HEADERS([net/if.h], [], [],
   [
-    #if HAVE_SYS_SOCKET_H
-    # include <sys/socket.h>
-    #endif
+    #include <sys/socket.h>
   ])
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
@@ -846,7 +790,12 @@ fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
 
 AC_HEADER_TIME
 
-AC_CHECK_TYPE(ssize_t, int)
+dnl LP64 adn LLP64 architectures had better define ssize_t by themselves...
+AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.])
+AC_CHECK_TYPE(ssize_t,, [
+  AC_DEFINE(ssize_t, int)
+])
+
 AC_SEARCH_LIBS(poll, [poll], [AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS is usabl... err, has poll().])])
 
 dnl Check for dirent
@@ -878,7 +827,7 @@ AC_EGREP_HEADER(timespec,sys/time.h,[
 
 dnl Check for threads library
 if test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"; then
-AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
+AC_CHECK_HEADERS(pthread.h kernel/scheduler.h kernel/OS.h)
 fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
 
 dnl Find where are the X headers and libraries
@@ -1162,20 +1111,6 @@ dnl     VLC_ADD_LDFLAGS([plugin mozilla],[-shared])
 dnl   ])
 dnl ])
 
-dnl Check for variadic macros
-AC_CACHE_CHECK([for variadic cpp macros],
-    [ac_cv_cpp_variadic_macros],
-    [CFLAGS="${CFLAGS_save}"
-     AC_TRY_COMPILE(
-         [#include <stdio.h>
-          #define a(b,c...) printf(b,##c)],
-         [a("foo");a("%s","bar");a("%s%s","baz","quux");],
-         ac_cv_cpp_variadic_macros=yes,
-         ac_cv_cpp_variadic_macros=no)])
-if test "${ac_cv_cpp_variadic_macros}" != "no"; then
-    AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
-fi
-
 dnl Checks for __attribute__(aligned()) directive
 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
     [ac_cv_c_attribute_aligned],
@@ -4631,6 +4566,13 @@ then
     VLC_ADD_PLUGINS([caca])
     VLC_ADD_CFLAGS([caca],[`${CACA_CONFIG} --cflags`])
     VLC_ADD_LIBS([caca],[`${CACA_CONFIG} --plugin-libs`])
+    AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <caca.h>
+                                        caca_event_t ev;]],
+                                        [[ev.type = 0;]]
+                       )],
+                       [],
+      [AC_DEFINE(CACA_EVENT_OPAQUE, [1], ["Define if struct caca_event is opaque and must not be accessed directly"])]
+    )
   fi
 fi
 
@@ -5187,6 +5129,7 @@ then
     if test "${ac_cv_wx_headers}" = "yes"
     then
       VLC_ADD_PLUGINS([wxwidgets])
+      AC_DEFINE([HAVE_WX], 1, [Define to 1 if you have WxWidgets library.])
       ALIASES="${ALIASES} wxvlc"
     fi
     CPPFLAGS="${CPPFLAGS_save}"
@@ -5206,6 +5149,7 @@ AS_IF([test "${enable_qt4}" != "no" &&
   (test "${SYS}" != "darwin" || test "${enable_qt4}" = "yes")], [
   PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.2.0],
     [ VLC_ADD_PLUGINS([qt4])
+      AC_DEFINE([HAVE_QT4], 1, [Define to 1 if you have QT4 library.])
       ALIASES="${ALIASES} qvlc"
       enableqt4=true
       VLC_ADD_LIBS([qt4],[$QT4_LIBS])
@@ -5805,7 +5749,8 @@ then
             MOZILLA_CONFIG_H="${firefox_include}/mozilla-config.h"
         fi
         if grep '^#define MOZ_X11 1' ${MOZILLA_CONFIG_H} 2>&1 > /dev/null ; then
-            VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt])
+            AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
+            VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXpm])
         fi
         VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}])
         VLC_ADD_LDFLAGS([mozilla],[${MOZILLA_LDFLAGS}])
@@ -5842,11 +5787,12 @@ then
         AC_CHECK_LIB(Xt,XtStrings,
          [
            VLC_ADD_CPPFLAGS([mozilla],[${X_CFLAGS}])
-           VLC_ADD_LIBS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE])
+           VLC_ADD_LIBS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE -lXpm])
          ],
          [],
-         [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE]
+         [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE -lXpm]
         ])
+        AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
         LDFLAGS="${LDFLAGS_save}"
       fi
 
@@ -6097,7 +6043,12 @@ AC_SUBST(VERSION_MAJOR)
 AC_SUBST(VERSION_MINOR)
 AC_SUBST(VERSION_REVISION)
 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami`", [user who ran configure]) 
-AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -s`", [host which ran configure]) 
+if test "${SYS}" = "cygwin"
+then
+    AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname`", [host which ran configure])
+else
+    AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -s`", [host which ran configure])
+fi
 AC_DEFINE_UNQUOTED(VLC_COMPILE_DOMAIN, "`dnsdomainname 2>/dev/null || domainname 2>/dev/null || echo unknown`", [domain of the host which ran configure]) 
 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1`", [compiler])