From eae6e24bb5facfd2b6f398e65e5c2d65da5864b8 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Mon, 9 Apr 2012 12:15:55 -0400
Subject: [PATCH] * #9730: builds against libccrtp1

---
 daemon/configure.ac                           | 11 +++--
 daemon/src/Makefile.am                        |  3 +-
 daemon/src/audio/audiolayer.h                 |  2 +-
 daemon/src/audio/audiorecorder.h              |  6 +--
 daemon/src/audio/audiortp/audio_rtp_factory.h |  2 +-
 daemon/src/audio/mainbuffer.h                 |  2 +-
 daemon/src/call.h                             |  3 +-
 daemon/src/cc_config.h                        | 44 +++++++++++++++++++
 daemon/src/cc_thread.h                        | 44 +++++++++++++++++++
 daemon/src/codec.h                            |  8 ++--
 daemon/src/dbus/Makefile.am                   |  1 +
 daemon/src/eventthread.h                      |  2 +-
 daemon/src/managerimpl.h                      |  2 +-
 daemon/src/sip/siptransport.cpp               |  1 +
 daemon/src/voiplink.h                         |  2 +-
 15 files changed, 114 insertions(+), 19 deletions(-)
 create mode 100644 daemon/src/cc_config.h
 create mode 100644 daemon/src/cc_thread.h

diff --git a/daemon/configure.ac b/daemon/configure.ac
index d81152e04c..a06fe449c8 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -119,10 +119,15 @@ LIBSAMPLERATE_MIN_VERSION=0.1.2
 PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development package: libsamplerate0-dev]))
 
 LIBCCGNU2_MIN_VERSION=1.3.1
-PKG_CHECK_MODULES(CCGNU2, commoncpp >= ${LIBCCGNU2_MIN_VERSION},, AC_MSG_ERROR([Missing common cpp development package: libcommoncpp2-dev]))
+PKG_CHECK_MODULES([CCGNU2], [commoncpp] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([COMMONCPP_PREFIX], [1], [Use commoncpp include prefix]), [
+        PKG_CHECK_MODULES([CCGNU2], [libccgnu2] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([CCPP_PREFIX], [1], [Use cc++ include prefix]),
+            AC_MSG_ERROR([Missing common cpp development package: libcommoncpp2-dev]))
+        ])
 
-LIBCCRT_MIN_VERSION=1.3.0
-PKG_CHECK_MODULES(CCRTP, libccrtp >= ${LIBCCRT_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development package: libccrtp-dev]))
+LIBCCRTP_MIN_VERSION=1.3.0
+PKG_CHECK_MODULES([CCRTP], [libccrtp] >= ${LIBCCRTP_MIN_VERSION},, [
+        PKG_CHECK_MODULES([CCRTP], [libccrtp1] >= ${LIBCCRTP_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development package: libccrtp-dev]))
+        ])
 
 dnl Check for OpenSSL to link against pjsip and provide SIPS TLS support
 PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development package: libssl-dev]))
diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am
index 3886ea0855..cbfae79450 100644
--- a/daemon/src/Makefile.am
+++ b/daemon/src/Makefile.am
@@ -48,7 +48,8 @@ noinst_HEADERS = \
 		logger.h \
 		numbercleaner.h \
 		fileutils.h \
-		noncopyable.h
+		noncopyable.h \
+		cc_thread.h
 
 libsflphone_la_LIBADD = \
 	$(top_builddir)/libs/iax2/libiax2.la \
diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h
index a0f60fb58e..dbc652cb96 100644
--- a/daemon/src/audio/audiolayer.h
+++ b/daemon/src/audio/audiolayer.h
@@ -34,7 +34,7 @@
 #ifndef __AUDIO_LAYER_H__
 #define __AUDIO_LAYER_H__
 
-#include <commoncpp/thread.h> // for ost::Mutex
+#include "cc_thread.h" // for ost::Mutex
 #include <sys/time.h>
 
 #include "ringbuffer.h"
diff --git a/daemon/src/audio/audiorecorder.h b/daemon/src/audio/audiorecorder.h
index aa95b8b688..82be9a4795 100644
--- a/daemon/src/audio/audiorecorder.h
+++ b/daemon/src/audio/audiorecorder.h
@@ -28,11 +28,11 @@
  *  as that of the covered work.
  */
 
-#ifndef __AUDIORECORDER_H_
-#define __AUDIORECORDER_H_
+#ifndef AUDIORECORDER_H_
+#define AUDIORECORDER_H_
 
 #include <string>
-#include <commoncpp/thread.h>
+#include "cc_thread.h"
 #include "audiorecord.h"
 #include "noncopyable.h"
 
diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.h b/daemon/src/audio/audiortp/audio_rtp_factory.h
index 9aa90d3b4d..0aa88f0f31 100644
--- a/daemon/src/audio/audiortp/audio_rtp_factory.h
+++ b/daemon/src/audio/audiortp/audio_rtp_factory.h
@@ -32,8 +32,8 @@
 #define __AUDIO_RTP_FACTORY_H__
 
 #include <stdexcept>
-#include <commoncpp/thread.h>
 #include <ccrtp/CryptoContext.h>
+#include "cc_thread.h"
 #include "audio_rtp_session.h"
 #include "noncopyable.h"
 
diff --git a/daemon/src/audio/mainbuffer.h b/daemon/src/audio/mainbuffer.h
index b81deb9bed..66dd65b4dc 100644
--- a/daemon/src/audio/mainbuffer.h
+++ b/daemon/src/audio/mainbuffer.h
@@ -34,9 +34,9 @@
 
 #include <map>
 #include <set>
-#include <commoncpp/thread.h> // for ost::Mutex
 #include <string>
 
+#include "cc_thread.h" // for ost::Mutex
 #include "global.h"
 #include "call.h"
 #include "ringbuffer.h"
diff --git a/daemon/src/call.h b/daemon/src/call.h
index 63f8a8d216..36ca85fc01 100644
--- a/daemon/src/call.h
+++ b/daemon/src/call.h
@@ -32,9 +32,8 @@
 #ifndef CALL_H
 #define CALL_H
 
-#include <commoncpp/thread.h> // for mutex
 #include <sstream>
-
+#include "cc_thread.h"
 #include "audio/recordable.h"
 
 /*
diff --git a/daemon/src/cc_config.h b/daemon/src/cc_config.h
new file mode 100644
index 0000000000..8da77b2325
--- /dev/null
+++ b/daemon/src/cc_config.h
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (C) 2012 Savoir-Faire Linux Inc.
+ *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#ifndef CC_CONFIG_H_
+#define CC_CONFIG_H_
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef CCPP_PREFIX
+#include <cc++/config.h>
+#else
+#include <commoncpp/config.h>
+#endif
+
+#endif // CC_CONFIG_H_
diff --git a/daemon/src/cc_thread.h b/daemon/src/cc_thread.h
new file mode 100644
index 0000000000..4af48e2e82
--- /dev/null
+++ b/daemon/src/cc_thread.h
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (C) 2012 Savoir-Faire Linux Inc.
+ *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#ifndef CC_THREAD_H_
+#define CC_THREAD_H_
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef CCPP_PREFIX
+#include <cc++/thread.h> // for mutex
+#else
+#include <commoncpp/thread.h> // for mutex
+#endif
+
+#endif	// CC_THREAD_H_
diff --git a/daemon/src/codec.h b/daemon/src/codec.h
index fd771eaeb0..713ac9a1d9 100644
--- a/daemon/src/codec.h
+++ b/daemon/src/codec.h
@@ -27,10 +27,10 @@
  *  as that of the covered work.
  */
 
-#ifndef __SFL_CODEC_H__
-#define __SFL_CODEC_H__
+#ifndef CODEC_H_
+#define CODEC_H_
 
-#include <commoncpp/config.h> // for types
+#include "cc_config.h" // for types
 
 /**
  * Interface for both audio codecs as well as video codecs.
@@ -65,4 +65,4 @@ typedef sfl::Codec* create_t();
 
 typedef void destroy_t (sfl::Codec*);
 
-#endif
+#endif // CODEC_H_
diff --git a/daemon/src/dbus/Makefile.am b/daemon/src/dbus/Makefile.am
index 53ab8b9d24..992b691253 100644
--- a/daemon/src/dbus/Makefile.am
+++ b/daemon/src/dbus/Makefile.am
@@ -29,6 +29,7 @@ libdbus_la_CXXFLAGS = \
             -DPROGSHAREDIR=\"${datadir}/sflphone\" \
             $(NETWORKMANAGER)
 
+
 noinst_HEADERS =            \
     callmanager.h           \
     configurationmanager.h  \
diff --git a/daemon/src/eventthread.h b/daemon/src/eventthread.h
index 8c48f9d123..af3aee58ef 100644
--- a/daemon/src/eventthread.h
+++ b/daemon/src/eventthread.h
@@ -31,7 +31,7 @@
 #ifndef EVENT_THREAD_H_
 #define EVENT_THREAD_H_
 
-#include <commoncpp/thread.h>
+#include "cc_thread.h"
 #include "noncopyable.h"
 
 class VoIPLink;
diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h
index 53ca83746b..d91481829e 100644
--- a/daemon/src/managerimpl.h
+++ b/daemon/src/managerimpl.h
@@ -39,8 +39,8 @@
 #include <vector>
 #include <set>
 #include <map>
-#include <commoncpp/thread.h>
 #include <memory>
+#include "cc_thread.h"
 #include "dbus/dbusmanager.h"
 
 #include "config/config.h"
diff --git a/daemon/src/sip/siptransport.cpp b/daemon/src/sip/siptransport.cpp
index b08f7c3017..2f07f5e979 100644
--- a/daemon/src/sip/siptransport.cpp
+++ b/daemon/src/sip/siptransport.cpp
@@ -45,6 +45,7 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include <arpa/inet.h>
+#include <net/if.h>
 
 #include "siptransport.h"
 #include "manager.h"
diff --git a/daemon/src/voiplink.h b/daemon/src/voiplink.h
index f28dfffe19..7889e471c5 100644
--- a/daemon/src/voiplink.h
+++ b/daemon/src/voiplink.h
@@ -36,7 +36,7 @@
 
 #include <stdexcept>
 #include <map>
-#include <commoncpp/thread.h> // for ost::Mutex
+#include "cc_thread.h" // for ost::Mutex
 
 class Call;
 class Account;
-- 
GitLab