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

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

5
AC_INIT(npapi-vlc, 2.2.1)
6
VERSION_MAJOR="2"
7
AC_SUBST(VERSION_MAJOR)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
8
VERSION_MINOR="2"
9
AC_SUBST(VERSION_MINOR)
10
VERSION_REVISION="1"
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-2015"
22
AC_SUBST(COPYRIGHT_YEARS)
23
COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} VLC authors and VideoLAN"
24
AC_SUBST(COPYRIGHT_MESSAGE)
25

Cheng Sun's avatar
Cheng Sun committed
26
AC_CONFIG_SRCDIR(npapi/vlcshell.cpp)
27 28 29 30 31 32 33
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)
34
AC_CONFIG_HEADERS([config.h])
35 36 37 38 39 40 41 42 43 44 45

# 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
46
AC_PROG_OBJCXX
47
AX_CXX_COMPILE_STDCXX_11([], [mandatory])
48

49 50 51 52 53 54
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])

55 56 57 58 59 60 61 62 63 64 65 66
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

67
WIDLFLAGS=""
68 69 70 71 72 73 74 75 76 77
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
78
      i*86*)
79 80 81 82 83 84 85 86 87 88 89 90 91
        ARCH_flag="-arch i386"
      ;;
      ppc64*)
        ARCH_flag="-arch ppc64"
      ;;
      ppc*)
        ARCH_flag="-arch ppc"
      ;;
      x86_64*)
        ARCH_flag="-arch x86_64"
      ;;
    esac

92
    CFLAGS="${CFLAGS} -fobjc-exceptions -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
Rafaël Carré's avatar
Rafaël Carré committed
93
    CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
94
    OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-exceptions -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
Rafaël Carré's avatar
Rafaël Carré committed
95 96
    CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
    LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
97 98 99 100 101
    ;;
  *mingw32*)
    SYS=mingw32
    AC_CHECK_TOOL(WINDRES, windres, :)
    AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0501' for Windows XP APIs.])
102
    AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE6.0 APIs.])
Rafaël Carré's avatar
Rafaël Carré committed
103
    AC_DEFINE([_WIN32], 1, [Define to 1 if targetting Windows.])
104 105
    CC="$CC -static-libgcc"
    CXX="$CXX -static-libgcc -static-libstdc++"
106 107 108 109
    ;;
esac
AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
110 111

LT_INIT
112 113 114 115 116

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

119 120 121 122 123 124 125 126
    case "${host}" in
        amd64*|x86_64*)
            WIDLFLAGS=" -m64"
        ;;
        *)
            WIDLFLAGS=" -m32"
        ;;
    esac
127 128 129 130 131
    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++)
132 133 134
],[
    MIDL="no"
    WIDL="no"
135 136
])

137
AC_SUBST(WIDLFLAGS)
138 139 140
AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
AM_CONDITIONAL(HAS_WIDL_COMPILER, test "${WIDL}" != "no")

141 142 143 144 145 146
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)
147
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
148 149 150 151 152
#include <limits.h>
#if defined (__GLIBC__) && (__GLIBC__ == 2) \
  && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
# error GNU/libc with dcgettext killer bug!
#endif
153
])], [
154 155 156 157 158 159 160 161
  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.])
])

162 163
dnl
dnl libraries checks
164
AC_PATH_XTRA
165
PKG_CHECK_MODULES([LIBVLC], [libvlc >= 2.0.0], [
166 167
    LIBVLC_PREFIX=`pkg-config --variable=prefix libvlc`
    AC_SUBST(LIBVLC_PREFIX)])
168

169 170 171 172 173 174 175

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")


176 177
dnl
dnl NPAPI headers
178
AC_ARG_ENABLE(npapi, AS_HELP_STRING([--enable-npapi], [NPAPI/Mozilla plugin [default=yes]]))
179 180 181
AC_ARG_VAR([MOZILLA_CFLAGS], [C compiler flags for Mozilla, overriding pkg-config])
AC_ARG_VAR([MOZILLA_LIBS], [linker flags for Mozilla, overriding pkg-config])

182
AS_IF([test "x${enable_npapi}" != x"no"],[
183

184
AC_LANG_PUSH(C++)
185
AC_MSG_CHECKING([Mozilla headers])
186

187 188 189
dnl pkg-config
dnl As we want to do a loop due to the number of name possible for the .pc
dnl we can't use the pkg-config macros.
190
  for i in "${with_mozilla_pkg}" npapi-sdk seamonkey-plugin iceape-plugin xulrunner-plugin firefox-plugin iceweasel-plugin mozilla-plugin libxul; do
191 192
    if test -n "$i"; then
      echo "Trying to find $i package" >&AS_MESSAGE_LOG_FD
193 194 195
      AS_IF([test $i = npapi-sdk], [moz_ver=0.27], [moz_ver=1.9.2])
      AC_MSG_CHECKING([for $i >= $moz_ver])
      if $PKG_CONFIG --exists --print-errors "$i >= $moz_ver" 2>&AS_MESSAGE_LOG_FD
196 197 198 199
      then
        echo "Using $i pkg-config package." >&AS_MESSAGE_LOG_FD
        MOZILLA_CFLAGS=$(eval $PKG_CONFIG --cflags "$i" )
        MOZILLA_LIBS=$(eval $PKG_CONFIG --libs "$i" )
200
        AC_MSG_RESULT([yes])
201
        break
202 203
      else
        AC_MSG_RESULT([no])
204 205 206
      fi
    fi
  done
207

208
CPPFLAGS_save="${CPPFLAGS}"
209
CPPFLAGS="${CPPFLAGS} ${MOZILLA_CFLAGS} -Inpapi/npapi-sdk/"
210

211
AC_CHECK_HEADERS(npapi.h npruntime.h, [
212
    dnl if found
213
    have_headers="true"
214 215
  ],[
    dnl if not found
216 217
    AC_MSG_WARN([Please install the Mozilla development tools, required headers were not found.])
    have_headers="false"
218
  ], [
219 220 221 222
    #include <stdint.h>
    #if HAVE_NPAPI_H
     #include <npapi.h>
    #endif
223 224
  ]
)
225
AM_CONDITIONAL(FETCH_NPAPI, [ test "${have_headers}" != "true" ])
226

227 228
dnl
dnl check the const-ness of GetMIMEDesc, since it changed in latest npapi headers
229
AC_MSG_CHECKING([if NP_GetMIMEDescription() returns const])
230
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
231
   #ifdef _WIN32
232 233 234 235 236 237 238
   # define XP_WIN 1
   #else
   # ifdef __APPLE__
   #  define XP_MACOSX 1
   # endif
   # define XP_UNIX 1
   #endif
239
   #include <stdint.h>
240
   #include <npapi.h>
241 242
   #include <npfunctions.h>
  char *NP_GetMIMEDescription(void);
243 244
])],[
  AC_MSG_RESULT(no)
245
  AC_DEFINE(NPP_GET_MIME_CONST, [], [Whether NP_GetMIMEDescription returns const])
246 247
],[
  AC_MSG_RESULT(yes)
248
  AC_DEFINE(NPP_GET_MIME_CONST, [const], [Whether NP_GetMIMEDescription returns const])
249 250
])

251 252
CPPFLAGS="${CPPFLAGS_save}"

253 254
AC_LANG_POP(C++)

255 256 257 258 259 260 261 262 263
])
dnl end of NPAPI
AM_CONDITIONAL(BUILD_NPAPI, test "${enable_npapi}" != "no")

dnl
dnl GTK+ for linux toolbar
AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [Build the GTK+ toolbars in NPAPI plugin [default=auto]]),, [with_gtk=yes])
gtk_found=no
AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ], [
264
  PKG_CHECK_MODULES(XCB, [xcb x11-xcb],[xcb_found=yes], [
265 266
     AC_MSG_ERROR([Please install the libxcb and x11-xcb development files])
  ])
267 268
  AS_IF([ test "x$with_gtk" != "xno" ],
    [
269
       PKG_CHECK_MODULES(GTK, [gtk+-2.0], [gtk_found=yes])
270
    ])
271
])
272 273 274
AS_IF([ test "x$gtk_found" = "xyes" ],
    AC_DEFINE([USE_GTK], [1], [Define to 1 if using GTK+]))
AM_CONDITIONAL(WITH_GTK, [ test "x$gtk_found" = "xyes" ])
275
AM_CONDITIONAL(HAVE_XCB, [ test "x$xcb_found" = "xyes" ])
276

277 278
dnl
dnl final flags for ActiveX
279 280 281 282
AM_COND_IF([HAVE_WIN32], [
  ACTIVEX_CPPFLAGS="${CPPFLAGS} -DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_"
  ACTIVEX_CXXFLAGS="${CXXFLAGS} -fno-exceptions"

283
  AC_ARG_VAR([ACTIVEX_LIBS], [linker flags for ActiveX])
284 285 286
  ACTIVEX_LIBS="${ACTIVEX_LIBS} -lole32 -loleaut32 -luuid -lshlwapi -lgdi32"
])

287 288 289
AC_CONFIG_FILES([
  Makefile
  share/Makefile
290
  common/Makefile
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
291
  npapi/Makefile
292
  activex/Makefile
293 294 295
  npapi/package/install.js
  npapi/package/install.rdf
  npapi/package/manifest.json
296
])
297

298 299
AM_COND_IF([HAVE_WIN32], [
  AC_CONFIG_FILES([
300
    npapi/package/npvlc_rc.rc
301 302
    activex/axvlc.inf
    activex/axvlc_rc.rc
303 304 305 306
  ])
])
AM_COND_IF([HAVE_DARWIN], [
  AC_CONFIG_FILES([
307
    npapi/package/vlc.r
308
    extras/macosx/Info.plist
309 310 311
  ])
])
AC_OUTPUT