[evolution] Search for Bogofilter/SpamAssassin binaries during configure time



commit ebe91d4d5db020c16f28dca1e6bde7a9292abeb5
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 3 23:36:31 2019 +0200

    Search for Bogofilter/SpamAssassin binaries during configure time
    
    When the path is not given in the cmake arguments, neither an environment
    variable is set, then search for the respective binaries first and only
    if neither then could be found, then fallback to expected hard-coded path.

 CMakeLists.txt | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b52d7858c..2339e4f1e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -489,7 +489,11 @@ if(WITH_BOGOFILTER)
                set(BOGOFILTER_COMMAND "$ENV{BOGOFILTER}")
        endif(BOGOFILTER_COMMAND STREQUAL "")
        if(BOGOFILTER_COMMAND STREQUAL "")
-               set(BOGOFILTER_COMMAND "/usr/bin/bogofilter")
+               unset(BOGOFILTER_COMMAND)
+               find_program(BOGOFILTER_COMMAND bogofilter)
+               if(NOT BOGOFILTER_COMMAND)
+                       set(BOGOFILTER_COMMAND "/usr/bin/bogofilter")
+               endif(NOT BOGOFILTER_COMMAND)
        endif(BOGOFILTER_COMMAND STREQUAL "")
 endif(WITH_BOGOFILTER)
 
@@ -529,7 +533,11 @@ if(WITH_SPAMASSASSIN)
                set(SPAMASSASSIN_COMMAND "$ENV{SPAMASSASSIN}")
        endif(SPAMASSASSIN_COMMAND STREQUAL "")
        if(SPAMASSASSIN_COMMAND STREQUAL "")
-               set(SPAMASSASSIN_COMMAND "/usr/bin/spamassassin")
+               unset(SPAMASSASSIN_COMMAND)
+               find_program(SPAMASSASSIN_COMMAND spamassassin)
+               if(NOT SPAMASSASSIN_COMMAND)
+                       set(SPAMASSASSIN_COMMAND "/usr/bin/spamassassin")
+               endif(NOT SPAMASSASSIN_COMMAND)
        endif(SPAMASSASSIN_COMMAND STREQUAL "")
 
        string(LENGTH "${WITH_SA_LEARN}" maxlen)
@@ -554,7 +562,11 @@ if(WITH_SPAMASSASSIN)
                set(SA_LEARN_COMMAND "$ENV{SA_LEARN}")
        endif(SA_LEARN_COMMAND STREQUAL "")
        if(SA_LEARN_COMMAND STREQUAL "")
-               set(SA_LEARN_COMMAND "/usr/bin/sa-learn")
+               unset(SA_LEARN_COMMAND)
+               find_program(SA_LEARN_COMMAND sa-learn)
+               if(NOT SA_LEARN_COMMAND)
+                       set(SA_LEARN_COMMAND "/usr/bin/sa-learn")
+               endif(NOT SA_LEARN_COMMAND)
        endif(SA_LEARN_COMMAND STREQUAL "")
 endif(WITH_SPAMASSASSIN)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]