summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-06-22 15:58:37 -0300
committerDan Winship <danw@gnome.org>2013-12-09 18:54:48 +0100
commit93e07665861fafd42f405a154e2b54fee2219fc6 (patch)
treefcbd221832b609b8fb1c4fb8f16868a1e774bbeb
parent164e49a27eeeedca800f466b0b14a4e61a162007 (diff)
downloadlibsoup-glib-build.mk.tar.gz
Replace Makefile.glib with glib-build.mkglib-build.mk
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.glib302
-rw-r--r--configure.ac10
-rw-r--r--glib-build.mk480
-rw-r--r--libsoup/Makefile.am23
-rw-r--r--m4/glib-2.0.m4276
-rw-r--r--tests/Makefile.am7
7 files changed, 769 insertions, 331 deletions
diff --git a/Makefile.am b/Makefile.am
index 66992d93..11f2c425 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,7 @@ EXTRA_DIST = \
gtk-doc.make \
libsoup-zip.in \
m4/introspection.m4 \
- Makefile.glib
+ glib-build.mk
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
diff --git a/Makefile.glib b/Makefile.glib
deleted file mode 100644
index c28c983b..00000000
--- a/Makefile.glib
+++ /dev/null
@@ -1,302 +0,0 @@
-# -*- Mode: makefile -*-
-#
-# To use:
-#
-# In configure.ac:
-# add -Wno-portability to AM_INIT_AUTOMAKE
-# add GLIB_CONFIG([min-version[, required-modules]])
-# (remove AM_PATH_GLIB_2_0 and GLIB_GSETTINGS)
-#
-# Add to Makefile.am where your library/program is built:
-# include $(GLIB_MAKEFILE)
-#
-# BUILT_SOURCES = $(GLIB_GENERATED)
-#
-# Add *.stamp to .gitignore
-#
-# Add a GLIB_GENERATED variable with the files you want to generate,
-# as described below. (The examples below use filenames with hyphens,
-# eg foo-marshal.h, but you can omit the hyphens if that matches your
-# file naming scheme better.)
-#
-# You do not need to modify CLEANFILES or EXTRA_DIST for any of these
-# macros.
-
-
-# glib-genmarshal
-#
-# To generate signal marshallers, add files with names ending in
-# "marshal.h" and "marshal.c" to GLIB_GENERATED:
-#
-# GLIB_GENERATED += foo-marshal.h foo-marshal.c
-# foo_marshal_sources = aaa.c bbb.c ccc.c ddd.c
-#
-# Makefile.glib will then generate a foo-marshal.list file containing
-# all _foo_marshal_* functions referenced by $(foo_marshal_sources),
-# and will rebuild foo-marshal.c/foo-marshal.h whenever the list
-# changes.
-#
-# For your convenience, any .h files or $(GLIB_GENERATED) files in
-# $(foo_marshal_sources) will be ignored. This means you can usually just
-# set foo_marshal_sources to the value of your library/program's
-# _SOURCES variable, even if that variable contains foo-marshal.c.
-#
-# You can set GLIB_GENMARSHAL_H_FLAGS and GLIB_GENMARSHAL_C_FLAGS (or
-# an appropriate file-specific variable, eg
-# foo_marshal_GENMARSHAL_H_FLAGS) to set/override glib-genmarshal
-# options.
-
-
-# glib-mkenums
-#
-# To generate enum type registrations, add files with names ending
-# in "-enum-types.[ch]" or "enumtypes.[ch]" to GLIB_GENERATED:
-#
-# GLIB_GENERATED += foo-enum-types.h foo-enum-types.c
-# foo_enum_types_sources = aaa.h bbb.h ccc.h ddd.h
-#
-# Makefile.glib will create a list all of the enum/flags types
-# declared in $(foo_enum_type_sources), and will rebuild
-# foo-enum-types.c/foo-enum-types.h whenever that list changes. (No
-# template files are required.)
-#
-# For your convenience, any .c files or $(GLIB_GENERATED) files in
-# $(foo_enum_types_sources) will be ignored. This means you can
-# usually set foo_enum_types_sources to the value of your
-# library/program's _HEADERS and/or _SOURCES variables, even if that
-# contains foo-enum-types.h.
-#
-# You can set GLIB_MKENUMS_H_FLAGS and GLIB_MKENUMS_C_FLAGS (or an
-# appropriate file-specific variable, eg
-# foo_enum_types_MKENUMS_H_FLAGS) to set/override glib-mkenums
-# options. In particular, you can do:
-#
-# GLIB_MKENUMS_C_FLAGS = --fhead "\#define FOO_I_KNOW_THIS_IS_UNSTABLE"
-#
-# (The backslash is necessary to keep make from thinking the "#" is
-# the start of a comment.)
-
-
-# glib-compile-schemas
-#
-# Any foo.gschemas.xml files listed in gsettingsschema_DATA will be
-# validated before installation, and (if --disable-schemas-compile was
-# not passed) compiled after installation.
-#
-# To build an enums file, add it to GLIB_GENERATED (in addition to
-# gsettingsschema_DATA):
-#
-# GLIB_GENERATED += org.gnome.foo.enums.xml
-# org_gnome_foo_enums_xml_sources = aaa.h bbb.h ccc.h ddd.h
-#
-# All enums files will be built before any schema files are validated.
-
-
-########
-
-# Notes on Makefile.glib hacking:
-#
-# - The exact rules that automake generates for a Makefile vary
-# depending on what sorts of things were done in the Makefile.am,
-# so we have to be careful with what rules we assume are there.
-# In particular, (a) the glue to handle BUILT_SOURCES and the
-# various hooks won't be output unless those things were
-# referenced in the Makefile.am, and (b) a Makefile.am with
-# SUBDIRS will get different rules than one without.
-#
-# - Build rules should always refer to their dependencies via $^,
-# not by reusing a variable that is listed in the rule's
-# dependencies. This is needed to make srcdir!=builddir builds
-# work. You can use $(filter)/$(filter-out) if $^ has things
-# you don't want in it.
-#
-# - When using a filename as something other than a filename,
-# consider whether you need to wrap it in $(notdir) to get the
-# right result when that file is being pulled out of a
-# subdirectory.
-#
-# - All private variables should be prefixed with _glib or _GLIB
-#
-# - "make -qp > makefile.out" will give you a copy of the
-# Makefile after all macros are expanded.
-#
-# The genmarshal code is commented; the mkenums and schema code is
-# generally similar.
-
-_GLIB_CLEANFILES =
-_GLIB_DISTCLEANFILES =
-
-_GLIB_V_GEN = $(_glib_v_gen_$(V))
-_glib_v_gen_ = $(_glib_v_gen_$(AM_DEFAULT_VERBOSITY))
-_glib_v_gen_0 = @echo " GEN " $(subst .stamp,,$@);
-
-
-### glib-genmarshal
-
-# _GLIB_MARSHAL_GENERATED contains the basenames (eg, "foo-marshal")
-# of all the marshal-related files to be generated.
-_GLIB_MARSHAL_GENERATED = $(subst .h,,$(filter %marshal.h,$(GLIB_GENERATED)))
-
-# These are used as macros (with the value of $(1) inherited from the "caller")
-# _glib_marshal_prefix("foo-marshal") = "foo" (used in the C marshal names)
-# _glib_marshal_sources_var("foo-marshal") = "foo_marshal_sources"
-# _glib_marshal_sources = the filtered value of $(foo_marshal_sources)
-_glib_marshal_prefix = $(subst marshal,,$(subst _marshal,,$(subst -,_,$(notdir $(1)))))_marshal
-_glib_marshal_sources_var = $(subst -,_,$(notdir $(1)))_sources
-_glib_marshal_sources = $(filter-out %.h,$(filter-out $(GLIB_GENERATED),$($(_glib_marshal_sources_var))))
-
-# This is a multi-line macro (ending with the "endef" below) that
-# outputs a set of rules for a single .h/.c pair (whose basename is
-# $(1)). The initial $(if) line makes make error out if
-# foo_marshal_sources wasn't set. Note that single-$ variables are
-# expanded when the macro is called, and double-$ variables are
-# expanded when the rule is invoked.
-define _glib_make_genmarshal_rules
-$(if $(_glib_marshal_sources),,$(error Need to define $(_glib_marshal_sources_var) for $(1).[ch]))
-
-$(1).list.stamp: $(_glib_marshal_sources) Makefile
- $$(_GLIB_V_GEN) LC_ALL=C sed -ne 's/.*_$(_glib_marshal_prefix)_\([_A-Z]*\).*/\1/p' $$(filter-out Makefile, $$^) | sort -u | sed -e 's/__/:/' -e 's/_/,/g' > $(1).list.tmp && \
- (cmp -s $(1).list.tmp $(1).list || cp $(1).list.tmp $(1).list) && \
- rm -f $(1).list.tmp && \
- echo timestamp > $$@
-
-$(1).list: $(1).list.stamp
- @true
-
-$(1).h: $(1).list
- $$(_GLIB_V_GEN) $$(GLIB_GENMARSHAL) \
- --prefix=_$(_glib_marshal_prefix) --header \
- $$(GLIB_GENMARSHAL_H_FLAGS) \
- $$($(_glib_marshal_prefix)_GENMARSHAL_H_FLAGS) \
- $$< > $$@.tmp && \
- mv $$@.tmp $$@
-
-$(1).c: $(1).list
- $$(_GLIB_V_GEN) (echo "#include \"$$(subst .c,.h,$$(@F))\""; $$(GLIB_GENMARSHAL) \
- --prefix=_$(_glib_marshal_prefix) --body \
- $$(GLIB_GENMARSHAL_C_FLAGS) \
- $$($(_glib_marshal_prefix)_GENMARSHAL_C_FLAGS) \
- $$< ) > $$@.tmp && \
- mv $$@.tmp $$@
-
-_GLIB_CLEANFILES += $(1).list.stamp $(1).list
-_GLIB_DISTCLEANFILES += $(1).h $(1).c
-endef
-
-# Run _glib_make_genmarshal_rules for each set of generated files
-$(foreach f,$(_GLIB_MARSHAL_GENERATED),$(eval $(call _glib_make_genmarshal_rules,$f)))
-
-
-### glib-mkenums
-
-_GLIB_ENUM_TYPES_GENERATED = $(subst .h,,$(filter %enum-types.h %enumtypes.h,$(GLIB_GENERATED)))
-
-_glib_enum_types_prefix = $(subst -,_,$(notdir $(1)))
-_glib_enum_types_guard = __$(shell LC_ALL=C echo $(_glib_enum_types_prefix) | tr 'a-z' 'A-Z')_H__
-_glib_enum_types_sources_var = $(_glib_enum_types_prefix)_sources
-_glib_enum_types_sources = $(filter-out $(GLIB_GENERATED),$($(_glib_enum_types_sources_var)))
-_glib_enum_types_h_sources = $(filter %.h,$(_glib_enum_types_sources))
-
-define _glib_make_mkenums_rules
-$(if $(_glib_enum_types_sources),,$(error Need to define $(_glib_enum_types_sources_var) for $(1).[ch]))
-
-$(1).h.stamp: $(_glib_enum_types_h_sources) Makefile
- $$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
- --fhead "/* Generated by glib-mkenums. Do not edit */\n\n#ifndef $(_glib_enum_types_guard)\n#define $(_glib_enum_types_guard)\n\n" \
- $$(GLIB_MKENUMS_H_FLAGS) \
- $$($(_glib_enum_types_prefix)_MKENUMS_H_FLAGS) \
- --fhead "#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
- --vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())\n" \
- --ftail "G_END_DECLS\n\n#endif /* $(_glib_enum_types_guard) */" \
- $$(filter-out Makefile, $$^) > $(1).h.tmp && \
- (cmp -s $(1).h.tmp $(1).h || cp $(1).h.tmp $(1).h) && \
- rm -f $(1).h.tmp && \
- echo timestamp > $$@
-
-$(1).h: $(1).h.stamp
- @true
-
-$(1).c.stamp: $(_glib_enum_types_h_sources) Makefile
- $$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
- --fhead "/* Generated by glib-mkenums. Do not edit */\n\n#include \"$(notdir $(1)).h\"\n" \
- $$(GLIB_MKENUMS_C_FLAGS) \
- $$($(_glib_enum_types_prefix)_MKENUMS_C_FLAGS) \
- --fhead "$$(foreach f,$$(filter-out Makefile,$$(^F)),\n#include \"$$(f)\")\n\n" \
- --vhead "GType\n@enum_name@_get_type (void)\n{\n static volatile gsize g_define_type_id__volatile = 0;\n\n if (g_once_init_enter (&g_define_type_id__volatile))\n {\n static const G@Type@Value values[] = {\n" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },\n" \
- --vtail " { 0, NULL, NULL }\n };\n GType g_define_type_id =\n g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n }\n\n return g_define_type_id__volatile;\n}\n" \
- $$(filter-out Makefile, $$^) > $(1).c.tmp && \
- (cmp -s $(1).c.tmp $(1).c || cp $(1).c.tmp $(1).c) && \
- rm -f $(1).c.tmp && \
- echo timestamp > $$@
-
-$(1).c: $(1).c.stamp
- @true
-
-_GLIB_CLEANFILES += $(1).h.stamp $(1).c.stamp
-_GLIB_DISTCLEANFILES += $(1).h $(1).c $(1).h.stamp $(1).c.stamp
-endef
-
-$(foreach f,$(_GLIB_ENUM_TYPES_GENERATED),$(eval $(call _glib_make_mkenums_rules,$f)))
-
-
-### glib-compile-schemas
-
-_GLIB_ENUMS_XML_GENERATED = $(filter %.enums.xml,$(GLIB_GENERATED))
-_GLIB_GSETTINGS_SCHEMA_FILES = $(filter %.gschema.xml,$(gsettingsschema_DATA))
-_GLIB_GSETTINGS_VALID_FILES = $(subst .xml,.valid,$(_GLIB_GSETTINGS_SCHEMA_FILES))
-
-_glib_enums_xml_prefix = $(subst .,_,$(notdir $(1)))
-_glib_enums_xml_sources_var = $(_glib_enums_xml_prefix)_sources
-_glib_enums_xml_sources = $(filter-out $(GLIB_GENERATED),$($(_glib_enums_xml_sources_var)))
-_glib_enums_xml_namespace = $(subst .enums.xml,,$(notdir $(1)))
-
-define _glib_make_enums_xml_rule
-$(if $(_glib_enums_xml_sources),,$(error Need to define $(_glib_enums_xml_sources_var) for $(1)))
-
-$(1): $(_glib_enums_xml_sources) Makefile
- $$(_GLIB_V_GEN) $$(GLIB_MKENUMS) --comments '<!-- @comment@ -->' --fhead "<schemalist>" --vhead " <@type@ id='$(_glib_enums_xml_namespace).@EnumName@'>" --vprod " <value nick='@valuenick@' value='@valuenum@'/>" --vtail " </@type@>" --ftail "</schemalist>" $$(filter-out Makefile, $$^) > $$@.tmp && mv $$@.tmp $$@
-endef
-
-_GLIB_V_CHECK = $(_glib_v_check_$(V))
-_glib_v_check_ = $(_glib_v_check_$(AM_DEFAULT_VERBOSITY))
-_glib_v_check_0 = @echo " CHECK " $(subst .valid,.xml,$@);
-
-define _glib_make_schema_validate_rule
-$(subst .xml,.valid,$(1)): $(_GLIB_ENUMS_XML_GENERATED) $(1)
- $$(_GLIB_V_CHECK) $$(GLIB_COMPILE_SCHEMAS) --strict --dry-run $$(addprefix --schema-file=,$$^) && touch $$@
-endef
-
-define _glib_make_schema_rules
-all-am: $(_GLIB_GSETTINGS_VALID_FILES)
-
-install-data-am: glib-install-schemas-hook
-
-glib-install-schemas-hook: install-gsettingsschemaDATA
- @test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || (echo $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir))
-
-uninstall-am: glib-uninstall-schemas-hook
-
-glib-uninstall-schemas-hook: uninstall-gsettingsschemaDATA
- @test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || (echo $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir))
-
-.PHONY: glib-install-schemas-hook glib-uninstall-schemas-hook
-endef
-
-_GLIB_CLEANFILES += $(_GLIB_ENUMS_XML_GENERATED) $(_GLIB_GSETTINGS_VALID_FILES)
-
-$(foreach f,$(_GLIB_ENUMS_XML_GENERATED),$(eval $(call _glib_make_enums_xml_rule,$f)))
-$(foreach f,$(_GLIB_GSETTINGS_SCHEMA_FILES),$(eval $(call _glib_make_schema_validate_rule,$f)))
-$(if $(_GLIB_GSETTINGS_SCHEMA_FILES),$(eval $(_glib_make_schema_rules)))
-
-
-### Cleanup
-.PHONY: clean-glib distclean-glib
-
-clean-am: clean-glib
-clean-glib:
- $(if $(strip $(_GLIB_CLEANFILES)),-rm -f $(_GLIB_CLEANFILES))
-
-distclean-am: distclean-glib
-distclean-glib:
- $(if $(strip $(_GLIB_DISTCLEANFILES)),-rm -f $(_GLIB_DISTCLEANFILES))
diff --git a/configure.ac b/configure.ac
index 742e5435..e3579c8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,15 +78,7 @@ dnl ***********************
dnl *** Checks for glib ***
dnl ***********************
-GLIB_REQUIRED=2.36.0
-AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject gio)
-if test "$GLIB_LIBS" = ""; then
- AC_MSG_ERROR(GLIB $GLIB_REQUIRED or later is required to build libsoup)
-fi
-GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36"
-
-GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
-AC_SUBST(GLIB_MAKEFILE)
+GLIB_CONFIG(gobject gio, 2.36.0)
PKG_CHECK_MODULES(XML, libxml-2.0)
AC_SUBST(XML_CFLAGS)
diff --git a/glib-build.mk b/glib-build.mk
new file mode 100644
index 00000000..d0a00b91
--- /dev/null
+++ b/glib-build.mk
@@ -0,0 +1,480 @@
+# glib-build.mk contains support for using the various
+# code/data-building binaries installed by glib: glib-mkenums,
+# glib-genmarshal, glib-compile-schemas, and glib-compile-resources.
+# (It does not currently contain support for gdbus-codegen.)
+
+
+# GLIB-MKENUMS
+#
+# glib-build.mk will automatically build/update "foo-enum-types.c" and
+# "foo-enum-types.h" (or "fooenumtypes.c" and "fooenumtypes.h") as
+# needed, if there is an appropriate $(foo_enum_types_sources) /
+# $(fooenumtypes_sources) variable indicating the source files to read
+# enums from.
+#
+# For your convenience, any .c files or glib-build.mk-generated
+# sources in the _sources variable will be ignored. This means you can
+# usually just set it to the value of your library/program's _HEADERS
+# and/or _SOURCES variables, even if those variables contain
+# "foo-enum-types.h", etc.
+#
+# You can set GLIB_MKENUMS_H_FLAGS and GLIB_MKENUMS_C_FLAGS (or an
+# appropriate file-specific variable, eg
+# foo_enum_types_MKENUMS_H_FLAGS) to set/override certain glib-mkenums
+# options. In particular, you can do things like:
+#
+# GLIB_MKENUMS_C_FLAGS = --fhead "\#define FOO_ENABLE_UNSTABLE_API"
+#
+# (The backslash is necessary to keep make from thinking the "#" is
+# the start of a comment.)
+#
+# Note that enums files should not be disted (since the set of
+# available enum types may depend on configure-time options, and they
+# can always be generated at build time anyway), so the generated
+# files should be added to a "nodist_" SOURCES variable. You do not
+# need to add the generated files to BUILT_SOURCES or CLEANFILES;
+# glib-build.mk will cause them to be built and cleaned at the correct
+# times (but note that it does not actually modify BUILT_SOURCES or
+# CLEANFILES). You may want to add "foo-enum-types.h",
+# "foo-enum-types.c", "foo-enum-types.h.stamp", and
+# "foo-enum-types.c.stamp" to your .gitignore.
+
+
+# GLIB-GENMARSHAL
+#
+# NOTE: the use of explicit marshallers is somewhat deprecated.
+# Consider using g_cclosure_marshal_generic() instead.
+#
+# glib-build.mk will automatically build/update "foo-marshal.c" and
+# "foo-marshal.h" (or "foomarshal.c" and "foomarshal.h") as needed, if
+# there is an appropriate $(foo_marshal_sources) /
+# $(foomarshal_sources) variable indicating the source files to use.
+# You do not need to explicitly manage the list of marshallers;
+# glib-build.mk will automatically generate a "foo-marshal.list" file
+# containing all "_foo_marshal_*" functions referenced from
+# $(foo_marshal_sources), and will then regenerate the .c and .h files
+# whenever the list changes.
+#
+# For your convenience, any .h files or glib-build.mk-generated files
+# in the _sources variable will be ignored. This means you can usually
+# just set foo_marshal_sources to the value of your library/program's
+# _SOURCES variable, even if that variable contains "foo-marshal.c",
+# etc.
+#
+# You can set GLIB_GENMARSHAL_H_FLAGS and GLIB_GENMARSHAL_C_FLAGS (or
+# an appropriate file-specific variable, eg
+# foo_marshal_GENMARSHAL_H_FLAGS) to set/override certain
+# glib-genmarshal options.
+#
+# Note that marshal files should not be disted (since the set of
+# required marshallers may depend on configure-time options, and they
+# can always be generated at build time anyway), so the generated
+# files should be added to a "nodist_" SOURCES variable. You do not
+# need to add the generated files to BUILT_SOURCES or CLEANFILES;
+# glib-build.mk will cause them to be built and cleaned at the correct
+# times (but note that it does not actually modify BUILT_SOURCES or
+# CLEANFILES). You may want to add "foo-marshal.h", "foo-marshal.c",
+# "foo-marshal.list", and "foo-marshal.list.stamp" to your .gitignore.
+
+
+# GLIB-COMPILE-SCHEMAS
+#
+# Any foo.gschemas.xml files listed in gsettingsschema_DATA will be
+# validated before installation, and normally will be compiled after
+# installation. (If you include the GLIB_GSETTINGS rule from
+# gsettings.m4 in your configure.ac, then glib-build.mk will obey the
+# "--disable-schema-compile" flag just like the older GLIB_GSETTINGS
+# code did.)
+#
+# glib-build.mk will automatically build/update any
+# "org.foo.bar.enums.xml" files in gsettingsschema_DATA, if there is
+# an appropriate $(org_foo_bar_enums_xml_sources) variable indicating
+# the source files to use. All enums files will automatically be built
+# before any schema files are validated.
+
+
+# GLIB-COMPILE-RESOURCES
+#
+# glib-build.mk will automatically build/update "foo-resources.h"
+# and/or "foo-resources.c" (or "fooresources.h" and/or
+# "fooresources.c") as needed, if there is an appropriate
+# $(foo_resources_sources) / $(fooresources_sources) variable
+# indicating the source .gresource.xml file to use.
+#
+# If you specify both a .c and a .h file, glib-build.mk will compile
+# the resource with the --manual-register flag. If you specify only a
+# .c file, it will not.
+#
+# Alternatively, you can build a standalone "foo.gresource" file by
+# specifying $(foo_gresource_sources).
+#
+# You can set GLIB_COMPILE_RESOURCES_FLAGS (or an appropriate
+# file-specific variable, eg foo_resources_COMPILE_RESOURCES_FLAGS or
+# foo_gresource_COMPILE_RESOURCES_FLAGS) to set/override
+# glib-compile-resources options.
+#
+# Although there may be situations where you want to dist a resource
+# file and not dist its sources, glib-build.mk does not currently
+# support this; generated resource files should be added to a
+# "nodist_" SOURCES variable. glib-build.mk will ensure that the .xml
+# file and any files it includes will get disted.
+#
+# You do not need to add resource files to BUILT_SOURCES or
+# CLEANFILES; glib-build.mk will cause them to be built and cleaned at
+# the correct time (but note that it does not actually modify
+# BUILT_SOURCES or CLEANFILES). You may want to add "foo-resources.c" /
+# "foo-resources.h" / "foo.gresource" to .gitignore.
+
+
+###
+
+
+# This is like AM_V_GEN, except that it strips ".stamp" from its output
+_GLIB_V_GEN = $(_glib_v_gen_$(V))
+_glib_v_gen_ = $(_glib_v_gen_$(AM_DEFAULT_VERBOSITY))
+_glib_v_gen_0 = @echo " GEN " $(subst .stamp,,$@);
+
+# _glib_all_sources contains every file that is (directly or
+# indirectly) part of any _SOURCES variable in Makefile.am. We use
+# this to find the files we need to generate rules for. (We can't just
+# use '%' rules to build things because then the .stamp files get
+# treated as "intermediate files" by make, and then things don't
+# always get rebuilt when we need them to be.)
+#
+# Likewise, _glib_all_data contains all of the installed data files.
+# (ie, all of the "foodir_DATA" variables, but not "INSTALL_DATA" or
+# "install_sh_DATA", which are unrelated).
+#
+# ($(sort) is used here (and in many other places below) only for its
+# side effect of removing duplicates.)
+_glib_all_sources = $(sort $(foreach var,$(filter %_SOURCES,$(.VARIABLES)),$($(var))))
+_glib_all_data = $(sort $(foreach var,$(filter-out INSTALL_DATA install_sh_DATA,$(filter %_DATA,$(.VARIABLES))),$($(var))))
+
+# We can't add our generated files to BUILT_SOURCES because that would
+# create recursion with _glib_all_sources. So we implement our own
+# equivalent rules.
+_glib_built_sources =
+all: _glib-ensure-built-sources
+check: _glib-ensure-built-sources
+install: _glib-ensure-built-sources
+
+# We add dependencies to this rule in the various generators below; we
+# can't just make the rule depend on $(_glib_built_sources) because
+# that value won't have been computed yet at the point when make
+# figures out rule dependencies.
+_glib-ensure-built-sources:
+
+# We want to make "clean-am" depend on "_glib-clean". But if automake
+# sees us doing that, it will think we're trying to *override*
+# clean-am, and so it won't output the actual clean-am rule. So we
+# hide from automake by prefacing the rule with ":::", and then use
+# $(eval) to get make to apply it.
+define _glib_clean_am_hidden
+:::clean-am: _glib-clean
+endef
+$(eval $(subst :::,,$(_glib_clean_am_hidden)))
+
+_glib-clean:
+ @$(if $(strip $(_glib_clean_files)),rm -f $(sort $(_glib_clean_files)),:)
+_glib_clean_files =
+
+# OTOH, we DO want automake to see us using dist-hook, since otherwise
+# it won't generate the rules that use it.
+dist-hook: _glib-dist
+
+# We have to use $(realpath) here so that "x" and "./x" will be
+# recognized as duplicates by $(sort), since the cp will fail if given
+# the same file twice.
+_glib-dist: _glib-ensure-built-sources
+ @$(if $(strip $(_glib_dist_files)),cp -p $(sort $(realpath $(_glib_dist_files))) $(distdir)/,:)
+
+
+### GLIB-MKENUMS
+
+# These are used as macros (with the value of $(1) inherited from the
+# "caller")
+# _glib_enum_types_prefix("foo-enum-types") = "foo_enum_types"
+# _glib_enum_types_guard("foo-enum-types") = "__FOO_ENUM_TYPES_H__"
+# _glib_enum_types_sources_var("foo-enum_types") = "foo_enum_types_sources"
+# _glib_enum_types_sources = the filtered value of $(foo_enum_types_sources)
+# _glib_enum_types_h_sources = the .h files in $(_glib_enum_types_sources)
+_glib_enum_types_prefix = $(subst -,_,$(notdir $(1)))
+_glib_enum_types_guard = __$(shell LC_ALL=C echo $(_glib_enum_types_prefix) | tr 'a-z' 'A-Z')_H__
+_glib_enum_types_sources_var = $(_glib_enum_types_prefix)_sources
+_glib_enum_types_sources = $(filter-out $(_glib_built_sources) $(1).h,$($(_glib_enum_types_sources_var)))
+_glib_enum_types_h_sources = $(filter %.h,$(_glib_enum_types_sources))
+
+# _glib_all_enum_types contains the basenames (eg, "fooenumtypes",
+# "bar-enum-types") of all enum-types files known to the Makefile.
+# _glib_generated_enum_types contains only the ones being generated by
+# glib-build.mk.
+_glib_all_enum_types = $(subst .h,,$(notdir $(filter %enum-types.h %enumtypes.h,$(_glib_all_sources))))
+_glib_generated_enum_types = $(foreach f,$(_glib_all_enum_types),$(if $(strip $(call _glib_enum_types_sources,$f)),$f))
+
+# _glib_make_mkenums_rules is a multi-line macro that outputs a set of
+# rules for a single .h/.c pair (whose basename is $(1)). automake
+# doesn't recognize GNU make's define/endef syntax, so if we defined
+# the macro directly, it would try to, eg, add the literal "$(1).h" to
+# _glib_clean_files. So we hide the macro by prefixing each line with
+# ":::", as with _glib_clean_am_hidden above.
+
+# We have to include "Makefile" in the dependencies so that the
+# outputs get regenerated when you remove files from
+# foo_enum_types_sources. (This is especially important for
+# foo-enum-types.h, which might otherwise try to #include files that
+# no longer exist.).
+
+# Several of the variables/macros in the rule use double $$, so they
+# get expanded when *running* the rule rather than when *generating*
+# it, because they use _glib_built_sources, which won't be up-to-date
+# when the rule is initially generated
+
+define _glib_make_mkenums_rules_hidden
+:::$(1).h.stamp: $$(call _glib_enum_types_h_sources,$(1)) Makefile
+::: $$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
+::: --fhead "/* Generated by glib-mkenums. Do not edit */\n\n" \
+::: --fhead "#ifndef $(_glib_enum_types_guard)\n" \
+::: --fhead "#define $(_glib_enum_types_guard)\n\n" \
+::: $$(GLIB_MKENUMS_H_FLAGS) \
+::: $$($(_glib_enum_types_prefix)_MKENUMS_H_FLAGS) \
+::: --fhead "#include <glib-object.h>\n\n" \
+::: --fhead "G_BEGIN_DECLS\n" \
+::: --vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n" \
+::: --vhead "#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())\n\n" \
+::: --ftail "G_END_DECLS\n\n#endif /* $(_glib_enum_types_guard) */" \
+::: $$(filter-out Makefile, $$^) > $(1).h.tmp && \
+::: (cmp -s $(1).h.tmp $(1).h || cp $(1).h.tmp $(1).h) && \
+::: rm -f $(1).h.tmp && \
+::: echo timestamp > $$@
+:::
+:::$(1).h: $(1).h.stamp
+::: @true
+:::
+:::$(1).c.stamp: $$(call _glib_enum_types_h_sources,$(1)) Makefile
+::: $$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
+::: --fhead "/* Generated by glib-mkenums. Do not edit */\n\n" \
+::: --fhead "#ifdef HAVE_CONFIG_H\n" \
+::: --fhead "#include \"config.h\"\n" \
+::: --fhead "#endif\n\n" \
+::: --fhead "#include \"$(notdir $(1)).h\"\n" \
+::: $$(GLIB_MKENUMS_C_FLAGS) \
+::: $$($(_glib_enum_types_prefix)_MKENUMS_C_FLAGS) \
+::: --fhead "$$(foreach f,$$(filter-out Makefile,$$(^F)),\n#include \"$$(f)\")\n\n" \
+::: --vhead "GType\n" \
+::: --vhead "@enum_name@_get_type (void)\n" \
+::: --vhead "{\n" \
+::: --vhead " static volatile gsize g_define_type_id__volatile = 0;\n\n" \
+::: --vhead " if (g_once_init_enter (&g_define_type_id__volatile))\n" \
+::: --vhead " {\n" \
+::: --vhead " static const G@Type@Value values[] = {\n" \
+::: --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },\n" \
+::: --vtail " { 0, NULL, NULL }\n" \
+::: --vtail " };\n" \
+::: --vtail " GType g_define_type_id =\n" \
+::: --vtail " g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n" \
+::: --vtail " g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n" \
+::: --vtail " }\n\n" \
+::: --vtail " return g_define_type_id__volatile;\n" \
+::: --vtail "}\n\n" \
+::: $$(filter-out Makefile, $$^) > $(1).c.tmp && \
+::: (cmp -s $(1).c.tmp $(1).c || cp $(1).c.tmp $(1).c) && \
+::: rm -f $(1).c.tmp && \
+::: echo timestamp > $$@
+:::
+:::$(1).c: $(1).c.stamp
+::: @true
+:::
+:::_glib_clean_files += $(1).c $(1).h $(1).c.stamp $(1).h.stamp
+:::_glib_built_sources += $(1).c $(1).h
+:::_glib-ensure-built-sources: $(1).c $(1).h
+endef
+_glib_make_mkenums_rules = $(subst :::,,$(_glib_make_mkenums_rules_hidden))
+
+# Run _glib_make_mkenums_rules for each set of generated files
+$(foreach f,$(_glib_generated_enum_types),$(eval $(call _glib_make_mkenums_rules,$f)))
+
+
+### GLIB-GENMARSHAL
+# see the comments in the glib-mkenums section for details of how this all works
+
+_glib_marshal_file_prefix = $(subst -,_,$(notdir $(1)))
+_glib_marshal_symbol_prefix = $(subst marshal,,$(subst _marshal,,$(subst -,_,$(notdir $(1)))))_marshal
+_glib_marshal_sources_var = $(_glib_marshal_file_prefix)_sources
+_glib_marshal_sources = $(filter-out $(_glib_built_sources) $(1).c,$($(_glib_marshal_sources_var)))
+_glib_marshal_c_sources = $(filter %.c,$(_glib_marshal_sources))
+
+_glib_all_marshal = $(subst .h,,$(notdir $(filter %marshal.h,$(_glib_all_sources))))
+_glib_generated_marshal = $(foreach f,$(_glib_all_marshal),$(if $(strip $(call _glib_marshal_sources,$f)),$f))
+
+define _glib_make_genmarshal_rules_hidden
+:::$(1).list.stamp: $$(call _glib_marshal_c_sources,$(1)) Makefile
+::: $$(_GLIB_V_GEN) LC_ALL=C sed -ne 's/.*_$(_glib_marshal_symbol_prefix)_\([_A-Z]*\).*/\1/p' $$(filter-out Makefile, $$^) | sort -u | sed -e 's/__/:/' -e 's/_/,/g' > $(1).list.tmp && \
+::: (cmp -s $(1).list.tmp $(1).list || cp $(1).list.tmp $(1).list) && \
+::: rm -f $(1).list.tmp && \
+::: echo timestamp > $$@
+:::
+:::$(1).list: $(1).list.stamp
+::: @true
+:::
+:::$(1).h: $(1).list
+::: $$(_GLIB_V_GEN) $$(GLIB_GENMARSHAL) \
+::: --prefix=_$(_glib_marshal_symbol_prefix) --header \
+::: $$(GLIB_GENMARSHAL_H_FLAGS) \
+::: $$($(_glib_marshal_symbol_prefix)_GENMARSHAL_H_FLAGS) \
+::: $$< > $$@.tmp && \
+::: mv $$@.tmp $$@
+:::
+:::$(1).c: $(1).list
+::: $$(_GLIB_V_GEN) (echo "#include \"$$(subst .c,.h,$$(@F))\""; $$(GLIB_GENMARSHAL) \
+::: --prefix=_$(_glib_marshal_symbol_prefix) --body \
+::: $$(GLIB_GENMARSHAL_C_FLAGS) \
+::: $$($(_glib_marshal_symbol_prefix)_GENMARSHAL_C_FLAGS) \
+::: $$< ) > $$@.tmp && \
+::: mv $$@.tmp $$@
+:::
+:::_glib_clean_files += $(1).c $(1).h $(1).list $(1).list.stamp
+:::_glib_built_sources += $(1).c $(1).h
+:::_glib-ensure-built-sources: $(1).c $(1).h
+endef
+_glib_make_genmarshal_rules = $(subst :::,,$(_glib_make_genmarshal_rules_hidden))
+
+$(foreach f,$(_glib_generated_marshal),$(eval $(call _glib_make_genmarshal_rules,$f)))
+
+
+# GLIB-COMPILE-SCHEMAS
+# see the comments in the glib-mkenums section for details of how this all works
+
+_GLIB_ENUMS_XML_GENERATED = $(filter %.enums.xml,$(gsettingsschema_DATA))
+_GLIB_GSETTINGS_SCHEMA_FILES = $(filter %.gschema.xml,$(gsettingsschema_DATA))
+_GLIB_GSETTINGS_VALID_FILES = $(subst .xml,.valid,$(_GLIB_GSETTINGS_SCHEMA_FILES))
+
+_glib_enums_xml_prefix = $(subst .,_,$(notdir $(1)))
+_glib_enums_xml_sources_var = $(_glib_enums_xml_prefix)_sources
+_glib_enums_xml_sources = $(filter-out $(_glib_built_sources),$($(_glib_enums_xml_sources_var)))
+_glib_enums_xml_namespace = $(subst .enums.xml,,$(notdir $(1)))
+
+define _glib_make_enums_xml_rule_hidden
+:::$(1): $(_glib_enums_xml_sources) Makefile
+::: $$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
+::: --comments '<!-- @comment@ -->' \
+::: --fhead "<schemalist>" \
+::: --vhead " <@type@ id='$(_glib_enums_xml_namespace).@EnumName@'>" \
+::: --vprod " <value nick='@valuenick@' value='@valuenum@'/>" \
+::: --vtail " </@type@>" \
+::: --ftail "</schemalist>" \
+::: $$(filter-out Makefile, $$^) > $$@.tmp && \
+::: mv $$@.tmp $$@
+endef
+_glib_make_enums_xml_rule = $(subst :::,,$(_glib_make_enums_xml_rule_hidden))
+
+_GLIB_V_CHECK = $(_glib_v_check_$(V))
+_glib_v_check_ = $(_glib_v_check_$(AM_DEFAULT_VERBOSITY))
+_glib_v_check_0 = @echo " CHECK " $(subst .valid,.xml,$@);
+
+define _glib_make_schema_validate_rule_hidden
+:::$(subst .xml,.valid,$(1)): $(_GLIB_ENUMS_XML_GENERATED) $(1)
+::: $$(_GLIB_V_CHECK) $$(GLIB_COMPILE_SCHEMAS) --strict --dry-run $$(addprefix --schema-file=,$$^) && touch $$@
+endef
+_glib_make_schema_validate_rule = $(subst :::,,$(_glib_make_schema_validate_rule_hidden))
+
+define _glib_make_schema_rules_hidden
+:::all-am: $(_GLIB_GSETTINGS_VALID_FILES)
+:::
+:::install-data-am: glib-install-schemas-hook
+:::
+:::glib-install-schemas-hook: install-gsettingsschemaDATA
+::: @test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || (echo $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir))
+:::
+:::uninstall-am: glib-uninstall-schemas-hook
+:::
+:::glib-uninstall-schemas-hook: uninstall-gsettingsschemaDATA
+::: @test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || (echo $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir))
+:::
+:::.PHONY: glib-install-schemas-hook glib-uninstall-schemas-hook
+endef
+_glib_make_schema_rules = $(subst :::,,$(_glib_make_schema_rules_hidden))
+
+_glib_clean_files += $(_GLIB_ENUMS_XML_GENERATED) $(_GLIB_GSETTINGS_VALID_FILES)
+
+$(foreach f,$(_GLIB_ENUMS_XML_GENERATED),$(eval $(call _glib_make_enums_xml_rule,$f)))
+$(foreach f,$(_GLIB_GSETTINGS_SCHEMA_FILES),$(eval $(call _glib_make_schema_validate_rule,$f)))
+$(if $(_GLIB_GSETTINGS_SCHEMA_FILES),$(eval $(_glib_make_schema_rules)))
+
+
+### GLIB-COMPILE-RESOURCES
+# see the comments in the glib-mkenums section for details of how this all works
+
+_glib_resources_c_file_prefix = $(subst -,_,$(notdir $(1)))
+_glib_resources_c_symbol_prefix = $(subst resources,,$(subst _resources,,$(subst -,_,$(notdir $(1)))))
+_glib_resources_c_sources_var = $(_glib_resources_c_file_prefix)_sources
+_glib_resources_c_sources = $($(_glib_resources_c_sources_var))
+_glib_resources_c_deps = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/$(_glib_resources_c_sources))
+
+_glib_all_ch_resources = $(subst .h,,$(notdir $(filter %resources.h,$(_glib_all_sources))))
+_glib_generated_ch_resources = $(foreach f,$(_glib_all_ch_resources),$(if $(strip $(call _glib_resources_c_sources,$f)),$f))
+
+_glib_all_c_resources = $(filter-out $(_glib_all_ch_resources),$(subst .c,,$(notdir $(filter %resources.c,$(_glib_all_sources)))))
+_glib_generated_c_resources = $(foreach f,$(_glib_all_c_resources),$(if $(strip $(call _glib_resources_c_sources,$f)),$f))
+
+define _glib_make_h_resources_rules_hidden
+:::$(1).h: $(_glib_resources_c_sources) $(_glib_resources_c_deps)
+::: $$(_GLIB_V_GEN) $$(GLIB_COMPILE_RESOURCES) \
+::: --target=$$@ --sourcedir="$(srcdir)" \
+::: --generate-header $(2) \
+::: --c-name $(_glib_resources_c_symbol_prefix) \
+::: $$(GLIB_COMPILE_RESOURCES_FLAGS) \
+::: $$($(_glib_resources_c_file_prefix)_COMPILE_RESOURCES_FLAGS) \
+::: $$<
+:::
+:::_glib_clean_files += $(1).h
+:::_glib_built_sources += $(1).h
+:::_glib-ensure-built-sources: $(1).h
+endef
+_glib_make_h_resources_rules = $(subst :::,,$(_glib_make_h_resources_rules_hidden))
+
+define _glib_make_c_resources_rules_hidden
+:::$(1).c: $(_glib_resources_c_sources) $(_glib_resources_c_deps)
+::: $$(_GLIB_V_GEN) $$(GLIB_COMPILE_RESOURCES) \
+::: --target=$$@ --sourcedir="$(srcdir)" \
+::: --generate-source $(2) \
+::: --c-name $(_glib_resources_c_symbol_prefix) \
+::: $$(GLIB_COMPILE_RESOURCES_FLAGS) \
+::: $$($(_glib_resources_c_file_prefix)_COMPILE_RESOURCES_FLAGS) \
+::: $$<
+:::
+:::_glib_dist_files += $(_glib_resources_c_sources) $(_glib_resources_c_deps)
+:::_glib_clean_files += $(1).c
+:::_glib_built_sources += $(1).c
+:::_glib-ensure-built-sources: $(1).c
+endef
+_glib_make_c_resources_rules = $(subst :::,,$(_glib_make_c_resources_rules_hidden))
+
+$(foreach f,$(_glib_generated_ch_resources),$(eval $(call _glib_make_h_resources_rules,$f,--manual-register)))
+$(foreach f,$(_glib_generated_ch_resources),$(eval $(call _glib_make_c_resources_rules,$f,--manual-register)))
+$(foreach f,$(_glib_generated_c_resources),$(eval $(call _glib_make_c_resources_rules,$f,)))
+
+
+_glib_resources_standalone_prefix = $(subst -,_,$(notdir $(1)))_gresource
+_glib_resources_standalone_sources_var = $(_glib_resources_standalone_prefix)_sources
+_glib_resources_standalone_sources = $($(_glib_resources_standalone_sources_var))
+_glib_resources_standalone_deps = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/$(_glib_resources_standalone_sources))
+
+_glib_all_standalone_resources = $(subst .gresource,,$(notdir $(filter %.gresource,$(_glib_all_data))))
+_glib_generated_standalone_resources = $(foreach f,$(_glib_all_standalone_resources),$(if $(strip $(call _glib_resources_standalone_sources,$f)),$f))
+
+define _glib_make_standalone_resources_rules_hidden
+:::$(1).gresource: $(_glib_resources_standalone_sources) $(_glib_resources_standalone_deps)
+::: $$(_GLIB_V_GEN) $$(GLIB_COMPILE_RESOURCES) \
+::: --target=$$@ --sourcedir="$(srcdir)" \
+::: $$(GLIB_COMPILE_RESOURCES_FLAGS) \
+::: $$($(_glib_resources_standalone_prefix)_COMPILE_RESOURCES_FLAGS) \
+::: $$<
+:::
+:::_glib_dist_files += $(_glib_resources_standalone_sources) $(_glib_resources_standalone_deps)
+:::_glib_clean_files += $(1).gresource
+:::_glib_built_sources += $(1).gresource
+:::_glib-ensure-built-sources: $(1).gresource
+endef
+_glib_make_standalone_resources_rules = $(subst :::,,$(_glib_make_standalone_resources_rules_hidden))
+
+$(foreach f,$(_glib_generated_standalone_resources),$(eval $(call _glib_make_standalone_resources_rules,$f)))
diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am
index 60920bdc..9a008ef6 100644
--- a/libsoup/Makefile.am
+++ b/libsoup/Makefile.am
@@ -1,8 +1,4 @@
-## Process this file with automake to produce Makefile.in
-
-EXTRA_DIST =
-
-include $(GLIB_MAKEFILE)
+include $(top_srcdir)/glib-build.mk
if OS_WIN32
LIBWS2_32 = -lws2_32
@@ -20,7 +16,7 @@ AM_CPPFLAGS = \
libsoupincludedir = $(includedir)/libsoup-2.4/libsoup
-soup_headers = \
+libsoupinclude_HEADERS = \
soup.h \
soup-address.h \
soup-auth.h \
@@ -69,11 +65,8 @@ soup_headers = \
soup-value-utils.h \
soup-xmlrpc.h
-libsoupinclude_HEADERS = \
- $(soup_headers) \
- soup-enum-types.h
-
nodist_libsoupinclude_HEADERS = \
+ soup-enum-types.h \
soup-version.h
lib_LTLIBRARIES = libsoup-2.4.la
@@ -83,7 +76,7 @@ libsoup_2_4_la_LDFLAGS = \
-no-undefined \
-export-symbols $(srcdir)/libsoup-2.4.sym
-EXTRA_DIST += libsoup-2.4.sym
+EXTRA_DIST = libsoup-2.4.sym
libsoup_2_4_la_LIBADD = \
$(GLIB_LIBS) \
@@ -133,8 +126,6 @@ libsoup_2_4_la_SOURCES = \
soup-date.c \
soup-directory-input-stream.h \
soup-directory-input-stream.c \
- soup-enum-types.h \
- soup-enum-types.c \
soup-filter-input-stream.c \
soup-filter-input-stream.h \
soup-form.c \
@@ -184,6 +175,10 @@ libsoup_2_4_la_SOURCES = \
soup-version.c \
soup-xmlrpc.c
+nodist_libsoup_2_4_la_SOURCES = \
+ soup-enum-types.c \
+ soup-enum-types.h
+
# TLD rules
EXTRA_DIST += tld-parser.py
@@ -224,9 +219,7 @@ libsoup_gnome_2_4_la_SOURCES = \
endif
-GLIB_GENERATED = soup-enum-types.c soup-enum-types.h
BUILT_SOURCES = \
- $(GLIB_GENERATED) \
tld_data.inc
soup_enum_types_sources = $(libsoupinclude_HEADERS) $(libsoupgnomeinclude_HEADERS)
diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4
new file mode 100644
index 00000000..47bbcd66
--- /dev/null
+++ b/m4/glib-2.0.m4
@@ -0,0 +1,276 @@
+# Configure paths for GLIB
+# Owen Taylor 1997-2001
+
+# GLIB_CONFIG([MODULES, [MINIMUM-VERSION, [MAXIMUM-VERSION]]])
+
+# Test for GLib, erroring out if it is not found. If gmodule, gobject,
+# gthread, or gio is specified in MODULES, it will be passed to
+# pkg-config. If MINIMUM-VERSION is specified, then it will require
+# at least that version of GLib, and it will define
+# GLIB_VERSION_MIN_REQUIRED so as to generate deprecation warnings
+# for older functions. If MAXIMUM-VERSION is specified, it will
+# define GLIB_VERSION_MAX_ALLOWED (but it does not actually error
+# out if the found GLib version is larger than that).
+#
+# Defines GLIB_CFLAGS, GLIB_LIBS, GLIB_MKENUMS, GLIB_GENMARSHAL,
+# GOBJECT_QUERY, GLIB_COMPILE_RESOURCES, and GLIB_COMPILE_SCHEMAS.
+#
+# Adds --disable-glibtest and --disable-schemas-compile configure
+# flags.
+AC_DEFUN([GLIB_CONFIG],[
+ _GLIB_CONFIG_INTERNAL($2,,[
+ if test "$GLIB_LIBS" = ""; then
+ if test -n "$2"; then
+ AC_MSG_ERROR(GLib $2 or later is required)
+ else
+ AC_MSG_ERROR(GLib is required)
+ fi
+ fi
+ ],$1)
+
+ _GLIB_CONFIG_SCHEMAS
+
+ if test -n "$2"; then
+ ver=`echo $2 | sed -e 's/\./_/' -e 's/\..*//'`
+ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_$ver"
+ fi
+ if test -n "$3"; then
+ ver=`echo $3 | sed -e 's/\./_/' -e 's/\..*//'`
+ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_$ver"
+ fi
+])
+
+dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+AC_DEFUN([AM_PATH_GLIB_2_0], [
+m4_warn([obsolete],[AM_PATH_GLIB_2_0 is deprecated; use GLIB_CONFIG])
+_GLIB_CONFIG_INTERNAL($1,$2,$3,$4)
+])
+
+dnl _GLIB_CONFIG_INTERNAL: same args as AM_PATH_GLIB_2_0
+AC_DEFUN([_GLIB_CONFIG_INTERNAL], [
+ AC_ARG_ENABLE(glibtest, AS_HELP_STRING([--disable-glibtest],[do not try to compile and run a test GLIB program]),,enable_glibtest=yes)
+
+ pkg_config_args=glib-2.0
+ for module in . $4
+ do
+ case "$module" in
+ gmodule)
+ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gmodule-no-export)
+ pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
+ ;;
+ gobject)
+ pkg_config_args="$pkg_config_args gobject-2.0"
+ ;;
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ gio*)
+ pkg_config_args="$pkg_config_args $module-2.0"
+ ;;
+ esac
+ done
+
+ PKG_PROG_PKG_CONFIG([0.16])
+
+ no_glib=""
+
+ if test "x$PKG_CONFIG" = x ; then
+ no_glib=yes
+ PKG_CONFIG=no
+ fi
+
+ min_glib_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GLib - version >= $min_glib_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+ enable_glibtest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+ :
+ else
+ no_glib=yes
+ fi
+ fi
+
+ if test x"$no_glib" = x ; then
+ if test "$cross_compiling" != yes; then
+ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+ GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
+ else
+ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+ AC_PATH_PROG(GOBJECT_QUERY, gobject-query)
+ AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
+ AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
+ fi
+
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_glibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+ rm -f conf.glibtest
+ AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ unsigned int major, minor, micro;
+
+ fclose (fopen ("conf.glibtest", "w"));
+
+ if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_glib_version");
+ exit(1);
+ }
+
+ if ((glib_major_version != $glib_config_major_version) ||
+ (glib_minor_version != $glib_config_minor_version) ||
+ (glib_micro_version != $glib_config_micro_version))
+ {
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+ (glib_minor_version != GLIB_MINOR_VERSION) ||
+ (glib_micro_version != GLIB_MICRO_VERSION))
+ {
+ printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+ GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ }
+ else
+ {
+ if ((glib_major_version > major) ||
+ ((glib_major_version == major) && (glib_minor_version > minor)) ||
+ ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
+ major, minor, micro);
+ printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_glib" = x ; then
+ AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ else
+ if test -f conf.glibtest ; then
+ :
+ else
+ echo "*** Could not run GLIB test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$LIBS $GLIB_LIBS"
+ AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+ echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GLIB_CFLAGS=""
+ GLIB_LIBS=""
+ GLIB_GENMARSHAL=""
+ GOBJECT_QUERY=""
+ GLIB_MKENUMS=""
+ GLIB_COMPILE_RESOURCES=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+ AC_SUBST(GLIB_GENMARSHAL)
+ AC_SUBST(GOBJECT_QUERY)
+ AC_SUBST(GLIB_MKENUMS)
+ AC_SUBST(GLIB_COMPILE_RESOURCES)
+ rm -f conf.glibtest
+])
+
+AC_DEFUN([_GLIB_CONFIG_SCHEMAS],
+[
+ AC_ARG_ENABLE(schemas-compile,
+ AS_HELP_STRING([--disable-schemas-compile],
+ [Disable regeneration of gschemas.compiled on install]),
+ [case ${enableval} in
+ yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
+ no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
+ esac])
+ AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
+ AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
+ if test "$cross_compiling" != yes; then
+ GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
+ else
+ AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
+ fi
+ AC_SUBST(GLIB_COMPILE_SCHEMAS)
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 22c4a851..0f572197 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/glib-build.mk
+
AM_CPPFLAGS = \
-I$(top_srcdir) \
-DSRCDIR=\""$(abs_srcdir)"\" \
@@ -47,6 +49,7 @@ noinst_PROGRAMS = \
$(TESTS)
noinst_DATA = soup-tests.gresource
+soup_tests_gresource_sources = soup-tests.gresource.xml
noinst_LTLIBRARIES = libtest.la
@@ -75,9 +78,6 @@ httpd.conf: $(httpd_conf_in)
BUILT_SOURCES = httpd.conf
endif
-soup-tests.gresource: soup-tests.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/soup-tests.gresource.xml)
- $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $<
-
RESOURCES = \
resources/atom.xml \
resources/home.gif \
@@ -96,7 +96,6 @@ EXTRA_DIST = \
htpasswd \
httpd.conf.22.in \
httpd.conf.24.in \
- index.txt \
libsoup.supp \
soup-tests.gresource.xml \
test-cert.pem \