[libsoupmm] Substitute API version into Automake variable name, Add example, ...



commit bf93c20eadf2a0e0a4b03d5263617780fa199ad3
Author: Siavash Safi <siavash siavashs org>
Date:   Thu Aug 27 18:45:18 2009 +0430

    Substitute API version into Automake variable name, Add example, ...
    
    * .gitignore:
    * Makefile.am: (nodist_libsoupmm_libinclude_HEADERS): Install the
      configuration header file.
    * configure.ac: (AC_CONFIG_HEADERS): Add libsoup/libsoupmmconfig.h.
      (AM_INIT_AUTOMAKE): Lower version requirement to Automake 1.9.
      (MM_PREREQ): Raise version requirement to mm-common 0.6.1.
    * doc/reference/Doxyfile.in: (STRIP_FROM_PATH), (STRIP_FROM_INC_PATH):
      Add the project's top build directory and top source directory to
      the list of prefixes to strip from filenames, just in case some odd
      file is being referenced from somewhere.
      (ALIASES): Rename the @since alias back to its old name @newin,
      but otherwise keep the parameters.
      (COLLABORATION_GRAPH): Set option to YES to enable the per-class
      inheritance graphs.
      (PREDEFINED): Remove GTKMM_ATKMM_ENABLED from the list of predefined
      macros, since libsoupmm does not depend on gtkmm.
    * examples/Makefile.am:
    * examples/dns/main.cc: Port the dns resolver example from C API
    * libsoup/libsoupmm.pc.in: Renamed from libsoup/libsoupmm-2.4.pc.in
    * libsoup/libsoupmm-uninstalled.pc.in: Rename from
      libsoupmm-2.4-uninstalled.pc.in
    * libsoup/libsoupmm.h:
    * libsoup/libsoupmm/Makefile.am:(lib_LTLIBRARIES): Substitute
      @LIBSOUPMM_API_VERSION@ into the libtool archive filename. Rename
      the _SOURCES, _LDFLAGS and _LIBADD variables accordingly.
    * libsoup/libsoupmmconfig.h.in: New header template.

 .gitignore                                         |    1 +
 Makefile.am                                        |   12 ++--
 configure.ac                                       |   19 +++---
 doc/reference/Doxyfile.in                          |   16 +++---
 examples/Makefile.am                               |   35 +++++++++++
 examples/dns/main.cc                               |   60 ++++++++++++++++++++
 ...installed.pc.in => libsoupmm-uninstalled.pc.in} |    0
 libsoup/libsoupmm.h                                |    6 +--
 libsoup/{libsoupmm-2.4.pc.in => libsoupmm.pc.in}   |    0
 libsoup/libsoupmm/Makefile.am                      |   12 ++--
 libsoup/libsoupmmconfig.h.in                       |   10 +++
 11 files changed, 138 insertions(+), 33 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d80f60b..d9598e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 .libs
 Makefile
 Makefile.in
+stamp-h?
 *.[ao]
 *.l[ao]
 /INSTALL
diff --git a/Makefile.am b/Makefile.am
index 3665df9..16084e0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,14 +28,14 @@ doc_subdirs = doc
 else
 doc_subdirs =
 endif
-SUBDIRS = $(src_subdirs) libsoup/libsoupmm $(doc_subdirs)
+SUBDIRS = $(src_subdirs) libsoup/libsoupmm examples $(doc_subdirs)
 
-libsoupmm_includedir = $(includedir)/$(LIBSOUPMM_MODULE_NAME)
-libsoupmm_include_HEADERS = libsoup/libsoupmm.h
-
-dist_noinst_SCRIPTS = autogen.sh
+libsoupmm_libincludedir = $(libdir)/$(LIBSOUPMM_MODULE_NAME)/include
+nodist_libsoupmm_libinclude_HEADERS = libsoup/libsoupmmconfig.h
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libsoup/libsoupmm-2.4.pc
+pkgconfig_DATA = libsoup/$(LIBSOUPMM_MODULE_NAME).pc
+
+dist_noinst_SCRIPTS = autogen.sh
 
 include $(top_srcdir)/build/dist-changelog.am
diff --git a/configure.ac b/configure.ac
index e4f009f..cf11473 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,22 +21,22 @@ AC_PREREQ([2.62])
 AC_CONFIG_SRCDIR([libsoup/libsoupmm.h])
 AC_CONFIG_AUX_DIR([build])
 AC_CONFIG_MACRO_DIR([build])
-AC_CONFIG_HEADERS([build/config.h])
+AC_CONFIG_HEADERS([build/config.h libsoup/libsoupmmconfig.h])
 
-# The ustar format supports longer filenames
-AM_INIT_AUTOMAKE([1.10 -Wno-portability check-news no-define nostdinc tar-pax])
+AM_INIT_AUTOMAKE([1.9 -Wno-portability check-news no-define nostdinc tar-pax])
 AM_MAINTAINER_MODE
 AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
 
-MM_INIT_MODULE([libsoupmm-2.4], m4_expand([AC_PACKAGE_VERSION]))
+MM_PREREQ([0.6.1])
+MM_INIT_MODULE([libsoupmm-2.4])
 
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
 AC_SUBST([LIBSOUPMM_SO_VERSION], [0:0:0])
 
 AC_PROG_CXX
-
-LT_PREREQ([2.2.0])
-LT_INIT([disable-static win32-dll])
+AC_DISABLE_STATIC
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
 
 AC_SUBST([LIBSOUPMM_MODULES], ['libsoup-2.4 >= 2.26 glibmm-2.4 >= 2.21 giomm-2.4 >= 2.21'])
 PKG_CHECK_MODULES([LIBSOUPMM], [$LIBSOUPMM_MODULES])
@@ -57,10 +57,11 @@ MM_ARG_ENABLE_WARNINGS([LIBSOUPMM_WXXFLAGS],
 
 AC_CONFIG_FILES([Makefile
                  codegen/Makefile
-                 libsoup/libsoupmm-2.4.pc
-                 libsoup/libsoupmm-2.4-uninstalled.pc
+                 libsoup/${LIBSOUPMM_MODULE_NAME}.pc:libsoup/libsoupmm.pc.in
+                 libsoup/${LIBSOUPMM_MODULE_NAME}-uninstalled.pc:libsoup/libsoupmm-uninstalled.pc.in
                  libsoup/src/Makefile
                  libsoup/libsoupmm/Makefile
+                 examples/Makefile
                  doc/Makefile
                  doc/reference/Doxyfile])
 AC_OUTPUT
diff --git a/doc/reference/Doxyfile.in b/doc/reference/Doxyfile.in
index 06c6907..c5fd216 100644
--- a/doc/reference/Doxyfile.in
+++ b/doc/reference/Doxyfile.in
@@ -18,19 +18,20 @@ INLINE_INHERITED_MEMB  = NO
 FULL_PATH_NAMES        = YES
 STRIP_FROM_PATH        = "@abs_top_builddir@/libsoup/" \
                          "@abs_top_srcdir@/libsoup/" \
+                         "@abs_top_builddir@/" \
+                         "@abs_top_srcdir@/"
 STRIP_FROM_INC_PATH    = "@abs_top_builddir@/libsoup/" \
                          "@abs_top_srcdir@/libsoup/"
+                         "@abs_top_builddir@/" \
+                         "@abs_top_srcdir@/"
 SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = NO
+JAVADOC_AUTOBRIEF      = YES
 QT_AUTOBRIEF           = NO
 MULTILINE_CPP_IS_BRIEF = NO
 INHERIT_DOCS           = YES
 SEPARATE_MEMBER_PAGES  = NO
 TAB_SIZE               = 8
-ALIASES                = "newin2p4=" \
-                         "newin2p8=" \
-                         "newin2p14=" \
-                         "newin2p22="
+ALIASES                = "newin{2}=\xrefitem since_\1_\2 \"Since @PACKAGE_NAME@ \1.\2\" \"New API in @PACKAGE_NAME@ \1.\2\""
 OPTIMIZE_OUTPUT_FOR_C  = NO
 OPTIMIZE_OUTPUT_JAVA   = NO
 OPTIMIZE_FOR_FORTRAN   = NO
@@ -232,8 +233,7 @@ PREDEFINED             = __cplusplus \
                          GLIBMM_VFUNCS_ENABLED \
                          GLIBMM_PROPERTIES_ENABLED \
                          GLIBMM_EXCEPTIONS_ENABLED \
-                         GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED \
-                         GTKMM_ATKMM_ENABLED
+                         GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 EXPAND_AS_DEFINED      = LIBSOUPMM_MAJOR_VERSION \
                          LIBSOUPMM_MINOR_VERSION \
                          LIBSOUPMM_MICRO_VERSION
@@ -257,7 +257,7 @@ DOT_FONTNAME           = FreeSans
 DOT_FONTSIZE           = 10
 DOT_FONTPATH           =
 CLASS_GRAPH            = YES
-COLLABORATION_GRAPH    = NO
+COLLABORATION_GRAPH    = YES
 GROUP_GRAPHS           = YES
 UML_LOOK               = NO
 TEMPLATE_RELATIONS     = YES
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..8b6b7f8
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,35 @@
+## Copyright (c) 2009  Siavash Safi  <siavashs siavashs org>
+##
+## This file is part of libsoupmm.
+##
+## libsoupmm is free software: you can redistribute it and/or modify it
+## under the terms of the GNU Lesser General Public License as published
+## by the Free Software Foundation, either version 2.1 of the License,
+## or (at your option) any later version.
+##
+## libsoupmm is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this library.  If not, see <http://www.gnu.org/licenses/>.
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+check_PROGRAMS =			\
+	dns/example
+
+libsoupmm_includes = -I$(top_builddir)/libsoup $(if $(srcdir:.=),-I$(top_srcdir)/libsoup)
+local_cppflags  = -I$(top_builddir) $(libsoupmm_includes)
+
+AM_CPPFLAGS = $(local_cppflags) $(LIBSOUPMM_CFLAGS) $(GTHREAD_CFLAGS)
+AM_CXXFLAGS = $(LIBSOUPMM_WXXFLAGS)
+
+local_libsoupmm = $(top_builddir)/libsoup/libsoupmm/libsoupmm-$(LIBSOUPMM_API_VERSION).la
+
+LDADD        = $(LIBSOUPMM_LIBS) $(local_libsoupmm)
+
+dns_example_SOURCES =	\
+	dns/main.cc
+
diff --git a/examples/dns/main.cc b/examples/dns/main.cc
new file mode 100644
index 0000000..00af9f1
--- /dev/null
+++ b/examples/dns/main.cc
@@ -0,0 +1,60 @@
+#include <iostream>
+#include <stdlib.h>
+
+#include <libsoupmm.h>
+
+Glib::RefPtr<Glib::MainLoop> loop(0);
+static int nlookups = 0;
+
+void resolve_callback(guint status, const Glib::RefPtr<Soup::Address>& address)
+{
+  if (status == Soup::STATUS_OK)
+  {
+    std::cout << "Name:    " << address->get_name() << std::endl;
+    std::cout << "Address: " << address->get_physical() << std::endl;
+  }
+  else
+  {
+    std::cout << "Name:    " << address->get_name() << std::endl;
+    std::cout << "Error:   " << Soup::status_get_phrase(status) << std::endl;
+  }
+	std::cout << std::endl;
+
+	nlookups--;
+	if(nlookups == 0)
+		loop->quit();
+}
+
+void usage()
+{
+	std::cerr << "Usage: dns hostname ..." << std::endl;
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	if(argc < 2)
+		usage();
+
+  Glib::init();
+	Glib::thread_init();
+
+	for(int i = 1; i < argc; i++)
+  {
+		Glib::RefPtr<Soup::Address> address = Soup::Address::create(argv[i], 0);
+		if(!address)
+    {
+			std::cerr << "Could not parse address " << argv[i] << std::endl;
+			exit(1);
+		}
+
+		address->resolve_async(sigc::bind(sigc::ptr_fun(resolve_callback), address));
+		nlookups++;
+	}
+
+  // Create and run a main loop
+	loop = Glib::MainLoop::create();
+  loop->run();
+
+	return 0;
+}
diff --git a/libsoup/libsoupmm-2.4-uninstalled.pc.in b/libsoup/libsoupmm-uninstalled.pc.in
similarity index 100%
rename from libsoup/libsoupmm-2.4-uninstalled.pc.in
rename to libsoup/libsoupmm-uninstalled.pc.in
diff --git a/libsoup/libsoupmm.h b/libsoup/libsoupmm.h
index e2c387c..6bdb1d8 100644
--- a/libsoup/libsoupmm.h
+++ b/libsoup/libsoupmm.h
@@ -20,13 +20,9 @@
 #ifndef LIBSOUPMM_H
 #define LIBSOUPMM_H
 
-// libsoupmm version
-extern const int libsoupmm_major_version;
-extern const int libsoupmm_minor_version;
-extern const int libsoupmm_micro_version;
-
 #include <glibmm.h>
 
+#include <libsoupmmconfig.h>
 #include <libsoupmm/address.h>
 #include <libsoupmm/auth.h>
 #include <libsoupmm/enums.h>
diff --git a/libsoup/libsoupmm-2.4.pc.in b/libsoup/libsoupmm.pc.in
similarity index 100%
rename from libsoup/libsoupmm-2.4.pc.in
rename to libsoup/libsoupmm.pc.in
diff --git a/libsoup/libsoupmm/Makefile.am b/libsoup/libsoupmm/Makefile.am
index e918b4d..c44648c 100644
--- a/libsoup/libsoupmm/Makefile.am
+++ b/libsoup/libsoupmm/Makefile.am
@@ -15,15 +15,17 @@
 ## You should have received a copy of the GNU Lesser General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-lib_LTLIBRARIES = libsoupmm-2.4.la
+lib_LTLIBRARIES = libsoupmm- LIBSOUPMM_API_VERSION@.la
 
 include $(srcdir)/../src/filelist.am
 include $(srcdir)/filelist.am
 include $(top_srcdir)/build/compile-binding.am
 
-AM_CPPFLAGS = $(binding_includes) $(binding_cppflags) $(GTHREAD_CFLAGS) $(LIBSOUPMM_CFLAGS)
+local_cppflags = $(binding_includes) $(binding_cppflags) -DLIBSOUPMM_BUILD=1
+
+AM_CPPFLAGS = $(local_cppflags) $(GTHREAD_CFLAGS) $(LIBSOUPMM_CFLAGS)
 AM_CXXFLAGS = $(LIBSOUPMM_WXXFLAGS)
 
-libsoupmm_2_4_la_SOURCES = $(binding_sources)
-libsoupmm_2_4_la_LDFLAGS = -no-undefined -version-info $(LIBSOUPMM_SO_VERSION)
-libsoupmm_2_4_la_LIBADD  = $(LIBSOUPMM_LIBS)
+libsoupmm_ LIBSOUPMM_API_VERSION@_la_SOURCES = $(binding_sources)
+libsoupmm_ LIBSOUPMM_API_VERSION@_la_LDFLAGS = -no-undefined -version-info $(LIBSOUPMM_SO_VERSION)
+libsoupmm_ LIBSOUPMM_API_VERSION@_la_LIBADD  = $(LIBSOUPMM_LIBS)
diff --git a/libsoup/libsoupmmconfig.h.in b/libsoup/libsoupmmconfig.h.in
new file mode 100644
index 0000000..c21ed99
--- /dev/null
+++ b/libsoup/libsoupmmconfig.h.in
@@ -0,0 +1,10 @@
+/* This file is part of libsoupmm. */
+
+/* Major version number of libsoupmm. */
+#undef LIBSOUPMM_MAJOR_VERSION
+
+/* Micro version number of libsoupmm. */
+#undef LIBSOUPMM_MICRO_VERSION
+
+/* Minor version number of libsoupmm. */
+#undef LIBSOUPMM_MINOR_VERSION



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]