Commit 03a411f9 authored by Rafaël Carré's avatar Rafaël Carré

npapi: simplify mozilla detection

parent c852cdb8
...@@ -145,29 +145,20 @@ AS_IF([test "${SYS}" = "mingw32"],[ ...@@ -145,29 +145,20 @@ AS_IF([test "${SYS}" = "mingw32"],[
AC_LANG_POP(C++) AC_LANG_POP(C++)
]) ])
AC_ARG_WITH(mozilla-sdk-path,
[ --with-mozilla-sdk-path=PATH path to mozilla sdk])
AC_ARG_WITH(mozilla-pkg, AC_ARG_WITH(mozilla-pkg,
[ --with-mozilla-pkg=PKG look for PKG.pc to build the mozilla plugin.]) [ --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_CFLAGS], [C compiler flags for Mozilla, overriding pkg-config])
AC_ARG_VAR([MOZILLA_LIBS], [linker flags for Mozilla, overriding pkg-config]) AC_ARG_VAR([MOZILLA_LIBS], [linker flags for Mozilla, overriding pkg-config])
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
AC_MSG_NOTICE([Checking for Mozilla])
if test -z "$MOZILLA_CFLAGS" -a -z "$MOZILLA_LIBS" -a -n "$PKG_CONFIG"
then
dnl pkg-config dnl pkg-config
dnl As we want to do a loop due to the number of name possible for the .pc 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. dnl we can't use the pkg-config macros.
CPPFLAGS="${CPPFLAGS} -Icommon"
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 for i in "${with_mozilla_pkg}" libxul {seamonkey,iceape,xulrunner,firefox,iceweasel,mozilla}-plugin; do
if test -n "$i"; then if test -n "$i"; then
echo "Trying to find $i package" >&AS_MESSAGE_LOG_FD echo "Trying to find $i package" >&AS_MESSAGE_LOG_FD
...@@ -176,7 +167,6 @@ AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no" ...@@ -176,7 +167,6 @@ AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"
then then
echo "Using $i pkg-config package." >&AS_MESSAGE_LOG_FD echo "Using $i pkg-config package." >&AS_MESSAGE_LOG_FD
echo "Using $i package." >&AS_MESSAGE_FD echo "Using $i package." >&AS_MESSAGE_FD
found=1
MOZILLA_CFLAGS=$(eval $PKG_CONFIG --cflags "$i" ) MOZILLA_CFLAGS=$(eval $PKG_CONFIG --cflags "$i" )
MOZILLA_LIBS=$(eval $PKG_CONFIG --libs "$i" ) MOZILLA_LIBS=$(eval $PKG_CONFIG --libs "$i" )
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
...@@ -185,56 +175,30 @@ AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no" ...@@ -185,56 +175,30 @@ AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
done done
fi fi
fi
AS_IF( [test $found = 1],[ CPPFLAGS="${CPPFLAGS} ${MOZILLA_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${MOZILLA_CFLAGS}"
MOZILLA_REQUIRED_HEADERS=1 AC_CHECK_HEADERS(npapi.h)
AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0) AC_CHECK_HEADERS(npruntime.h, [
AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0, dnl if found
[#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"],[ AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"],[
PKG_CHECK_MODULES(XPM, [xpm xt],, [ PKG_CHECK_MODULES(XPM, [xpm xt],, [
AC_MSG_ERROR([Please install the libXpm and libXt development files.]) AC_MSG_ERROR([Please install the libXpm and libXt development files.])
]) ])
]) ])],[
dnl if not found
AC_MSG_ERROR([Please install the Mozilla development tools, required headers were not found.])
], [ ], [
AC_MSG_ERROR([Please install the Mozilla development tools (version 1.9.2 or higher).]) #if HAVE_NPAPI_H
])
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`"
CPPFLAGS="${CPPFLAGS} -I${real_mozilla_sdk}/include"
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> #include <npapi.h>
#endif #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++) AC_LANG_POP(C++)
AM_COND_IF([HAVE_WIN32], [ AM_COND_IF([HAVE_WIN32], [
ACTIVEX_CPPFLAGS="${CPPFLAGS} -DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_" ACTIVEX_CPPFLAGS="${CPPFLAGS} -DUNICODE -D_UNICODE -D_MIDL_USE_GUIDDEF_"
ACTIVEX_CXXFLAGS="${CXXFLAGS} -fno-exceptions" ACTIVEX_CXXFLAGS="${CXXFLAGS} -fno-exceptions"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment