Changeset: 41d541e800c0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41d541e800c0
Modified Files:
        CMakeLists.txt
        clients/odbc/driver/SQLBrowseConnect.c
        clients/odbc/driver/SQLConnect.c
        common/utils/msabaoth.h
        monetdb_config.h.in
Branch: cmake-fun
Log Message:

Simplify ODBC driver compilation and FreeBSD compilation fix.


diffs (155 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -775,10 +775,8 @@ set(ENABLE_ODBC "AUTO" CACHE STRING "Com
 if(NOT ${ENABLE_ODBC} STREQUAL "NO")
        find_path(ODBCINST_INCLUDE odbcinst.h)
        if(ODBCINST_INCLUDE)
-               set(HAVE_ODBCINST_H ON)
                set(ODBC_INCLUDE_DIR "${ODBCINST_INCLUDE}")
                if(MSVC)
-                       set(HAVE_SQLGETPRIVATEPROFILESTRING ON)
                        if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Windows 64 bit
                                set(LENP_OR_POINTER_T "SQLLEN *")
                        else()
@@ -787,7 +785,7 @@ if(NOT ${ENABLE_ODBC} STREQUAL "NO")
 
                        find_library(ODBCCP32_LIBRARY odbccp32)
                        if(ODBCCP32_LIBRARY)
-                               set(ODBCINST_LIBRARIES 
"${ODBCINST_LIBRARIES};odbccp32")
+                               set(ODBCINST_LIBRARIES 
"${ODBCINST_LIBRARIES};${ODBCCP32_LIBRARY}")
                        endif()
                        find_library(USER32_LIBRARY NAMES user32 User32)
                        if(USER32_LIBRARY)
@@ -795,11 +793,11 @@ if(NOT ${ENABLE_ODBC} STREQUAL "NO")
                        endif()
                        find_library(LEGACY_STDIO_LIBRARY 
legacy_stdio_definitions)
                        if(LEGACY_STDIO_LIBRARY)
-                               set(ODBCINST_LIBRARIES 
"${ODBCINST_LIBRARIES};legacy_stdio_definitions")
+                               set(ODBCINST_LIBRARIES 
"${ODBCINST_LIBRARIES};${LEGACY_STDIO_LIBRARY}")
                        endif()
                        find_library(ODBC32_LIBRARY odbc32)
                        if(ODBC32_LIBRARY)
-                               set(ODBC_LIBRARIES odbc32)
+                               set(ODBC_LIBRARIES "${ODBC32_LIBRARY}")
                        endif()
 
                        if(ODBCCP32_LIBRARY AND USER32_LIBRARY AND 
LEGACY_STDIO_LIBRARY AND ODBC32_LIBRARY)
@@ -815,33 +813,11 @@ if(NOT ${ENABLE_ODBC} STREQUAL "NO")
 
                        find_library(ODBCINST_LIBRARY odbcinst)
                        if(ODBCINST_LIBRARY)
-                               cmake_push_check_state()
-                               set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};odbcinst")
-                               
check_symbol_exists("SQLGetPrivateProfileString" "odbcinst.h" 
HAVE_SQLGETPRIVATEPROFILESTRING)
-                               cmake_pop_check_state()
-                               if(HAVE_SQLGETPRIVATEPROFILESTRING)
-                                       set(ODBCINST_LIBRARIES 
"${ODBCINST_LIBRARY}")
-                                       set(HAVE_SQLGETPRIVATEPROFILESTRING ON)
-                               elseif(${ENABLE_ODBC} STREQUAL "YES")
-                                       message(FATAL_ERROR "odbcinst library 
not found")
-                               else()
-                                       message(STATUS "odbcinst library not 
found")
-                               endif()
+                               set(ODBCINST_LIBRARIES "${ODBCINST_LIBRARY}")
                        endif()
-
                        find_library(ODBC_LIBRARY odbc)
                        if(ODBC_LIBRARY)
-                               cmake_push_check_state()
-                               set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};odbc")
-                               check_symbol_exists("SQLGetDiagRec" 
"odbcinst.h" HAVE_SQLGETDIAGREC)
-                               cmake_pop_check_state()
-                               if(HAVE_SQLGETDIAGREC)
-                                       set(ODBC_LIBRARIES "${ODBC_LIBRARY}")
-                               elseif(${ENABLE_ODBC} STREQUAL "YES")
-                                       message(FATAL_ERROR "odbc library not 
found")
-                               else()
-                                       message(STATUS "odbc library not found")
-                               endif()
+                               set(ODBC_LIBRARIES "${ODBC_LIBRARY}")
                        endif()
 
                        message(STATUS "Checking SQLColAttribute uses SQLLEN * 
or SQLPOINTER")
@@ -870,7 +846,7 @@ if(NOT ${ENABLE_ODBC} STREQUAL "NO")
                        check_type_size(SQLWCHAR SIZEOF_SQLWCHAR LANGUAGE C)
                        cmake_pop_check_state()
 
-                       if(ODBCINST_LIBRARY AND ODBC_LIBRARY)
+                       if(ODBCINST_LIBRARY AND ODBC_LIBRARY AND 
HAVE_SIZEOF_SQLWCHAR)
                                set(HAVE_ODBC YES)
                        elseif(${ENABLE_ODBC} STREQUAL "YES")
                                message(FATAL_ERROR "There are unixODBC 
libraries missing")
diff --git a/clients/odbc/driver/SQLBrowseConnect.c 
b/clients/odbc/driver/SQLBrowseConnect.c
--- a/clients/odbc/driver/SQLBrowseConnect.c
+++ b/clients/odbc/driver/SQLBrowseConnect.c
@@ -32,14 +32,7 @@
 #include <strings.h>           /* strcasecmp */
 #endif
 
-#ifdef HAVE_ODBCINST_H
 #include <odbcinst.h>
-#endif
-
-#ifndef HAVE_SQLGETPRIVATEPROFILESTRING
-#define 
SQLGetPrivateProfileString(section,entry,default,buffer,bufferlen,filename)    
(strncpy(buffer,default,bufferlen), buffer[bufferlen-1]=0, strlen(buffer))
-#endif
-
 
 static SQLRETURN
 MNDBBrowseConnect(ODBCDbc *dbc,
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -30,13 +30,7 @@
 #include "ODBCUtil.h"
 #include <time.h>
 
-#ifdef HAVE_ODBCINST_H
 #include <odbcinst.h>
-#endif
-
-#ifndef HAVE_SQLGETPRIVATEPROFILESTRING
-#define 
SQLGetPrivateProfileString(section,entry,default,buffer,bufferlen,filename)    
(strncpy(buffer,default,bufferlen), buffer[bufferlen-1]=0, strlen(buffer))
-#endif
 
 static void
 set_timezone(Mapi mid)
diff --git a/common/utils/msabaoth.h b/common/utils/msabaoth.h
--- a/common/utils/msabaoth.h
+++ b/common/utils/msabaoth.h
@@ -9,6 +9,8 @@
 #ifndef _SEEN_SABAOTH_H
 #define _SEEN_SABAOTH_H 1
 
+#include <time.h>  /* for time_t */
+
 typedef struct Ssablist {
        char *val;               /* list value */
        struct Ssablist* next;   /* pointer to the next available value*/
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -256,9 +256,6 @@
 /* Define to 1 if you have the `nl_langinfo' function. */
 #cmakedefine HAVE_NL_LANGINFO 1
 
-/* Define to 1 if you have the <odbcinst.h> header file. */
-#cmakedefine HAVE_ODBCINST_H 1
-
 /* Define to 1 if you have the OpenSSL library */
 #cmakedefine HAVE_OPENSSL 1
 
@@ -319,12 +316,6 @@
 /* Define to 1 if you have the `SHA512_Update' function. */
 #cmakedefine HAVE_SHA512_UPDATE 1
 
-/* Define to 1 if you have the `sigaction' function. */
-#cmakedefine HAVE_SIGACTION 1
-
-/* Define to 1 if you have the SQLGetPrivateProfileString function */
-#cmakedefine HAVE_SQLGETPRIVATEPROFILESTRING 1
-
 /* Define to 1 if you have the <stdatomic.h> header file */
 #cmakedefine HAVE_STDATOMIC_H 1
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to