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

3
AC_COPYRIGHT([Copyright 2002-2011 the VideoLAN team])
4

5
AC_INIT(npapi-vlc, 1.2.0-git)
6 7 8 9 10 11 12 13
VERSION_MAJOR="1"
AC_SUBST(VERSION_MAJOR)
VERSION_MINOR="2"
AC_SUBST(VERSION_MINOR)
VERSION_REVISION="0"
AC_SUBST(VERSION_REVISION)
VERSION_EXTRA="-git"
AC_SUBST(VERSION_EXTRA)
14 15 16 17 18 19 20
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") ;;
       *) if test ${VERSION_EXTRA} = "-git"; then VERSION_EXTRA_RC="666"; else VERSION_EXTRA_RC="99"; fi
esac
AC_SUBST(VERSION_EXTRA_RC)
21
COPYRIGHT_YEARS="2002-2010"
22 23 24
AC_SUBST(COPYRIGHT_YEARS)
COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
AC_SUBST(COPYRIGHT_MESSAGE)
25

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
26
AC_CONFIG_SRCDIR(npapi/vlcplugin.cpp)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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)
AM_CONFIG_HEADER(config.h)

# 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

47 48 49 50 51 52
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])

53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
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

dnl
dnl  Check the operating system
dnl
case "${host_os}" in
  darwin*)
    SYS=darwin

    dnl Force gcc "-arch" flag
    ARCH_flag=""
    case "${host}" in
      i386*)
        ARCH_flag="-arch i386"
      ;;
      ppc64*)
        ARCH_flag="-arch ppc64"
      ;;
      ppc*)
        ARCH_flag="-arch ppc"
      ;;
      x86_64*)
        ARCH_flag="-arch x86_64"
      ;;
    esac

Rafaël Carré's avatar
Rafaël Carré committed
89 90 91 92
    CFLAGS="${CFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
    CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
    CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
    LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
93 94 95 96 97
    ;;
  *mingw32*)
    SYS=mingw32
    AC_CHECK_TOOL(WINDRES, windres, :)
    AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0501' for Windows XP APIs.])
Rafaël Carré's avatar
Rafaël Carré committed
98
    AC_DEFINE([_WIN32], 1, [Define to 1 if targetting Windows.])
99 100 101 102
    ;;
esac
AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
103 104
AC_ARG_ENABLE(activex, AS_HELP_STRING(--disable-activex, Do not build ActiveX plugin))
AM_CONDITIONAL(BUILD_ACTIVEX, test "${SYS}" = "mingw32" -a "${enable_activex}" != "no")
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

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)
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.])
])

AC_PATH_XTRA
128
PKG_CHECK_MODULES([LIBVLC], [libvlc >= 1.1.0])
129

130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
AS_IF([test "${SYS}" = "mingw32"],[
    AC_CHECK_PROGS(MIDL, [midl], no)

    dnl FIXME
    dnl AC_CHECK_PROGS(WIDL, [widl], no)
    dnl
    WIDL="no"

    AM_CONDITIONAL(HAS_MIDL_COMPILER, test "${MIDL}" != "no")
    AM_CONDITIONAL(HAS_WIDL_COMPILER, test "${WIDL}" != "no")

    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++)
])

148 149 150 151 152 153 154 155 156 157 158 159 160

AC_ARG_WITH(mozilla-sdk-path,
  [  --with-mozilla-sdk-path=PATH path to mozilla sdk])
AC_ARG_WITH(mozilla-pkg,
  [  --with-mozilla-pkg=PKG  look for PKG.pc to build the mozilla plugin.])
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])

AC_LANG_PUSH(C++)
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.

161 162
CPPFLAGS="${CPPFLAGS} -Icommon"

163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
AC_MSG_NOTICE([Checking for Mozilla])
AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"], [
  found=0
  if test -n "$MOZILLA_CFLAGS" -o -n "$MOZILLA_LIBS"
  then
    found=1
  else
    if test -n "$PKG_CONFIG"; then
      for i in "${with_mozilla_pkg}" libxul {seamonkey,iceape,xulrunner,firefox,iceweasel,mozilla}-plugin; do
        if test -n "$i"; then
          echo "Trying to find $i package" >&AS_MESSAGE_LOG_FD
          AC_MSG_CHECKING([for $i >= 1.9.2])
          if $PKG_CONFIG --exists --print-errors "$i >= 1.9.2" 2>&AS_MESSAGE_LOG_FD
          then
            echo "Using $i pkg-config package." >&AS_MESSAGE_LOG_FD
             echo "Using $i package." >&AS_MESSAGE_FD
            found=1
            MOZILLA_CFLAGS=$(eval $PKG_CONFIG --cflags "$i" )
            MOZILLA_LIBS=$(eval $PKG_CONFIG --libs "$i" )
            AC_MSG_RESULT([yes])
            break
          fi
          AC_MSG_RESULT([no])
        fi
      done
    fi
  fi
  AS_IF( [test $found = 1],[
Rafaël Carré's avatar
Rafaël Carré committed
191
    CPPFLAGS="${CPPFLAGS} ${MOZILLA_CFLAGS}"
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
    MOZILLA_REQUIRED_HEADERS=1
    AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
    AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
      [#if HAVE_NPAPI_H
       # include <npapi.h>
       #endif
      ])
    if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then
      AC_MSG_ERROR([Please install the Firefox development tools; plugin/npapi.h and/or plugin/npruntime.h were not found.])
    fi
    MOZILLA_REQUIRED_HEADERS=
    mozilla=:
    AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"],[
      PKG_CHECK_MODULES(XPM, [xpm xt],, [
        AC_MSG_ERROR([Please install the libXpm and libXt development files.])
      ])
    ])
  ], [
    AC_MSG_ERROR([Please install the Mozilla development tools (version 1.9.2 or higher).])
  ])
  dnl End of moz_sdk = ""
], [
  dnl special case for mingw32
  AS_IF([test "${SYS}" = "mingw32"], [
    AC_CHECK_TOOL(CYGPATH, cygpath, "")
    dnl latest gecko sdk does not have an xpcom directory
    AS_IF([test -d "${with_mozilla_sdk_path}/xpcom"], [
      mozilla_sdk_xpcom="/xpcom"
    ])
  ])

  real_mozilla_sdk="`cd ${with_mozilla_sdk_path} 2>/dev/null && pwd`"
Rafaël Carré's avatar
Rafaël Carré committed
224
  CPPFLAGS="${CPPFLAGS} -I${real_mozilla_sdk}/include"
225 226 227 228 229 230 231 232 233 234 235 236 237
  MOZILLA_REQUIRED_HEADERS=1
  AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
  AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
      [#if HAVE_NPAPI_H
        #include <npapi.h>
        #endif
      ])
  AS_IF([test "${MOZILLA_REQUIRED_HEADERS}" = "0"], [
    AC_MSG_ERROR([Please install the Mozilla development tools, required headers were not found.])
  ])
])
AC_LANG_POP(C++)

238 239 240 241 242 243 244 245
AM_COND_IF([HAVE_WIN32], [
  ACTIVEX_CPPFLAGS="${CPPFLAGS} -DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_"
  ACTIVEX_CXXFLAGS="${CXXFLAGS} -fno-exceptions"

  AC_ARG_VAR([ACTIVEX_LIBS], [linker flags for Activex])
  ACTIVEX_LIBS="${ACTIVEX_LIBS} -lole32 -loleaut32 -luuid -lshlwapi -lgdi32"
])

246 247 248
AC_CONFIG_FILES([
  Makefile
  share/Makefile
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
249 250 251 252
  npapi/Makefile
  npapi/install.js
  npapi/install.rdf
  npapi/manifest.json
253
])
254

255 256
AM_COND_IF([HAVE_WIN32], [
  AC_CONFIG_FILES([
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
257
    npapi/npvlc_rc.rc
258 259 260
    activex/Makefile
    activex/axvlc.inf
    activex/axvlc_rc.rc
261 262 263 264
  ])
])
AM_COND_IF([HAVE_DARWIN], [
  AC_CONFIG_FILES([
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
265
    npapi/vlc.r
266 267
    extras/macosx/Info.plist
    extras/macosx/InstallerInfo.plist
268 269 270
  ])
])
AC_OUTPUT