Thanks Dan,
I went and wrote some stuff to do what I want for now and have attached
it below. To use it, attach it to the end of your aclocal.m4 and call
AQ_CHECK_MOZILLA() from your configure.in. The following (probably
dangerous and/or foolish) assumptions are made:
1) The default location for libgtkmozembed.so is /usr/local/mozilla.
This can be over-ridden with the --with-mozilla-dir=DIR configure option.
2) The default location for gtkmozembed.h is the current directory. This
can be over-ridden with the --with-mozilla-incl-dir=DIR configure
switch. This implies that people who are distributing source code will
need to include gtkmozembed.h, begging the question of whether this is a
platform independent chunk of code.
3) The directories the user provides with the --with switches are not
"trailing slash safe". IOW, if the user types /usr/lib/mozilla/ instead
of /usr/lib/mozilla it won't work. [Hangs head in shame at his lack of
sed know-how]
4) C++ is the language used -- I couldn't immediately muddle out how to
check the AC_PROG_* language selection so just put a comment in below
where you need to change CXXFLAGS to CFLAGS if you are of the AC_PROG_CC
persuasion.
5) I've only tried this on Linux. When I get some free time I'll try it
on the Sourceforge build farm on some other platforms.
Cheers,
D
dnl *********************** append to aclocal.m4 ****
dnl
dnl AQ_CHECK_MOZILLA()
dnl Sets up LIBS and C[XX]FLAGS for you
dnl Dominic Tracey
dnl
Aquilon Technology Systems, Inc.
dnl
1/23/02
dnl
AC_DEFUN(AQ_CHECK_MOZILLA, [
AC_MSG_CHECKING("Mozilla lib dir")
mozilla_lib_dir="/usr/local/mozilla"
AC_ARG_WITH(mozilla-dir, [--with-mozilla-dir=DIR specify where
mozilla is installed],
mozilla_lib_dir="$withval")
AC_MSG_RESULT($mozilla_lib_dir)
dnl check for mozilla lib
dnl assuming no trailing backslash on the provided directory! Should trim!
dnl cannot muster sed technology...
moz_lib_file="/libgtkembedmoz.so"
moz_lib=$mozilla_lib_dir$moz_lib_file
if test ! -e $moz_lib; then
AC_MSG_ERROR([Couldn't find the Mozilla installation. If
you don't have mozilla installed, please download it from
http://mozilla.org before continuing with this installation.
If you have Mozilla installed, try telling configure
the directory where it can be found with:
./configure --with-mozilla-dir=DIR
replacing DIR with the Mozilla installation directory.
See the file 'config.log' for further diagnostics.])
fi
LIBS="$LIBS -L$mozilla_lib_dir"
dnl now the include file -- assume its distributed with the program
dnl being installed (though allow an over-ride if someone wants to
dnl use the version in a source tree). Not sure how platform independent
dnl gtkmozembed.h is.
AC_MSG_CHECKING("Mozilla include dir")
mozilla_incl_dir="."
AC_ARG_WITH(mozilla-incl-dir, [--with-mozilla-incl-dir=DIR
specify where mozilla header file gtkembed.h is],
mozilla_incl_dir="$withval")
AC_MSG_RESULT($mozilla_incl_dir)
dnl check for gtkmozembed.h
dnl assuming no trailing backslash on the provided directory! Should trim!
dnl cannot muster sed technology...
moz_incl_file="/gtkmozembed.h"
moz_incl=$mozilla_incl_dir$moz_incl_file
if test ! -e $moz_incl; then
AC_MSG_ERROR([Couldn't find the Mozilla header file gtkmozembed.h.
If you don't have this file on your system, please download a source package
from http://mozilla.org before continuing with this installation.
If you have this file, try telling configure where you have it installed
with:
./configure --with-mozilla-incl-dir=DIR
replacing DIR with the directory name where gtkmozembed.h lives.
See the file 'config.log' for further diagnostics.])
fi
dnl Note the C++ hard code here. If you use AC_PROG_CC in your configure.in,
dnl you'll want to change the CXXFLAGS below to CFLAGS.
if test $mozilla_incl_dir != "."; then
CXXFLAGS="$CXXFLAGS -I$mozilla_incl_dir `gtk-config --cflags`"
else
CXXFLAGS="$CXXFLAGS `gtk-config --cflags`"
fi
dnl try it out -- if successful sets config.h and LIBS ovar
AC_CHECK_LIB(gtkembedmoz,gtk_moz_embed_new,,BAD_LINK=t)
if test BAD_LINK = t; then
AC_MSG_ERROR([
The specified library, $MOZ_LIB, did not work properly.
Perhaps you need a newer version of Mozilla.
If you don't have mozilla installed, please download it from
http://mozilla.org before continuing with this installation.
If you have Mozilla installed, try telling configure
where you have it installed with:
./configure --with-mozilla-dir=DIR
replacing DIR with the Mozilla installation directory.
See the file 'config.log' for further diagnostics.])
fi
])
dnl **************** end aclocal.m4 addition ********
Dan Mosedale wrote:
> [EMAIL PROTECTED] writes:
>
>>Hi,
>>
>>I'm developing a GTK+ app that uses the gtkembedmoz control. I am trying
>>to leverage the GNU make tools to make my app as platform independent as
>>possible so I don't want to distribute pre-compiled gecko components but
>>rather use ./configure to set up everything I need to build. Initially I
>>am focusing on *NIX builds. I don't have much experience with autoconf
>>so some of these questions may be dumb. Here are the problems I think I
>>am looking at:
>>
>>1) I'd like people to just be able to install the vanilla binary builds
>>and have my program's configure find the appropriate installed
>>libraries. I don't believe the mozilla installation either a) puts the
>>necessary libraries in a system library path or b) updates the linker's
>>search path (in /etc/ld.so.conf). This makes it tough to use the
>>AC_CHECK_LIB macro. Any thoughts on this? I can include a
>>--with-mozilla-dir=DIR configure option but that still doesn't give me
>>enough to use AC_CHECK_LIB since there is no way to provide a -L
>>directory to the test linker.
>>
>>2) I don't see any headers installed with the vanilla distributions. My
>>application needs to #include gtkmozembed.h. The mozilla ./configure has
>>munged my copy of gtkmozembed.h so I'm assuming can't just package a
>>copy in with my source code. Or is this not true?
>>
>
> I've added .unix to the newsgroups line, in the hopes that someone
> there who knows a bit more (blizzard? cls?) will chime in with advice
> for the above questions.
>
>
>>Is there an aclocal.m4 out there that I can start with to resolve some
>>of these issues? Or am I left with no option but to release
>>platform-specific source distributions?
>>
>
> If there's not, consider filing a bug in bugzilla to create one and
> get it checeked into the Mozilla tree. I think many folks would be
> interested in building off such work.
>
> Dan
>