Generate iotivity_config.h at build time
authorDavid Antler <david.a.antler@intel.com>
Fri, 26 Aug 2016 21:39:56 +0000 (14:39 -0700)
committerJon A. Cruz <jon@joncruz.org>
Fri, 2 Sep 2016 19:28:48 +0000 (19:28 +0000)
This patch lightens the burden for those wishing to integrate the
IoTivity CSDK into their project.

 - Remove (almost) all HAVE_*_H from the command line.
 - Build new file: resource/c_common/iotivity_config.h
 - Include "iotivity_config.h" in headers which #include
   platform-specific header files.
 - Added out/*/*/*/include/c_common/iotivity_config.h which will
   include the HAVE_*_H build flags.
 - Export files from out/*/*/*/include/c_common/windows/include/*.h

Change-Id: Ib8a7e83c8ceb025c29b11284ee2912f95c930ca6
Signed-off-by: David Antler <david.a.antler@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10989
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-by: Soemin Tjong <stjong@microsoft.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
70 files changed:
.gitignore
build_common/SConscript
extlibs/timer/timer.c
extlibs/timer/timer.h
extlibs/tinydtls/tests/dtls-server.c
iotivity.pc.in
resource/c_common/SConscript
resource/c_common/ocrandom/src/ocrandom.c
resource/c_common/oic_time/src/oic_time.c
resource/c_common/windows/SConscript
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/common/src/camutex_pthreads.c
resource/csdk/connectivity/common/src/cathreadpool_pthreads.c
resource/csdk/connectivity/inc/caadapternetdtls.h
resource/csdk/connectivity/inc/caadapterutils.h
resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c
resource/csdk/connectivity/src/adapter_util/caadapterutils.c
resource/csdk/connectivity/src/caprotocolmessage.c
resource/csdk/connectivity/src/caqueueingthread.c
resource/csdk/connectivity/src/caretransmission.c
resource/csdk/connectivity/src/ip_adapter/caipserver.c
resource/csdk/connectivity/test/camutex_tests.cpp
resource/csdk/connectivity/test/catests.cpp
resource/csdk/logger/src/logger.c
resource/csdk/security/include/securevirtualresourcetypes.h
resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp
resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp
resource/csdk/security/provisioning/src/ownershiptransfermanager.c
resource/csdk/security/provisioning/src/pmutility.c
resource/csdk/security/provisioning/src/secureresourceprovider.c
resource/csdk/security/provisioning/unittest/provisioningdatabasemanager.cpp
resource/csdk/security/src/aclresource.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/directpairing.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/dpairingresource.c
resource/csdk/security/src/iotvticalendar.c
resource/csdk/security/src/pconfresource.c
resource/csdk/security/src/verresource.c
resource/csdk/security/unittest/pstatresource.cpp
resource/csdk/security/unittest/securityresourcemanager.cpp
resource/csdk/stack/include/octypes.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserverbasicops.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp
resource/csdk/stack/samples/linux/secure/ocamsservice.cpp
resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp
resource/csdk/stack/samples/linux/secure/occlientdirectpairing.cpp
resource/csdk/stack/samples/linux/secure/ocserverbasicops.cpp
resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
resource/csdk/stack/src/occlientcb.c
resource/csdk/stack/src/ocpayload.c
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocstack.c
resource/csdk/stack/src/oicgroup.c
resource/csdk/stack/src/oicresourcedirectory.c
resource/examples/lightserver.cpp
resource/examples/presenceserver.cpp
resource/examples/simpleclient.cpp
resource/examples/simpleclientHQ.cpp
resource/examples/simpleserver.cpp
resource/examples/simpleserverHQ.cpp
resource/examples/threadingsample.cpp
resource/src/OCResource.cpp

index 62afd32..4f34ee3 100644 (file)
@@ -37,6 +37,9 @@ resource/csdk/stack/samples/linux/SimpleClientServer/release/
 
 resource/csdk/connectivity/build/out/
 
+# Ignore autogenerated files
+resource/c_common/iotivity_config.h
+
 resource/oc_logger/bin/
 resource/oc_logger/lib/
 resource/oc_logger/samples/linux/release/
index 59a063f..23910b6 100644 (file)
@@ -431,52 +431,6 @@ conf = Configure(env,
 # POSIX_SUPPORTED, 1 if it is supported, 0 otherwise
 conf.CheckPThreadsSupport()
 
-######################################################################
-# Generate macros for presence of headers
-######################################################################
-cxx_headers = ['arpa/inet.h',
-               'fcntl.h',
-               'grp.h',
-               'in6addr.h',
-               'linux/limits.h',
-               'memory.h',
-               'netdb.h',
-               'netinet/in.h',
-               'pthread.h',
-               'pwd.h',
-               'stdlib.h',
-               'string.h',
-               'strings.h',
-               'sys/socket.h',
-               'sys/stat.h',
-               'sys/time.h',
-               'sys/timeb.h',
-               'sys/types.h',
-               'sys/unistd.h',
-               'syslog.h',
-               'time.h',
-               'unistd.h',
-               'uuid/uuid.h',
-               'windows.h',
-               'winsock2.h',
-               'ws2tcpip.h']
-
-if target_os == 'arduino':
-       # Detection of headers on the Arduino platform is currently broken.
-       cxx_headers = []
-
-if target_os == 'msys_nt':
-       # WinPThread provides a pthread.h, but we want to use native threads.
-       cxx_headers.remove('pthread.h')
-
-def get_define_from_header_file(header_file):
-       header_file_converted = header_file.replace("/","_").replace(".","_").upper()
-       return "HAVE_" + header_file_converted
-
-for header_file_name in cxx_headers:
-       if conf.CheckCXXHeader(header_file_name):
-               conf.env.AppendUnique(CPPDEFINES = [get_define_from_header_file(header_file_name)])
-
 env = conf.Finish()
 ######################################################################
 
index 3dda84b..08b9a6e 100755 (executable)
@@ -22,6 +22,7 @@
 
 #define _BSD_SOURCE
 
+#include "iotivity_config.h"
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
@@ -40,7 +41,6 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#include "platform_features.h"
 
 #include <stdio.h>
 
index 3ad432a..ffa304c 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef TIMER_H_
 #define TIMER_H_
 
+#include "iotivity_config.h"
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
index 9a8918a..07acd18 100644 (file)
@@ -2,6 +2,7 @@
 /* This is needed for apple */
 #define __APPLE_USE_RFC_3542
 
+#include "iotivity_config.h"
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
index 59bd6b5..6057152 100644 (file)
@@ -13,6 +13,7 @@ URL: https://www.iotivity.org
 Requires:
 Libs: -L${libdir} -loc -loc_logger -loc_logger_core -loctbstack -lconnectivity_abstraction
 Cflags: -I${includedir}/resource \
+                       -I${includedir}/c_common \
                        -I${svcincludedir}/resource-encapsulation \
                        -I${svcincludedir}/resource-container \
                        -I${svcincludedir}/resource-hosting \
index f412655..31f7eca 100644 (file)
 
 Import('env')
 import os
+import datetime
 
 target_os = env.get('TARGET_OS')
+target_arch = env.get('TARGET_ARCH')
 
+######################################################################
+# Generate iotivity_config.h using presence of headers
+######################################################################
+
+config_h_env = env.Clone()
+conf = Configure(config_h_env)
+
+config_h_header = '''
+/* ****************************************************************************
+ * iotivity_config.h - IoTivity platform-specific configuration header.
+ *
+ * Auto-generated code for the %s %s platform.
+ *
+ * Generated at %s
+ *
+ *************************************************************************** */
+
+#ifndef IOTIVITY_CONFIG_H__
+#define IOTIVITY_CONFIG_H__
+
+#include "platform_features.h"
+
+''' % (str(target_os), str(target_arch), str(datetime.datetime.utcnow()))
+
+config_h_body = ''
+
+config_h_footer = '''
+
+#endif // IOTIVITY_CONFIG_H__
+
+'''
+
+cxx_headers = ['arpa/inet.h',
+               'fcntl.h',
+               'grp.h',
+               'in6addr.h',
+               'linux/limits.h',
+               'memory.h',
+               'netdb.h',
+               'netinet/in.h',
+               'pthread.h',
+               'pwd.h',
+               'stdlib.h',
+               'string.h',
+               'strings.h',
+               'sys/socket.h',
+               'sys/stat.h',
+               'sys/time.h',
+               'sys/timeb.h',
+               'sys/types.h',
+               'sys/unistd.h',
+               'syslog.h',
+               'time.h',
+               'unistd.h',
+               'uuid/uuid.h',
+               'windows.h',
+               'winsock2.h',
+               'ws2tcpip.h']
+
+if target_os == 'arduino':
+       # Detection of headers on the Arduino platform is currently broken.
+       cxx_headers = []
+
+if target_os == 'msys_nt':
+       # WinPThread provides a pthread.h, but we want to use native threads.
+       cxx_headers.remove('pthread.h')
+
+def get_define_from_header_file(header_file):
+       header_file_converted = header_file.replace("/","_").replace(".","_").upper()
+       return "HAVE_" + header_file_converted
+
+for header_file_name in cxx_headers:
+       if conf.CheckCXXHeader(header_file_name):
+               config_h_body += "#define %s\n\n" % get_define_from_header_file(header_file_name)
+conf.Finish()
+
+# Autoconf feature doesn't work with Jenkins' arduino toolchain, so hardcode it here.
+if target_os == 'arduino':
+       config_h_body += "#define HAVE_ARDUINO_TIME_H\n\n"
+
+# Generate the file
+src_dir = env.get('SRC_DIR')
+config_h_file_path = os.path.join(src_dir, 'resource', 'c_common', 'iotivity_config.h')
+if os.path.exists(config_h_file_path):
+       os.remove(config_h_file_path)
+config_h_file = open(config_h_file_path, "w")
+config_h_file.write(config_h_header + config_h_body + config_h_footer)
+config_h_file.close()
+
+# Sanity check to ensure that the above block created the file.
+if not os.path.exists(config_h_file_path):
+       print "Error: iotivity_config.h file not created!"
+
+# iotivity_config.h should be copied to the build dir
+env.UserInstallTargetHeader(config_h_file_path, 'c_common', 'iotivity_config.h')
+
+# Use the generated file internally
+env.AppendUnique(CPPPATH = [os.path.join(src_dir, 'resource', 'c_common')])
+
+######################################################################
+
+######################################################################
 # Add platform-specific helper library
+######################################################################
+
 if target_os in ['windows', 'msys_nt']:
        SConscript('windows/SConscript')
 
 env.AppendUnique(CPPPATH = [
-            os.path.join(Dir('.').abspath),
             os.path.join(Dir('.').abspath, 'oic_malloc', 'include'),
             os.path.join(Dir('.').abspath, 'oic_string', 'include'),
             os.path.join(Dir('.').abspath, 'oic_time', 'include'),
@@ -45,7 +150,6 @@ if target_os in ['tizen', 'linux']:
        env.ParseConfig("pkg-config --cflags --libs uuid")
 
 common_env = env.Clone()
-common_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource')])
 
 ######################################################################
 # Build flags
@@ -64,10 +168,9 @@ common_src = [
        'oic_time/src/oic_time.c',
        'ocrandom/src/ocrandom.c',
        ]
-
 commonlib = common_env.StaticLibrary('c_common', common_src)
 common_env.InstallTarget(commonlib, 'c_common')
 common_env.UserInstallTargetLib(commonlib, 'c_common')
-common_env.UserInstallTargetHeader('platform_features.h', 'resource', 'platform_features.h')
+common_env.UserInstallTargetHeader('platform_features.h', 'c_common', 'platform_features.h')
 
 env.PrependUnique(LIBS = ['c_common'])
index 118aeee..32c4b4b 100644 (file)
@@ -30,7 +30,8 @@
 #define _POSIX_C_SOURCE 200809L
 #endif
 
-#include "platform_features.h"
+#include "iotivity_config.h"
+
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
index 0b094f5..e01e6fb 100644 (file)
@@ -30,6 +30,7 @@
 #define _POSIX_C_SOURCE 200809L
 #endif
 
+#include "iotivity_config.h"
 #include "oic_time.h"
 
 #include <stddef.h>        // For NULL
index a2e0e51..63ccb45 100644 (file)
@@ -21,6 +21,9 @@ helper_src = [
 static_libwinhelper = env.StaticLibrary('win_helper', helper_src)
 env.InstallTarget(static_libwinhelper, 'win_helper')
 env.UserInstallTargetLib(static_libwinhelper, 'win_helper')
+env.UserInstallTargetHeader('include/win_sleep.h', 'c_common/windows/include', 'win_sleep.h')
+env.UserInstallTargetHeader('include/pthread_create.h', 'c_common/windows/include', 'pthread_create.h')
+env.UserInstallTargetHeader('include/vs12_snprintf.h', 'c_common/windows/include', 'vs12_snprintf.h')
 
 env.AppendUnique(LIBS = ['win_helper'])
 
index 87d1174..cedc763 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef CA_COMMON_H_
 #define CA_COMMON_H_
 
+#include "iotivity_config.h"
+
 #ifndef WITH_ARDUINO
 #ifdef TCP_ADAPTER
 #define HAVE_SYS_POLL_H
index db790ec..55f8536 100644 (file)
@@ -36,6 +36,7 @@
 #define _POSIX_C_SOURCE 200809L
 #endif
 
+#include "iotivity_config.h"
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
@@ -58,7 +59,6 @@
 #include <errno.h>
 #include <assert.h>
 #include <oic_malloc.h>
-#include "platform_features.h"
 #include "camutex.h"
 #include "logger.h"
 
index d17af9c..3865df6 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#include "iotivity_config.h"
 #include <errno.h>
 #if defined HAVE_PTHREAD_H
 #include <pthread.h>
index 6d03c7e..dcc2366 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef CA_ADAPTER_NET_DTLS_H_
 #define CA_ADAPTER_NET_DTLS_H_
 
-#include "platform_features.h"
 #include "dtls.h"
 #include "uarraylist.h"
 #include "camutex.h"
index 5f8c248..5c2dcc7 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef CA_ADAPTER_UTILS_H_
 #define CA_ADAPTER_UTILS_H_
 
+#include "iotivity_config.h"
+
 #include <stdbool.h>
 #ifdef __ANDROID__
 #include <jni.h>
index f960fab..571878e 100644 (file)
@@ -17,7 +17,7 @@
  * limitations under the License.
  *
  ******************************************************************/
-#include "platform_features.h"
+#include "iotivity_config.h"
 #include "caadapternetdtls.h"
 #include "cacommon.h"
 #include "caipinterface.h"
index 888885b..8355886 100644 (file)
@@ -18,6 +18,7 @@
  *
  ******************************************************************/
 
+#include "iotivity_config.h"
 #include "caadapterutils.h"
 
 #include <string.h>
index 03eca3b..94810ca 100644 (file)
@@ -28,6 +28,7 @@
 // Refer http://www.gnu.org/software/libc/manual/html_node/BSD-Random.html
 #define _DEFAULT_SOURCE
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 3e10065..e034161 100644 (file)
@@ -18,6 +18,7 @@
  *
  ******************************************************************/
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index a3cb02f..7101b4c 100644 (file)
@@ -41,6 +41,7 @@
 #define _POSIX_C_SOURCE 200809L
 #endif
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -55,7 +56,7 @@
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#if HAVE_SYS_TIMEB_H
+#ifdef HAVE_SYS_TIMEB_H
 #include <sys/timeb.h>
 #endif
 #ifdef HAVE_TIME_H
index 313d2f6..f953689 100644 (file)
@@ -25,6 +25,7 @@
 #define _GNU_SOURCE // for in6_pktinfo
 #endif
 
+#include "iotivity_config.h"
 #include <sys/types.h>
 #if !defined(_WIN32)
 #include <sys/socket.h>
@@ -65,7 +66,6 @@
 #include "camutex.h"
 #include "oic_malloc.h"
 #include "oic_string.h"
-#include "platform_features.h"
 
 #define USE_IP_MREQN
 #if defined(_WIN32)
index 54d9fb8..9a8e6f6 100644 (file)
@@ -33,6 +33,7 @@
 #define _POSIX_C_SOURCE 200809L
 #endif // _POSIX_C_SOURCE
 
+#include "iotivity_config.h"
 #include "gtest/gtest.h"
 
 #include <camutex.h>
@@ -47,7 +48,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include "platform_features.h"
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
index c701a2e..69eaa14 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include "gtest/gtest.h"
 
 #ifdef HAVE_PTHREAD_H
index cc7f303..edeb167 100644 (file)
@@ -30,6 +30,8 @@
 #define _POSIX_C_SOURCE 200809L
 #endif
 
+#include "iotivity_config.h"
+
 // Pull in _POSIX_TIMERS feature test macro to check for
 // clock_gettime() support.
 #ifdef HAVE_UNISTD_H
@@ -52,7 +54,6 @@
 #include "logger.h"
 #include "string.h"
 #include "logger_types.h"
-#include "platform_features.h"
 
 #ifndef __TIZEN__
 static oc_log_ctx_t *logCtx = 0;
index bc0efb4..77af258 100644 (file)
 #ifndef OC_SECURITY_RESOURCE_TYPES_H
 #define OC_SECURITY_RESOURCE_TYPES_H
 
+#include "iotivity_config.h"
+
 #include <stdint.h> // for uint8_t typedef
 #include <stdbool.h>
 #if defined(__WITH_X509__) || defined(__WITH_TLS__)
 #include "byte_array.h"
 #endif /* __WITH_X509__  or __WITH_TLS__*/
 
-#include "platform_features.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index b0454ee..c742e1b 100644 (file)
  *
  *****************************************************************/
 
+#include "iotivity_config.h"
+
 #include <stdio.h>
 #include <string.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#include "platform_features.h"
 #include "utlist.h"
 #include "logger.h"
 #include "oic_malloc.h"
index adec06f..fcf752d 100644 (file)
@@ -20,6 +20,7 @@
 ///////////////////////////////////////////////////////////////////////
 //NOTE :  This sample server is generated based on ocserverbasicops.cpp
 ///////////////////////////////////////////////////////////////////////
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index 06a5512..56156ba 100644 (file)
@@ -20,6 +20,7 @@
 ///////////////////////////////////////////////////////////////////////
 //NOTE :  This sample server is generated based on ocserverbasicops.cpp
 ///////////////////////////////////////////////////////////////////////
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index f679388..ee4c607 100755 (executable)
@@ -21,7 +21,8 @@
 #define _POSIX_C_SOURCE 200112L
 #endif
 
-#if HAVE_UNISTD_H
+#include "iotivity_config.h"
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #ifdef HAVE_STRING_H
index 0b14334..fcf6536 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  *
  * *****************************************************************/
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
index 92c67b7..14338f2 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  *
  * *****************************************************************/
+#include "iotivity_config.h"
 #include "gtest/gtest.h"
 #include "provisioningdatabasemanager.h"
 
index 3aaefeb..450123f 100644 (file)
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #ifdef HAVE_STRING_H
 #include <string.h>
-#elif HAVE_STRINGS_H
+#elif defined(HAVE_STRINGS_H)
 #include <strings.h>
 #endif
 #include <stdlib.h>
index 2e2bba5..24371b8 100644 (file)
@@ -20,6 +20,7 @@
 
 #define __STDC_LIMIT_MACROS
 
+#include "iotivity_config.h"
 #include <stdlib.h>
 #ifdef HAVE_STRING_H
 #include <string.h>
index e7ef882..af7cbad 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef _POSIX_C_SOURCE\r
 #define _POSIX_C_SOURCE 200112L\r
 #endif\r
+#include "iotivity_config.h"\r
 #ifdef HAVE_UNISTD_H\r
 #include <unistd.h>\r
 #endif\r
index 9aac585..44b22be 100644 (file)
 // limitations under the License.
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include "iotivity_config.h"
 #include <stdlib.h>
 #include <string.h>
 
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
 
index 820021a..534dcea 100644 (file)
@@ -18,6 +18,7 @@
  *
  * *****************************************************************/
 
+#include "iotivity_config.h"
 #include <stdlib.h>
 #include <string.h>
 #include "ocstack.h"
index dc16f4b..acb44f1 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined(WITH_ARDUINO)
 
 #define _XOPEN_SOURCE  //Needed by strptime
+#include "iotivity_config.h"
 #include <string.h>
 #include "iotvticalendar.h"
 #include "oic_string.h"
index 84bbf48..b216e62 100644 (file)
@@ -18,6 +18,7 @@
  *
  * *****************************************************************/
 
+#include "iotivity_config.h"
 #include <stdlib.h>
 #include <string.h>
 #include "ocstack.h"
index 96afacc..78725a7 100644 (file)
  *
  * *****************************************************************/
 
+#include "iotivity_config.h"
 #include <stdlib.h>
 #include <string.h>
 
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
 
index 90f189d..df46f27 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
index 2917709..9a38f48 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include "gtest/gtest.h"
 #ifdef HAVE_PWD_H
 #include <pwd.h>
index 2ae83e4..5fafce2 100644 (file)
@@ -28,7 +28,7 @@
 #ifndef OCTYPES_H_
 #define OCTYPES_H_
 
-#include "platform_features.h"
+#include "iotivity_config.h"
 #include "ocstackconfig.h"
 #include <stdbool.h>
 #include <stdint.h>
index fe7c8ae..061c94f 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -37,7 +38,6 @@
 #include "ocpayload.h"
 #include "payload_logging.h"
 #include "common.h"
-#include "platform_features.h"
 
 #ifdef ROUTING_GATEWAY
 /**
index 988ce35..a37f64a 100644 (file)
@@ -17,6 +17,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 375b169..5e576b4 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index d15fdd4..aa45b6c 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 970565a..68c592f 100644 (file)
@@ -19,6 +19,7 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <string>
@@ -41,7 +42,6 @@
 #include "ocpayload.h"
 #include "ocserver.h"
 #include "common.h"
-#include "platform_features.h"
 
 //string length of "/a/light/" + std::numeric_limits<int>::digits10 + '\0'"
 // 9 + 9 + 1 = 19
index 84d902c..e5726c4 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index b5408d0..ed18975 100644 (file)
@@ -19,6 +19,7 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <string>
@@ -38,7 +39,6 @@
 #include <getopt.h>
 #include "ocpayload.h"
 #include "common.h"
-#include "platform_features.h"
 
 #define TAG PCF("ocservercontainer")
 
index 5f0ba4b..997b789 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index 4d0fdf0..e7262a8 100644 (file)
@@ -1,5 +1,5 @@
 
-
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -13,7 +13,6 @@
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
-#include "platform_features.h"
 #include "ocstack.h"
 #include "logger.h"
 #include "common.h"
index 714d075..5e8ca99 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -35,7 +36,6 @@
 #include <iostream>
 #include <sstream>
 #include <getopt.h>
-#include "platform_features.h"
 #include "ocstack.h"
 #include "logger.h"
 #include "occlientbasicops.h"
index af344d3..5ae096b 100644 (file)
@@ -18,6 +18,7 @@
 //\r
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
 \r
+#include "iotivity_config.h"\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
@@ -37,7 +38,6 @@
 #undef ERROR\r
 #endif\r
 #endif // defined(HAVE_WINDOWS_H)\r
-#include "platform_features.h"\r
 #include "ocstack.h"\r
 #include "logger.h"\r
 #include "ocpayload.h"\r
index 9d83669..61db06a 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -31,7 +32,6 @@
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
-#include "platform_features.h"
 #include "ocstack.h"
 #include "logger.h"
 #include "ocpayload.h"
index 2bc78f8..4f65262 100644 (file)
@@ -67,6 +67,7 @@ cp resource/oc_logger/include/targets/oc_ostream_logger.h %{DEST_INC_DIR}
 cp resource/csdk/stack/include/ocpresence.h %{DEST_INC_DIR}
 cp resource/csdk/stack/include/ocpayload.h %{DEST_INC_DIR}
 cp resource/c_common/platform_features.h %{DEST_INC_DIR}
+cp resource/c_common/iotivity_config.h %{DEST_INC_DIR}
 cp resource/c_common/*/include/*.h %{DEST_INC_DIR}
 cp resource/csdk/stack/include/payload_logging.h %{DEST_INC_DIR}
 cp resource/csdk/stack/include/rdpayload.h %{DEST_INC_DIR}
index cc2bfb4..42100d6 100644 (file)
@@ -18,7 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-
+#include "iotivity_config.h"
 #include "occlientcb.h"
 #include "utlist.h"
 #include "logger.h"
index 3af571e..80e9e06 100644 (file)
@@ -21,6 +21,7 @@
 // Required for strok_r
 #define _POSIX_C_SOURCE 200112L
 
+#include "iotivity_config.h"
 #include <stdio.h>
 #include "ocpayload.h"
 #include "octypes.h"
index e5323e6..860b27a 100755 (executable)
@@ -29,6 +29,7 @@
 #define _GNU_SOURCE
 #endif
 
+#include "iotivity_config.h"
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
index 13d595b..f11501c 100644 (file)
@@ -36,6 +36,7 @@
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS
 #endif
+#include "iotivity_config.h"
 #include <inttypes.h>
 #include <string.h>
 #include <ctype.h>
@@ -57,7 +58,6 @@
 #include "cainterface.h"
 #include "ocpayload.h"
 #include "ocpayloadcbor.h"
-#include "platform_features.h"
 
 #if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
 #include "routingutility.h"
index 558f683..a2968cd 100755 (executable)
@@ -20,6 +20,8 @@
 
 #define _POSIX_C_SOURCE 200112L
 
+#include "iotivity_config.h"
+
 #include <string.h>
 
 #include "oicgroup.h"
@@ -32,8 +34,6 @@
 #include "logger.h"
 #include "timer.h"
 
-#include "platform_features.h"
-
 #define TAG "OIC_RI_GROUP"
 
 #define DESC_DELIMITER          "\""
index 4a60a77..8920bde 100644 (file)
@@ -17,6 +17,7 @@
 // limitations under the License.
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include "iotivity_config.h"
 #include "oicresourcedirectory.h"
 
 #include "rdpayload.h"
index 6368e93..1ce1e6b 100644 (file)
@@ -23,6 +23,7 @@
 /// This sample provides steps to define an interface for a resource
 /// (properties and methods) and host this resource on the server.
 ///
+#include "iotivity_config.h"
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
index 5bb8b06..228e6af 100644 (file)
 /// (properties and methods) and host this resource on the server.
 ///
 
+#include "iotivity_config.h"
 #include <functional>
 
+#ifdef HAVE_PTHREAD_H
 #include <pthread.h>
+#endif
 #include <array>
 #include <mutex>
 #include <condition_variable>
@@ -36,7 +39,6 @@
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
-#include "platform_features.h"
 
 using namespace OC;
 using namespace std;
index f9452af..a2997bc 100644 (file)
@@ -20,6 +20,7 @@
 
 // OCClient.cpp : Defines the entry point for the console application.
 //
+#include "iotivity_config.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
index be585fc..6d631d3 100644 (file)
 
 // OCClient.cpp : Defines the entry point for the console application.
 //
+#include "iotivity_config.h"
+
 #include <set>
 #include <string>
 #include <cstdlib>
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
 #include <mutex>
 #include <condition_variable>
 #include "OCPlatform.h"
 #include "OCApi.h"
 
+#if defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
 #if defined(HAVE_WINDOWS_H)
 #include <windows.h>
 #endif
-#include "platform_features.h"
 
 using namespace OC;
 
index 13981cb..b005900 100644 (file)
@@ -22,8 +22,9 @@
 /// This sample provides steps to define an interface for a resource
 /// (properties and methods) and host this resource on the server.
 ///
-#include <functional>
+#include "iotivity_config.h"
 
+#include <functional>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -38,7 +39,6 @@
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
-#include "platform_features.h"
 
 using namespace OC;
 using namespace std;
index 3adef4e..6d641e7 100644 (file)
@@ -23,6 +23,7 @@
 /// (properties and methods) and host this resource on the server.
 ///
 
+#include "iotivity_config.h"
 #include <functional>
 
 #ifdef HAVE_PTHREAD_H
@@ -37,7 +38,6 @@
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
-#include "platform_features.h"
 
 using namespace OC;
 using namespace std;
index 1eaaeba..46cfbec 100644 (file)
@@ -23,6 +23,7 @@
 /// server in a separate thread, and running 2 clients in each thread.
 ///
 
+#include "iotivity_config.h"
 
 #include <memory>
 #include <iostream>
@@ -37,7 +38,6 @@
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
-#include "platform_features.h"
 
 using namespace OC;
 
index b83061f..9fd3d5b 100644 (file)
@@ -18,6 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+#include "iotivity_config.h"
 #include "OCResource.h"
 #include "OCUtilities.h"