From 0241732283862e893794a72b47dbf1df5d46ce00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=
 <rafael.carre@savoirfairelinux.com>
Date: Fri, 5 Aug 2011 18:47:29 -0400
Subject: [PATCH] * #6601 : fix configure.ac tests

use AC_DEFINE_UNQUOTED to perform shell expansion
Do not use USE_IAX in code, it's makefile only
Always define HAVE_IAX to 0 or 1 (1 if enabled)
---
 sflphone-common/configure.ac              |  4 ++--
 sflphone-common/src/accountcreator.cpp    |  4 ++--
 sflphone-common/src/global.h              |  6 -----
 sflphone-common/src/iax/iaxaccount.cpp    |  2 +-
 sflphone-common/src/managerimpl.cpp       |  8 +++----
 sflphone-common/test/history-sample.tpl   | 28 +++++++++++------------
 sflphone-common/test/sflphoned-sample.yml |  2 +-
 7 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac
index d6e761074f..cfb4df434f 100644
--- a/sflphone-common/configure.ac
+++ b/sflphone-common/configure.ac
@@ -329,7 +329,7 @@ AS_IF([test "x$with_gsm" != xno],
 		]
 	 )
 
-AC_DEFINE([HAVE_GSM], test "x$with_gsm" = "xyes", [Define if you have libgsm])
+AC_DEFINE_UNQUOTED([HAVE_GSM], `if test "x$with_gsm" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libgsm])
 AM_CONDITIONAL(BUILD_GSM, test "x$with_gsm" = "xyes" )
 
 dnl Check for libspeex
@@ -385,7 +385,7 @@ AC_ARG_WITH([iax2],
 		[],
 		[with_iax2=yes])
 
-AC_DEFINE([HAVE_IAX], test "x$with_iax2" = "xyes", [Define if you have libiax2])
+AC_DEFINE_UNQUOTED([HAVE_IAX], `if test "x$with_iax2" = "xyes"; then echo 1; else echo 0;fi`, [Define if you have libiax2])
 AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
 
 	dnl Check for network-manager
diff --git a/sflphone-common/src/accountcreator.cpp b/sflphone-common/src/accountcreator.cpp
index 82f56b1300..df7aa91a02 100644
--- a/sflphone-common/src/accountcreator.cpp
+++ b/sflphone-common/src/accountcreator.cpp
@@ -31,7 +31,7 @@
 #include "accountcreator.h"
 #include "sip/sipaccount.h"
 
-#ifdef USE_IAX
+#if HAVE_IAX
 #include "iax/iaxaccount.h"
 #endif
 
@@ -59,7 +59,7 @@ AccountCreator::createAccount (AccountType type, std::string accountID)
             return new SIPAccount (IP2IP_PROFILE);
             break;
         }
-#ifdef USE_IAX
+#if HAVE_IAX
 
         case IAX_ACCOUNT: {
             _debug ("AccountCreator: create account %s", accountID.c_str());
diff --git a/sflphone-common/src/global.h b/sflphone-common/src/global.h
index c093de1722..d244ece14f 100644
--- a/sflphone-common/src/global.h
+++ b/sflphone-common/src/global.h
@@ -103,12 +103,6 @@ static const SOUND_FORMAT INT32 = 0x8;
 #define SFL_PCM_CAPTURE		0x0023		/** To open capture device only */
 #define SFL_PCM_RINGTONE        0x0024
 
-#ifdef USE_IAX
-#define	IAX2_ENABLED  true			/** IAX2 support */
-#else
-#define	IAX2_ENABLED  false			/** IAX2 support */
-#endif
-
 #define GSM_STRING_DESCRIPTION	  "gsm"		/** GSM codec string description */
 #define SPEEX_STRING_DESCRIPTION  "speex"	/** SPEEX codec string description */
 #define ILBC_STRING_DESCRIPTION   "ilbc"		/** Ilbc codec string description */
diff --git a/sflphone-common/src/iax/iaxaccount.cpp b/sflphone-common/src/iax/iaxaccount.cpp
index 80aa41cc83..d3667c7e60 100644
--- a/sflphone-common/src/iax/iaxaccount.cpp
+++ b/sflphone-common/src/iax/iaxaccount.cpp
@@ -201,7 +201,7 @@ void
 IAXAccount::loadConfig()
 {
     // If IAX is not supported, do not register this account
-#ifndef USE_IAX
+#if !HAVE_IAX
 	_enabled = false;
 #endif
 }
diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index aca91425b1..abdb61db6b 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -33,6 +33,8 @@
  *  as that of the covered work.
  */
 
+#include "config.h"
+
 #include "managerimpl.h"
 
 #include "account.h"
@@ -2864,11 +2866,7 @@ std::vector<std::string> ManagerImpl::getCurrentAudioDevicesIndex ()
 
 int ManagerImpl::isIax2Enabled (void)
 {
-#ifdef USE_IAX
-    return true;
-#else
-    return false;
-#endif
+    return HAVE_IAX;
 }
 
 int ManagerImpl::isRingtoneEnabled (const std::string& id)
diff --git a/sflphone-common/test/history-sample.tpl b/sflphone-common/test/history-sample.tpl
index fdc86d4113..2fe78d9edd 100644
--- a/sflphone-common/test/history-sample.tpl
+++ b/sflphone-common/test/history-sample.tpl
@@ -1,16 +1,4 @@
-[1827389202]
-accountid=
-confid=
-id=Account:1239059899
-name=Emmanuel Milou
-number=136
-recordfile=
-timeadded=
-timestamp_start=747638685
-timestamp_stop=747638765
-type=2
-
-[264770330]
+[1688219219]
 accountid=empty
 confid=
 id=
@@ -22,7 +10,7 @@ timestamp_start=144562000
 timestamp_stop=144562458
 type=0
 
-[37710036]
+[1828895003]
 accountid=
 confid=
 id=Account:43789459478
@@ -34,3 +22,15 @@ timestamp_start=775354456
 timestamp_stop=775354987
 type=1
 
+[2049190489]
+accountid=
+confid=
+id=Account:1239059899
+name=Emmanuel Milou
+number=136
+recordfile=
+timeadded=
+timestamp_start=747638685
+timestamp_stop=747638765
+type=2
+
diff --git a/sflphone-common/test/sflphoned-sample.yml b/sflphone-common/test/sflphoned-sample.yml
index 2ac9bbb5d7..7542af76c3 100644
--- a/sflphone-common/test/sflphoned-sample.yml
+++ b/sflphone-common/test/sflphoned-sample.yml
@@ -55,7 +55,7 @@ preferences:
   historyMaxCalls: 20
   md5Hash: false
   notifyMails: false
-  order: Account:1312398082/Account:1312398066/Account:1309188361/Account:1309187807/Account:1309187723/Account:1309187670/Account:1309187609/Account:1309187081/Account:1308839853/Account:1308839662/Account:1308839447/Account:1308839359/Account:1308839335/Account:1308838875/Account:1308838713/Account:1308838236/Account:1307975440/Account:1307975347/Account:1307974800/Account:1307974672/Account:1307974527/Account:1303487773/Account:1303247743/Account:1302895321/Account:1302892836/Account:1302891834/Account:1302882519/Account:1302207377/Account:1302207262/Account:1302204136/Account:1302204108/Account:1294850905/Account:1294850775/Account:1294850618/Account:1294849651/Account:1294849602/Account:1294849310/Account:1288964768/Account:1288964603/Account:1288964434/Account:1288964141/Account:1288964134/
+  order: Account:1312584532/Account:1312398082/Account:1312398066/Account:1309188361/Account:1309187807/Account:1309187723/Account:1309187670/Account:1309187609/Account:1309187081/Account:1308839853/Account:1308839662/Account:1308839447/Account:1308839359/Account:1308839335/Account:1308838875/Account:1308838713/Account:1308838236/Account:1307975440/Account:1307975347/Account:1307974800/Account:1307974672/Account:1307974527/Account:1303487773/Account:1303247743/Account:1302895321/Account:1302892836/Account:1302891834/Account:1302882519/Account:1302207377/Account:1302207262/Account:1302204136/Account:1302204108/Account:1294850905/Account:1294850775/Account:1294850618/Account:1294849651/Account:1294849602/Account:1294849310/Account:1288964768/Account:1288964603/Account:1288964434/Account:1288964141/Account:1288964134/
   portNum: 5060
   registrationExpire: 180
   searchBarDisplay: true
-- 
GitLab