diff --git a/mozilla/aclocal.m4 b/mozilla/aclocal.m4 index a05035902d0..82055d9e6ca 100644 --- a/mozilla/aclocal.m4 +++ b/mozilla/aclocal.m4 @@ -7,6 +7,7 @@ builtin(include, build/autoconf/glib.m4)dnl builtin(include, build/autoconf/gtk.m4)dnl builtin(include, build/autoconf/libIDL.m4)dnl builtin(include, build/autoconf/nspr.m4)dnl +builtin(include, build/autoconf/pkg.m4)dnl dnl define(MOZ_TOPSRCDIR,.)dnl MOZ_TOPSRCDIR is used in altoptions.m4 builtin(include, build/autoconf/altoptions.m4)dnl diff --git a/mozilla/build/autoconf/pkg.m4 b/mozilla/build/autoconf/pkg.m4 new file mode 100644 index 00000000000..290ee06ab75 --- /dev/null +++ b/mozilla/build/autoconf/pkg.m4 @@ -0,0 +1,57 @@ +dnl This file is Copyright 2001 Red Hat, Inc. +dnl This file is in the public domain. +dnl +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + else + if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7.0; then + echo "*** Your version of pkg-config is too old. You need version 0.7.0 or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + else + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + diff --git a/mozilla/configure.in b/mozilla/configure.in index 88adb9368fa..4ede1e07199 100644 --- a/mozilla/configure.in +++ b/mozilla/configure.in @@ -87,6 +87,7 @@ LIBIDL_VERSION=0.6.3 PERL_VERSION=5.004 QT_VERSION=2.2.0 QT_VERSION_NUM=220 +GTK2_VERSION=1.3.7 dnl Set various checks dnl ======================================================== @@ -1154,15 +1155,16 @@ then AC_ARG_ENABLE(toolkit, [ --enable-toolkit=\$val Enable \$val fe (defaults to gtk)], [ if test "$enableval" = "motif" \ - -o "$enableval" = "gtk" \ - -o "$enableval" = "qt" \ - -o "$enableval" = "xlib" + -o "$enableval" = "gtk" \ + -o "$enableval" = "qt" \ + -o "$enableval" = "gtk2" \ + -o "$enableval" = "xlib" then dnl nglayout only supports building with one toolkit, dnl so ignore everything after the first comma (","). MOZ_WIDGET_TOOLKIT=`echo "$enableval" | sed -e "s/,.*$//"` else - AC_MSG_ERROR(Toolkit must be Xlib, GTK, Qt, or Motif.) + AC_MSG_ERROR(Toolkit must be xlib, gtk, gtk2, qt, or motif.) fi], [ MOZ_WIDGET_TOOLKIT="gtk" ]) @@ -1306,6 +1308,12 @@ then AC_DEFINE(MOZ_WIDGET_GTK) fi +if test "$MOZ_WIDGET_TOOLKIT" = "gtk2" +then + MOZ_ENABLE_GTK2=1 + AC_DEFINE(MOZ_WIDGET_GTK2) +fi + if test "$MOZ_WIDGET_TOOLKIT" = "xlib" then MOZ_ENABLE_XLIB=1 @@ -1364,7 +1372,6 @@ then AM_PATH_GTK($GTK_VERSION,, AC_MSG_ERROR(Test for GTK failed.)) - dnl ======================================================== dnl = = dnl = --with-java-supplement = @@ -1461,6 +1468,15 @@ dnl = order matters to the Build Configurator. = dnl = = dnl ======================================================== +dnl ======================================================== +dnl = Gtk2 support +dnl ======================================================== + +if test "$MOZ_ENABLE_GTK2" +then + PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= 1.3.7) +fi + dnl ======================================================== dnl = = dnl = --with-xprint = @@ -1779,6 +1795,12 @@ then TK_LIBS="$MOZ_GTK_LDFLAGS" fi +if test "$MOZ_WIDGET_TOOLKIT" = "gtk2" +then + TK_CFLAGS="$MOZ_GTK2_CFLAGS" + TK_LIBS="$MOZ_GTK2_LDFLAGS" +fi + if test "$MOZ_WIDGET_TOOLKIT" = "xlib" then TK_CFLAGS="$MOZ_XLIB_CFLAGS" @@ -1811,14 +1833,14 @@ AC_SUBST(TK_LIBS) AC_SUBST(MOZ_ENABLE_GTK) AC_SUBST(MOZ_ENABLE_MOTIF) AC_SUBST(MOZ_ENABLE_XLIB) -AC_SUBST(MOZ_ENABLE_GTK) -AC_SUBST(MOZ_ENABLE_MOTIF) -AC_SUBST(MOZ_ENABLE_XLIB) +AC_SUBST(MOZ_ENABLE_GTK2) AC_SUBST(MOZ_ENABLE_QT) AC_SUBST(MOZ_ENABLE_PHOTON) AC_SUBST(MOZ_ENABLE_XREMOTE) AC_SUBST(MOZ_GTK_CFLAGS) AC_SUBST(MOZ_GTK_LDFLAGS) +AC_SUBST(MOZ_GTK2_CFLAGS) +AC_SUBST(MOZ_GTK2_LDFLAGS) AC_SUBST(MOZ_MOTIF_CFLAGS) AC_SUBST(MOZ_MOTIF_LDFLAGS) AC_SUBST(MOZ_XLIB_CFLAGS) @@ -1845,7 +1867,8 @@ AC_SUBST(XLIBS) AC_SUBST(MOC) if test "$MOZ_ENABLE_GTK" || test "$MOZ_ENABLE_QT" \ -|| test "$MOZ_ENABLE_XLIB" || test "$MOZ_ENABLE_MOTIF" +|| test "$MOZ_ENABLE_XLIB" || test "$MOZ_ENABLE_MOTIF" \ +|| test "$MOZ_ENABLE_GTK2" then AC_DEFINE(MOZ_X11) fi diff --git a/mozilla/gfx/src/Makefile.in b/mozilla/gfx/src/Makefile.in index 26f33ffad97..d762192c005 100644 --- a/mozilla/gfx/src/Makefile.in +++ b/mozilla/gfx/src/Makefile.in @@ -50,6 +50,9 @@ else ifdef MOZ_ENABLE_GTK DIRS += gtk endif +ifdef MOZ_ENABLE_GTK2 +DIRS += gtk2 +endif ifdef MOZ_ENABLE_MOTIF DIRS += motif endif diff --git a/mozilla/widget/src/Makefile.in b/mozilla/widget/src/Makefile.in index 7a3cd3fa04e..030a137b8a6 100644 --- a/mozilla/widget/src/Makefile.in +++ b/mozilla/widget/src/Makefile.in @@ -43,6 +43,10 @@ DIRS += gtkxtbin DIRS += gtk endif +ifdef MOZ_ENABLE_GTK2 +DIRS += gtk2 +endif + ifdef MOZ_ENABLE_MOTIF DIRS += motif endif