configure.ac 5.37 KB
Newer Older
1
dnl Autoconf settings for npapi-vlc
2

3
AC_COPYRIGHT([Copyright 2002-2019 VLC authors and VideoLAN])
4

5 6
AC_INIT(npapi-vlc, 4.0.0)
VERSION_MAJOR="4"
7
AC_SUBST(VERSION_MAJOR)
8
VERSION_MINOR="0"
9
AC_SUBST(VERSION_MINOR)
10
VERSION_REVISION="0"
11
AC_SUBST(VERSION_REVISION)
12
VERSION_EXTRA=""
13
AC_SUBST(VERSION_EXTRA)
14 15 16 17
dnl Win32 need s a numerical version_extra.
case $( echo ${VERSION_EXTRA}|wc -m ) in
       "1") VERSION_EXTRA_RC="0";;
       "2") VERSION_EXTRA_RC=$( echo ${VERSION_EXTRA}|tr "abcdefghi" "123456789") ;;
18
       *) if test "${VERSION_EXTRA}" = "-git"; then VERSION_EXTRA_RC="666"; else VERSION_EXTRA_RC="99"; fi
19 20
esac
AC_SUBST(VERSION_EXTRA_RC)
21
COPYRIGHT_YEARS="2002-2019"
22
AC_SUBST(COPYRIGHT_YEARS)
23
COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} VLC authors and VideoLAN"
24
AC_SUBST(COPYRIGHT_MESSAGE)
25 26 27 28 29 30 31 32

AC_CONFIG_AUX_DIR(autotools)
AC_CONFIG_MACRO_DIR(m4)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_PRESERVE_HELP_ORDER

AM_INIT_AUTOMAKE(tar-ustar color-tests)
33
AC_CONFIG_HEADERS([config.h])
34 35 36 37 38 39 40 41 42 43 44

# Disable with "./configure --disable-silent-rules" or "make V=1"
AM_SILENT_RULES([yes])

dnl
dnl Check for tools
dnl
AC_PROG_CC_C99
AC_USE_SYSTEM_EXTENSIONS
AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to '2' to get glibc warnings.])
AC_PROG_CXX
45
AC_PROG_OBJCXX
46
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
47

48 49 50 51 52 53
dnl override platform specific check for dependent libraries
dnl otherwise libtool linking of shared libraries will
dnl fail on anything other than pass_all.
AC_CACHE_VAL(lt_cv_deplibs_check_method,
    [lt_cv_deplibs_check_method=pass_all])

54 55 56 57 58 59 60 61 62 63 64 65
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
AC_CHECK_TOOL(DLLTOOL, dlltool, :)

dnl Check for compiler properties
AC_C_CONST

66
WIDLFLAGS=""
67 68 69 70 71 72 73 74 75 76
dnl
dnl  Check the operating system
dnl
case "${host_os}" in
  darwin*)
    SYS=darwin

    dnl Force gcc "-arch" flag
    ARCH_flag=""
    case "${host}" in
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
77
      i*86*)
78 79 80 81 82 83 84 85 86 87 88 89 90
        ARCH_flag="-arch i386"
      ;;
      ppc64*)
        ARCH_flag="-arch ppc64"
      ;;
      ppc*)
        ARCH_flag="-arch ppc"
      ;;
      x86_64*)
        ARCH_flag="-arch x86_64"
      ;;
    esac

91
    CFLAGS="${CFLAGS} -fobjc-exceptions -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
92 93
    CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag} -stdlib=libc++"
    OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-exceptions -D_INTL_REDIRECT_MACROS ${ARCH_flag} -stdlib=libc++ -std=c++11"
Rafaël Carré's avatar
Rafaël Carré committed
94 95
    CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
    LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
96 97 98 99
    ;;
  *mingw32*)
    SYS=mingw32
    AC_CHECK_TOOL(WINDRES, windres, :)
100 101 102 103 104 105 106
    AC_TRY_COMPILE([#include <windows.h>], [
      #if _WIN32_WINNT >= 0x0501
      #error new enough by default
      #endif
    ], [
      AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0501' for Windows XP APIs.])
    ])
107
    AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE6.0 APIs.])
Rafaël Carré's avatar
Rafaël Carré committed
108
    AC_DEFINE([_WIN32], 1, [Define to 1 if targetting Windows.])
109 110
    CC="$CC -static-libgcc"
    CXX="$CXX -static-libgcc -static-libstdc++"
111 112 113 114
    ;;
esac
AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
115 116

LT_INIT
117 118 119 120 121

dnl
dnl Check widl/midl tools for win32
AS_IF([test "${SYS}" = "mingw32"],[
    AC_CHECK_PROGS(MIDL, [midl], no)
122
    AC_CHECK_TOOL(WIDL, [widl], no)
123

124 125 126 127 128 129 130 131
    case "${host}" in
        amd64*|x86_64*)
            WIDLFLAGS=" -m64"
        ;;
        *)
            WIDLFLAGS=" -m32"
        ;;
    esac
132 133 134 135 136
    AC_LANG_PUSH(C++)
    AC_CHECK_HEADER(ole2.h,,[AC_MSG_ERROR([required OLE header ole2.h is missing from your system])])
    AC_CHECK_HEADER(olectl.h,,[AC_MSG_ERROR([required OLE header olectl.h is missing from your system])])
    AC_CHECK_HEADERS(objsafe.h,,,[#include <ole2.h>])
    AC_LANG_POP(C++)
137 138 139
],[
    MIDL="no"
    WIDL="no"
140 141
])

142
AC_SUBST(WIDLFLAGS)
143 144 145
AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
AM_CONDITIONAL(HAS_WIDL_COMPILER, test "${WIDL}" != "no")

146 147 148 149 150 151
dnl
dnl Buggy glibc prevention. Purposedly not cached.
dnl See sourceware.org bugs 5058 and 5443.
dnl Ubuntu alone has 20 bug numbers for this...
dnl
AC_MSG_CHECKING(for buggy GNU/libc versions)
152
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
153 154 155 156 157
#include <limits.h>
#if defined (__GLIBC__) && (__GLIBC__ == 2) \
  && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
# error GNU/libc with dcgettext killer bug!
#endif
158
])], [
159 160 161 162 163 164 165 166
  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.])
])

167 168
dnl
dnl libraries checks
169
AC_PATH_XTRA
170
PKG_CHECK_MODULES([LIBVLC], [libvlc >= 4.0.0], [
171 172
    LIBVLC_PREFIX=`pkg-config --variable=prefix libvlc`
    AC_SUBST(LIBVLC_PREFIX)])
173

174 175 176 177 178 179 180

dnl
dnl ActiveX
AC_ARG_ENABLE(activex, AS_HELP_STRING([--enable-activex], [ActiveX plugin [default=yes (on Windows)]]))
AM_CONDITIONAL(BUILD_ACTIVEX, test "${SYS}" = "mingw32" -a "${enable_activex}" != "no")


181 182
dnl
dnl final flags for ActiveX
183 184 185 186
AM_COND_IF([HAVE_WIN32], [
  ACTIVEX_CPPFLAGS="${CPPFLAGS} -DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_"
  ACTIVEX_CXXFLAGS="${CXXFLAGS} -fno-exceptions"

187
  AC_ARG_VAR([ACTIVEX_LIBS], [linker flags for ActiveX])
188 189 190
  ACTIVEX_LIBS="${ACTIVEX_LIBS} -lole32 -loleaut32 -luuid -lshlwapi -lgdi32"
])

191 192 193
AC_CONFIG_FILES([
  Makefile
  share/Makefile
194
  common/Makefile
195
  activex/Makefile
196
])
197

198 199
AM_COND_IF([HAVE_WIN32], [
  AC_CONFIG_FILES([
200 201
    activex/axvlc.inf
    activex/axvlc_rc.rc
202 203 204
  ])
])
AC_OUTPUT