Fossil SCM
The previous checkin on this branch prevented src/smtp.c from both building and linking because the code previously assumed that it could only build against libresolv for MX lookups and such on Linux, but the checkin gave it enough slack to *attempt* to build on macOS. This checkin prevents that from happening if run on stock macOS, but if you install libbind via Homebrew, it also opens up the possibilty to biuld against it for the first time. It's a complicated sequence of checks due to the way libbind interacts with the stock libresolv. This means we have yet more reason to want to test this widely before merging it to trunk.
Commit
4d9970f618cd1598d7439aff08f9ad592bd69436c3b6ed77f220e711cd27dc59
Parent
ed3b1e4d89b963f…
2 files changed
+11
-1
+12
-6
M
auto.def
+11
-1
| --- auto.def | ||
| +++ auto.def | ||
| @@ -513,15 +513,25 @@ | ||
| 513 | 513 | # Last resort, may be Windows |
| 514 | 514 | if {[is_mingw]} { |
| 515 | 515 | define-append LIBS -lwsock32 |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | + | |
| 519 | +# The SMTP module requires special libraries and headers for MX DNS | |
| 520 | +# record lookups and such. | |
| 521 | +cc-check-includes arpa/nameser.h | |
| 522 | +cc-include-needs bind/resolv.h netinet/in.h | |
| 523 | +cc-check-includes bind/resolv.h | |
| 524 | +cc-check-includes resolv.h | |
| 518 | 525 | if { ![cc-check-function-in-lib ns_name_uncompress {resolv bind}] && |
| 519 | 526 | ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} { |
| 520 | - user-error "We need either libresolv or libbind for res_query() and ns_*()." | |
| 527 | + msg-result "WARNING: SMTP feature will not be able to look up local MX." | |
| 521 | 528 | } |
| 522 | 529 | cc-check-function-in-lib res_query resolv |
| 530 | +cc-check-function-in-lib res_9_ns_initparse resolv | |
| 531 | + | |
| 532 | +# Other nonstandard function checks | |
| 523 | 533 | cc-check-functions utime |
| 524 | 534 | cc-check-functions usleep |
| 525 | 535 | cc-check-functions strchrnul |
| 526 | 536 | cc-check-functions pledge |
| 527 | 537 | cc-check-functions backtrace |
| 528 | 538 |
| --- auto.def | |
| +++ auto.def | |
| @@ -513,15 +513,25 @@ | |
| 513 | # Last resort, may be Windows |
| 514 | if {[is_mingw]} { |
| 515 | define-append LIBS -lwsock32 |
| 516 | } |
| 517 | } |
| 518 | if { ![cc-check-function-in-lib ns_name_uncompress {resolv bind}] && |
| 519 | ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} { |
| 520 | user-error "We need either libresolv or libbind for res_query() and ns_*()." |
| 521 | } |
| 522 | cc-check-function-in-lib res_query resolv |
| 523 | cc-check-functions utime |
| 524 | cc-check-functions usleep |
| 525 | cc-check-functions strchrnul |
| 526 | cc-check-functions pledge |
| 527 | cc-check-functions backtrace |
| 528 |
| --- auto.def | |
| +++ auto.def | |
| @@ -513,15 +513,25 @@ | |
| 513 | # Last resort, may be Windows |
| 514 | if {[is_mingw]} { |
| 515 | define-append LIBS -lwsock32 |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | # The SMTP module requires special libraries and headers for MX DNS |
| 520 | # record lookups and such. |
| 521 | cc-check-includes arpa/nameser.h |
| 522 | cc-include-needs bind/resolv.h netinet/in.h |
| 523 | cc-check-includes bind/resolv.h |
| 524 | cc-check-includes resolv.h |
| 525 | if { ![cc-check-function-in-lib ns_name_uncompress {resolv bind}] && |
| 526 | ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} { |
| 527 | msg-result "WARNING: SMTP feature will not be able to look up local MX." |
| 528 | } |
| 529 | cc-check-function-in-lib res_query resolv |
| 530 | cc-check-function-in-lib res_9_ns_initparse resolv |
| 531 | |
| 532 | # Other nonstandard function checks |
| 533 | cc-check-functions utime |
| 534 | cc-check-functions usleep |
| 535 | cc-check-functions strchrnul |
| 536 | cc-check-functions pledge |
| 537 | cc-check-functions backtrace |
| 538 |
+12
-6
| --- src/smtp.c | ||
| +++ src/smtp.c | ||
| @@ -19,25 +19,31 @@ | ||
| 19 | 19 | ** to RFC 5321. |
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "smtp.h" |
| 23 | 23 | #include <assert.h> |
| 24 | -#if defined(__linux__) && !defined(FOSSIL_OMIT_DNS) | |
| 24 | +#if HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \ | |
| 25 | + (defined(__linux__) && !defined(FOSSIL_OMIT_DNS)) | |
| 25 | 26 | # include <sys/types.h> |
| 26 | 27 | # include <netinet/in.h> |
| 27 | -# include <arpa/nameser.h> | |
| 28 | -# include <resolv.h> | |
| 28 | +# if defined(HAVE_BIND_RESOLV_H) | |
| 29 | +# include <bind/resolv.h> | |
| 30 | +# include <bind/arpa/nameser_compat.h> | |
| 31 | +# else | |
| 32 | +# include <arpa/nameser.h> | |
| 33 | +# include <resolv.h> | |
| 34 | +# endif | |
| 35 | +# if !defined(ns_name_uncompress) | |
| 36 | +# define ns_name_uncompress __ns_name_uncompress | |
| 37 | +# endif | |
| 29 | 38 | # define FOSSIL_UNIX_STYLE_DNS 1 |
| 30 | 39 | #endif |
| 31 | 40 | #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) |
| 32 | 41 | # include <windows.h> |
| 33 | 42 | # include <windns.h> |
| 34 | 43 | # define FOSSIL_WINDOWS_STYLE_DNS 1 |
| 35 | 44 | #endif |
| 36 | -#ifdef HAVE___NS_NAME_UNCOMPRESS | |
| 37 | -# define ns_name_uncompress __ns_name_uncompress | |
| 38 | -#endif | |
| 39 | 45 | |
| 40 | 46 | |
| 41 | 47 | /* |
| 42 | 48 | ** Find the hostname for receiving email for the domain given |
| 43 | 49 | ** in zDomain. Return NULL if not found or not implemented. |
| 44 | 50 |
| --- src/smtp.c | |
| +++ src/smtp.c | |
| @@ -19,25 +19,31 @@ | |
| 19 | ** to RFC 5321. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "smtp.h" |
| 23 | #include <assert.h> |
| 24 | #if defined(__linux__) && !defined(FOSSIL_OMIT_DNS) |
| 25 | # include <sys/types.h> |
| 26 | # include <netinet/in.h> |
| 27 | # include <arpa/nameser.h> |
| 28 | # include <resolv.h> |
| 29 | # define FOSSIL_UNIX_STYLE_DNS 1 |
| 30 | #endif |
| 31 | #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) |
| 32 | # include <windows.h> |
| 33 | # include <windns.h> |
| 34 | # define FOSSIL_WINDOWS_STYLE_DNS 1 |
| 35 | #endif |
| 36 | #ifdef HAVE___NS_NAME_UNCOMPRESS |
| 37 | # define ns_name_uncompress __ns_name_uncompress |
| 38 | #endif |
| 39 | |
| 40 | |
| 41 | /* |
| 42 | ** Find the hostname for receiving email for the domain given |
| 43 | ** in zDomain. Return NULL if not found or not implemented. |
| 44 |
| --- src/smtp.c | |
| +++ src/smtp.c | |
| @@ -19,25 +19,31 @@ | |
| 19 | ** to RFC 5321. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "smtp.h" |
| 23 | #include <assert.h> |
| 24 | #if HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \ |
| 25 | (defined(__linux__) && !defined(FOSSIL_OMIT_DNS)) |
| 26 | # include <sys/types.h> |
| 27 | # include <netinet/in.h> |
| 28 | # if defined(HAVE_BIND_RESOLV_H) |
| 29 | # include <bind/resolv.h> |
| 30 | # include <bind/arpa/nameser_compat.h> |
| 31 | # else |
| 32 | # include <arpa/nameser.h> |
| 33 | # include <resolv.h> |
| 34 | # endif |
| 35 | # if !defined(ns_name_uncompress) |
| 36 | # define ns_name_uncompress __ns_name_uncompress |
| 37 | # endif |
| 38 | # define FOSSIL_UNIX_STYLE_DNS 1 |
| 39 | #endif |
| 40 | #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) |
| 41 | # include <windows.h> |
| 42 | # include <windns.h> |
| 43 | # define FOSSIL_WINDOWS_STYLE_DNS 1 |
| 44 | #endif |
| 45 | |
| 46 | |
| 47 | /* |
| 48 | ** Find the hostname for receiving email for the domain given |
| 49 | ** in zDomain. Return NULL if not found or not implemented. |
| 50 |