Commit ac2f08d8 authored by Christophe Mutricy's avatar Christophe Mutricy

Simplify the detection for mozilla

parent ec57767b
...@@ -5429,30 +5429,38 @@ AC_ARG_WITH(mozilla-sdk-path, ...@@ -5429,30 +5429,38 @@ 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 [
dnl pkg-config
if test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no" dnl As we want to do a loop due to the number of name possible for the .pc
then dnl we can't use the pkg-config macros.
dnl New firefox-1.5 SDK api
PKG_CHECK_MODULES([FIREFOX], [firefox-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])
PKG_CHECK_MODULES([FIREFOX_XPCOM], [firefox-xpcom], AC_MSG_NOTICE([Checking for Mozilla])
[], found=0
[ if test -n "$MOZILLA_CFLAGS" -a -n "$MOZILLA_LIBS"
PKG_CHECK_MODULES([MOZILLA_NSPR], [mozilla-nspr], then
[], found=1
[ else
PKG_CHECK_MODULES([NSPR], [nspr], if test -n "$PKG_CONFIG"; then
[], for i in seamonkey iceape xulrunner firefox iceweasel mozilla; do
[ echo "Trying to find $i .pc files" >&5
AC_MSG_ERROR([Please install the nspr development tools.]) 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
CPPFLAGS="${CPPFLAGS_save} ${FIREFOX_CFLAGS} ${FIREFOX_XPCOM_CFLAGS} ${MOZILLA_NSPR_CFLAGS} ${NSPR_CFLAGS} ${MOZILLA_CPPFLAGS}" MOZILLA_CFLAGS=$( $PKG_CONFIG --cflags "$i" )
MOZILLA_LIBS=$( $PKG_CONFIG --libs "$i" )
break
fi
done
fi
fi
AS_IF( [test $found = 1],[
CPPFLAGS="${CPPFLAGS_save} ${MOZILLA_CFLAGS}"
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)
AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0) AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
...@@ -5466,94 +5474,30 @@ then ...@@ -5466,94 +5474,30 @@ then
fi fi
MOZILLA_REQUIRED_HEADERS= MOZILLA_REQUIRED_HEADERS=
mozilla=: mozilla=:
firefox_include=`pkg-config --variable=includedir firefox-plugin` AC_EGREP_CPP(yes,
if test -f "${firefox_include}/mozilla-config.h" -a -f "${firefox_include}/mozilla-config32.h"; then [#include <mozilla-config.h>
MOZILLA_CONFIG_H="${firefox_include}/mozilla-config32.h" #ifdef MOZ_X11
elif test -f "${firefox_include}/mozilla-config.h" -a -f "${firefox_include}/mozilla-config64.h"; then yes
MOZILLA_CONFIG_H="${firefox_include}/mozilla-config64.h" #endif],
else [AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
MOZILLA_CONFIG_H="${firefox_include}/mozilla-config.h"
fi
if grep '^#define MOZ_X11 1' ${MOZILLA_CONFIG_H} 2>&1 > /dev/null ; then
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])
fi ])
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}"
],
[
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
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 Mozilla runtime package xulrunner-devel; plugplugin/npapi.h and plugin/npruntime.h were not found.])
fi
MOZILLA_REQUIRED_HEADERS=
mozilla=:
AC_DEFINE([XP_UNIX],[1],[Defined for Mozilla as we are Unix])
AC_DEFINE([MOZ_X11],[1],[Defined as Unix mozilla uses X11])
AC_DEFINE([OJI],[1],[Java Runtime Interface])
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_CPPFLAGS([mozilla],[${CPPFLAGS}])
VLC_ADD_LDFLAGS([mozilla],[${MOZILLA_LDFLAGS}])
VLC_ADD_LIBS([mozilla],[${FIREFOX_LIBS} ${MOZILLA_NSPR_LIBS} ${NSPR_LIBS}])
VLC_ADD_PLUGIN([mozilla])
MOZILLA_CONFIG=
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
] ]
) )
] dnl pkg-config failed but we might have found a mozilla-config
) AS_IF( [test ! -z "${MOZILLA_CONFIG}"],[
if test ! -z "${MOZILLA_CONFIG}"
then
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`]]) VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin`])
if ${need_xpcom_libs}; then
VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin xpcom`])
else
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