You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2023/02/04 23:03:02 UTC

[logging-log4cxx] branch opt-in-odbc-smtp created (now efc2ec8e)

This is an automated email from the ASF dual-hosted git repository.

rmiddleton pushed a change to branch opt-in-odbc-smtp
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at efc2ec8e Make ODBC and SMTP opt-in

This branch includes the following new commits:

     new efc2ec8e Make ODBC and SMTP opt-in

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[logging-log4cxx] 01/01: Make ODBC and SMTP opt-in

Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rmiddleton pushed a commit to branch opt-in-odbc-smtp
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit efc2ec8e91fe4f0fc28c044e57593194b776bf52
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sat Feb 4 17:59:26 2023 -0500

    Make ODBC and SMTP opt-in
    
    See #189
---
 src/main/include/CMakeLists.txt | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index 205041da..4b142fdc 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -106,22 +106,42 @@ include(CheckIncludeFiles)
 include(CheckIncludeFileCXX)
 include(CheckLibraryExists)
 
-if(WIN32)
-	CHECK_INCLUDE_FILES(sqlext.h HAS_ODBC)
+option(LOG4CXX_ENABLE_ODBC "Support logging via ODBC" OFF)
+if(LOG4CXX_ENABLE_ODBC)
+    if(WIN32)
+            CHECK_INCLUDE_FILES(sqlext.h HAS_ODBC)
+    else()
+            include(FindPkgConfig)
+
+            pkg_check_modules( odbc odbc )
+            if(${odbc_FOUND})
+                    set(HAS_ODBC 1)
+            else()
+                    set(HAS_ODBC 0)
+            endif(${odbc_FOUND})
+    endif(WIN32)
+
+    if(NOT ${HAS_ODBC})
+        message(SEND_ERROR "ODBC not found but requested")
+    endif()
 else()
-	include(FindPkgConfig)
+    set(HAS_ODBC 0)
+endif(LOG4CXX_ENABLE_ODBC)
 
-	pkg_check_modules( odbc QUIET odbc )
-	if(${odbc_FOUND})
-		set(HAS_ODBC 1)
-	endif(${odbc_FOUND})
-endif(WIN32)
+option(LOG4CXX_ENABLE_ESMTP "Support logging via libesmtp" OFF)
+if(LOG4CXX_ENABLE_ESMTP)
+    CHECK_LIBRARY_EXISTS(esmtp smtp_create_session "" HAS_LIBESMTP)
+    if(NOT HAS_LIBESMTP)
+        message(SEND_ERROR "SMTP support with libesmtp not found but requested")
+    endif()
+else()
+    set(HAS_LIBESMTP 0)
+endif(LOG4CXX_ENABLE_ESMTP)
 
 CHECK_INCLUDE_FILE_CXX(locale HAS_STD_LOCALE)
 CHECK_FUNCTION_EXISTS(mbsrtowcs HAS_MBSRTOWCS)
 CHECK_FUNCTION_EXISTS(wcstombs HAS_WCSTOMBS)
 CHECK_FUNCTION_EXISTS(fwide HAS_FWIDE)
-CHECK_LIBRARY_EXISTS(esmtp smtp_create_session "" HAS_LIBESMTP)
 CHECK_FUNCTION_EXISTS(syslog HAS_SYSLOG)
 if(UNIX)
     set(CMAKE_REQUIRED_LIBRARIES "pthread")