-moz_include_dir := \
- $(shell pkg-config --variable=prefix mozilla-gtkmozembed)/include/mozilla
-moz_lib_dir := \
- $(shell pkg-config --variable=prefix mozilla-gtkmozembed)/lib/mozilla
-
-moz_version := \
- $(shell sed 's/\#define MOZILLA_VERSION "\(.*\)"/\1/; t; d' \
- < $(moz_include_dir)/mozilla-config.h)
+ifeq ($(shell pkg-config --atleast-version 1.9 mozilla-gtkmozembed-embedding && echo yes),yes)
+ moz_name := xulrunner-1.9
+ moz_pc := mozilla-gtkmozembed-embedding
+ moz_cppflags_extra := $(shell pkg-config --cflags xulrunner-nspr) -DXPCOM_GLUE_USE_NSPR
+ moz_unstable_cppflags_extra :=
+ moz_ldflags_extra := $(shell pkg-config --libs xulrunner-nspr)
+ # libxpcomglue needs libdl, but mozilla-gtkmozembed-embedding.pc
+ # doesn't mention it.
+ moz_ldflags_extra += -ldl
+else
+ ifeq ($(shell pkg-config --exists xulrunner-gtkmozembed && echo yes),yes)
+ moz_name := xulrunner
+ moz_pc := xulrunner-gtkmozembed
+ else
+ moz_name := mozilla
+ moz_pc := mozilla-gtkmozembed
+ endif
+ moz_unstable_cppflags_extra = \
+ $(addprefix -I$(moz_include_dir)/, \
+ content docshell dom gfx imglib2 layout locale necko uconv webshell widget) \
+ -DMOZILLA_INTERNAL_API
+ moz_ldflags_extra = -Wl,-rpath,$(moz_lib_dir)
+endif
+
+moz_prefix := $(shell pkg-config --variable=prefix $(moz_pc))
+moz_include_dir := $(shell pkg-config --variable=includedir $(moz_pc))
+moz_lib_dir := $(moz_prefix)/lib/$(moz_name)
+
+moz_version := $(shell pkg-config --modversion $(moz_pc))