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.

wyoung 2018-09-22 06:46 libbind-ns-alternative
Commit 4d9970f618cd1598d7439aff08f9ad592bd69436c3b6ed77f220e711cd27dc59
2 files changed +11 -1 +12 -6
+11 -1
--- auto.def
+++ auto.def
@@ -513,15 +513,25 @@
513513
# Last resort, may be Windows
514514
if {[is_mingw]} {
515515
define-append LIBS -lwsock32
516516
}
517517
}
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
518525
if { ![cc-check-function-in-lib ns_name_uncompress {resolv bind}] &&
519526
![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."
521528
}
522529
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
523533
cc-check-functions utime
524534
cc-check-functions usleep
525535
cc-check-functions strchrnul
526536
cc-check-functions pledge
527537
cc-check-functions backtrace
528538
--- 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 @@
1919
** to RFC 5321.
2020
*/
2121
#include "config.h"
2222
#include "smtp.h"
2323
#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))
2526
# include <sys/types.h>
2627
# 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
2938
# define FOSSIL_UNIX_STYLE_DNS 1
3039
#endif
3140
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
3241
# include <windows.h>
3342
# include <windns.h>
3443
# define FOSSIL_WINDOWS_STYLE_DNS 1
3544
#endif
36
-#ifdef HAVE___NS_NAME_UNCOMPRESS
37
-# define ns_name_uncompress __ns_name_uncompress
38
-#endif
3945
4046
4147
/*
4248
** Find the hostname for receiving email for the domain given
4349
** in zDomain. Return NULL if not found or not implemented.
4450
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button