1dnl AG_GST_PLATFORM
2dnl Check for platform specific features and define some variables
3dnl
4dnl GST_EXTRA_MODULE_SUFFIX: contains a platform specific
5dnl   extra module suffix additional to G_MODULE_SUFFIX
6dnl
7dnl HAVE_OSX: Defined if compiling for OS X
8dnl
9dnl GST_HAVE_UNSAFE_FORK: Defined if fork is unsafe (Windows)
10dnl
11dnl HAVE_WIN32: Defined if compiling on Win32
12dnl
13
14AC_DEFUN([AG_GST_PLATFORM],
15[
16  AC_REQUIRE([AC_CANONICAL_HOST])
17
18  case $host_os in
19    rhapsody*)
20      AC_DEFINE_UNQUOTED(GST_EXTRA_MODULE_SUFFIX, [".dylib"], [Extra platform specific plugin suffix])
21      ;;
22    darwin*)
23      AC_DEFINE_UNQUOTED(GST_EXTRA_MODULE_SUFFIX, [".dylib"], [Extra platform specific plugin suffix])
24      AC_DEFINE_UNQUOTED(HAVE_OSX, 1, [Defined if compiling for OSX])
25      ;;
26    cygwin*)
27      AC_DEFINE_UNQUOTED(GST_HAVE_UNSAFE_FORK, 1, [Defined when registry scanning through fork is unsafe])
28      ;;
29    mingw* | msvc* | mks*)
30      dnl HAVE_WIN32 currently means "disable POSIXisms".
31      AC_DEFINE_UNQUOTED(HAVE_WIN32, 1, [Defined if compiling for Windows])
32
33      dnl define __MSVCRT_VERSION__ version if not set already by the
34      dnl compiler (ie. mostly for mingw). This is needed for things like
35      dnl __stat64 to be available. If set by the compiler, ensure it's
36      dnl new enough - we need at least WinXP SP2.
37      AC_TRY_COMPILE([ ], [ return __MSVCRT_VERSION__; ], [
38          AC_TRY_COMPILE([ ], [
39            #if __MSVCRT_VERSION__ < 0x0601
40            #error "MSVCRT too old"
41            #endif
42          ], [
43            AC_MSG_NOTICE([MSVCRT version looks ok])
44          ], [
45            AC_MSG_ERROR([MSVCRT version too old, need at least WinXP SP2])
46          ])
47      ], [
48        AC_MSG_NOTICE([Setting MSVCRT version to 0x0601])
49        AC_DEFINE_UNQUOTED(__MSVCRT_VERSION__, 0x0601, [We need at least WinXP SP2 for __stat64])
50      ])
51      ;;
52     *)
53      ;;
54  esac
55])
56
57AC_DEFUN([AG_GST_LIBTOOL_PREPARE],
58[
59  dnl Persuade libtool to also link (-l) a 'pure' (DirectX) static lib,
60  dnl i.e. as opposed to only import lib with dll counterpart.
61  dnl Needs to be tweaked before libtool's checks.
62  case $host_os in
63  cygwin* | mingw*)
64    lt_cv_deplibs_check_method=pass_all
65    ;;
66  esac
67])