Commit ac2f08d8 authored by Christophe Mutricy's avatar Christophe Mutricy

Simplify the detection for mozilla

parent ec57767b
...@@ -5429,83 +5429,40 @@ AC_ARG_WITH(mozilla-sdk-path, ...@@ -5429,83 +5429,40 @@ AC_ARG_WITH(mozilla-sdk-path,
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
if test "${enable_mozilla}" = "yes" if test "${enable_mozilla}" = "yes"
then then
dnl currently vlc plugin only needs headers, no xpcom support apis are actually used AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"],
need_xpcom_libs=false
if test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"
then
dnl New firefox-1.5 SDK api
PKG_CHECK_MODULES([FIREFOX], [firefox-plugin],
[
PKG_CHECK_MODULES([FIREFOX_XPCOM], [firefox-xpcom],
[],
[
PKG_CHECK_MODULES([MOZILLA_NSPR], [mozilla-nspr],
[],
[
PKG_CHECK_MODULES([NSPR], [nspr],
[],
[ [
AC_MSG_ERROR([Please install the nspr development tools.]) 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.
]
) 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])
CPPFLAGS="${CPPFLAGS_save} ${FIREFOX_CFLAGS} ${FIREFOX_XPCOM_CFLAGS} ${MOZILLA_NSPR_CFLAGS} ${NSPR_CFLAGS} ${MOZILLA_CPPFLAGS}" AC_MSG_NOTICE([Checking for Mozilla])
MOZILLA_REQUIRED_HEADERS=1 found=0
AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0) if test -n "$MOZILLA_CFLAGS" -a -n "$MOZILLA_LIBS"
AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0) then
AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0, found=1
[#if HAVE_NPAPI_H
# include <npapi.h>
#endif
])
if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then
AC_MSG_ERROR([Please install the Firefox development tools; mozilla-config.h, plugin/npapi.h and plugin/npruntime.h were not found.])
fi
MOZILLA_REQUIRED_HEADERS=
mozilla=:
firefox_include=`pkg-config --variable=includedir firefox-plugin`
if test -f "${firefox_include}/mozilla-config.h" -a -f "${firefox_include}/mozilla-config32.h"; then
MOZILLA_CONFIG_H="${firefox_include}/mozilla-config32.h"
elif test -f "${firefox_include}/mozilla-config.h" -a -f "${firefox_include}/mozilla-config64.h"; then
MOZILLA_CONFIG_H="${firefox_include}/mozilla-config64.h"
else else
MOZILLA_CONFIG_H="${firefox_include}/mozilla-config.h" if test -n "$PKG_CONFIG"; then
for i in seamonkey iceape xulrunner firefox iceweasel mozilla; do
echo "Trying to find $i .pc files" >&5
i="${i}-xpcom ${i}-plugin"
if $PKG_CONFIG --exists --print-errors "$i" 2>&5
then
echo "Using $i .pc files." >&5
echo "Using $i .pc files." >&6
found=1
MOZILLA_CFLAGS=$( $PKG_CONFIG --cflags "$i" )
MOZILLA_LIBS=$( $PKG_CONFIG --libs "$i" )
break
fi fi
if grep '^#define MOZ_X11 1' ${MOZILLA_CONFIG_H} 2>&1 > /dev/null ; then done
AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXpm])
fi fi
VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}]) fi
VLC_ADD_LDFLAGS([mozilla],[${MOZILLA_LDFLAGS}]) AS_IF( [test $found = 1],[
VLC_ADD_LIBS([mozilla],[${FIREFOX_LIBS} ${MOZILLA_NSPR_LIBS} ${NSPR_LIBS}]) CPPFLAGS="${CPPFLAGS_save} ${MOZILLA_CFLAGS}"
VLC_ADD_PLUGIN([mozilla])
MOZILLA_CONFIG=
CPPFLAGS="${CPPFLAGS_save}"
],
[
PKG_CHECK_MODULES([XULRUNNER], [libxul],
[
PKG_CHECK_MODULES([FIREFOX_XPCOM], [firefox-xpcom],
[],
[
PKG_CHECK_MODULES([MOZILLA_NSPR], [mozilla-nspr],
[],
[
PKG_CHECK_MODULES([NSPR], [nspr],
[],
[
AC_MSG_ERROR([Please install the nspr development tools.])
]
)
]
)
]
)
CPPFLAGS="${CPPFLAGS_save} ${XULRUNNER_CFLAGS} ${XULRUNNER_CPPFLAGS} ${FIREFOX_XPCOM_CFLAGS} ${MOZILLA_NSPR_CFLAGS} ${NSPR_CFLAGS} ${MOZILLA_CPPFLAGS}"
MOZILLA_REQUIRED_HEADERS=1 MOZILLA_REQUIRED_HEADERS=1
AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0)
AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0) AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0, AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
[#if HAVE_NPAPI_H [#if HAVE_NPAPI_H
...@@ -5513,47 +5470,34 @@ then ...@@ -5513,47 +5470,34 @@ then
#endif #endif
]) ])
if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then
AC_MSG_ERROR([Please install the Mozilla runtime package xulrunner-devel; plugplugin/npapi.h and plugin/npruntime.h were not found.]) AC_MSG_ERROR([Please install the Firefox development tools; mozilla-config.h, plugin/npapi.h and plugin/npruntime.h were not found.])
fi fi
MOZILLA_REQUIRED_HEADERS= MOZILLA_REQUIRED_HEADERS=
mozilla=: mozilla=:
AC_DEFINE([XP_UNIX],[1],[Defined for Mozilla as we are Unix]) AC_EGREP_CPP(yes,
AC_DEFINE([MOZ_X11],[1],[Defined as Unix mozilla uses X11]) [#include <mozilla-config.h>
AC_DEFINE([OJI],[1],[Java Runtime Interface]) #ifdef MOZ_X11
AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h])) yes
#endif],
[AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXpm]) VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXpm])
])
VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}]) VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}])
VLC_ADD_LDFLAGS([mozilla],[${MOZILLA_LDFLAGS}]) VLC_ADD_LIBS([mozilla],[${MOZILLA_LIBS}])
VLC_ADD_LIBS([mozilla],[${FIREFOX_LIBS} ${MOZILLA_NSPR_LIBS} ${NSPR_LIBS}])
VLC_ADD_PLUGIN([mozilla]) VLC_ADD_PLUGIN([mozilla])
PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
MOZILLA_CONFIG= MOZILLA_CONFIG=
CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS="${CPPFLAGS_save}"
], ],
[ [
AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no) AC_PATH_PROGS(MOZILLA_CONFIG,
if test "${MOZILLA_CONFIG}" = "no" [mozilla-config seamonkey-config xulrunner-config],
then AC_MSG_ERROR([Please install the Mozilla development tools. mozilla-config was not found.])
AC_PATH_PROG(SEAMONKEY_CONFIG, seamonkey-config, no)
if test "${SEAMONKEY_CONFIG}" = "no"
then
AC_PATH_PROG(XULRUNNER_CONFIG, xulrunner-config, no)
if test "${XULRUNNER_CONFIG}" = "no"
then
AC_MSG_ERROR([Please install the Mozilla development tools, mozilla-config was not found.])
else
have_xul=true
MOZILLA_CONFIG="${XULRUNNER_CONFIG}"
fi
else
MOZILLA_CONFIG="${SEAMONKEY_CONFIG}"
fi
fi
]
) )
] ]
) )
if test ! -z "${MOZILLA_CONFIG}" dnl pkg-config failed but we might have found a mozilla-config
then AS_IF( [test ! -z "${MOZILLA_CONFIG}"],[
if ${MOZILLA_CONFIG} --defines | grep -q 'MOZ_X11=1'; then if ${MOZILLA_CONFIG} --defines | grep -q 'MOZ_X11=1'; then
LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}" LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}"
AC_CHECK_LIB(Xt,XtStrings, AC_CHECK_LIB(Xt,XtStrings,
...@@ -5570,13 +5514,8 @@ then ...@@ -5570,13 +5514,8 @@ then
mozilla=: mozilla=:
PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla" PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490 VLC_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin java`]])
VLC_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`]])
if ${need_xpcom_libs}; then
VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin xpcom`])
else
VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin`]) VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin`])
fi
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}" CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}"
MOZILLA_REQUIRED_HEADERS=1 MOZILLA_REQUIRED_HEADERS=1
AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0) AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0)
...@@ -5593,9 +5532,9 @@ then ...@@ -5593,9 +5532,9 @@ then
MOZILLA_REQUIRED_HEADERS= MOZILLA_REQUIRED_HEADERS=
CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS="${CPPFLAGS_save}"
MOZILLA_SDK_PATH="`${MOZILLA_CONFIG} --prefix`" MOZILLA_SDK_PATH="`${MOZILLA_CONFIG} --prefix`"
fi ])
dnl End of moz_sdk = "" dnl End of moz_sdk = ""
else ],[
dnl special case for mingw32 dnl special case for mingw32
if test "${SYS}" = "mingw32" if test "${SYS}" = "mingw32"
then then
...@@ -5640,7 +5579,7 @@ then ...@@ -5640,7 +5579,7 @@ then
real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`" real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
fi fi
CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS="${CPPFLAGS_save}"
fi ])
fi fi
AC_LANG_POP(C++) AC_LANG_POP(C++)
AM_CONDITIONAL(BUILD_MOZILLA,${mozilla}) AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
......
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