Fossil SCM

Merged branch libbind-ns-alternative: I haven't found any platform where this won't build. It doesn't enable libbind or use libresolv better on every platform where it might possibly work, but at the very least it avoids build errors everywhere I've tried it.

wyoung 2018-10-01 06:21 trunk merge
Commit 71c298f3ea42391638a6c96b9ab1c62bf9754881fefebed79f96fd71efa0e448
2 files changed +19 -1 +16 -5
+19 -1
--- auto.def
+++ auto.def
@@ -513,11 +513,29 @@
513513
# Last resort, may be Windows
514514
if {[is_mingw]} {
515515
define-append LIBS -lwsock32
516516
}
517517
}
518
-cc-check-function-in-lib ns_name_uncompress resolv
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 dn_expand resolv] ||
526
+ [cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
527
+ [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
528
+ ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
529
+ [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
530
+ ([cc-check-function-in-lib res_query {bind resolv}] ||
531
+ [cc-check-function-in-lib __res_query {bind resolv}]))} {
532
+ msg-result "WARNING: SMTP feature will not be able to look up local MX."
533
+}
534
+cc-check-function-in-lib res_9_ns_initparse resolv
535
+
536
+# Other nonstandard function checks
519537
cc-check-functions utime
520538
cc-check-functions usleep
521539
cc-check-functions strchrnul
522540
cc-check-functions pledge
523541
cc-check-functions backtrace
524542
--- auto.def
+++ auto.def
@@ -513,11 +513,29 @@
513 # Last resort, may be Windows
514 if {[is_mingw]} {
515 define-append LIBS -lwsock32
516 }
517 }
518 cc-check-function-in-lib ns_name_uncompress resolv
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519 cc-check-functions utime
520 cc-check-functions usleep
521 cc-check-functions strchrnul
522 cc-check-functions pledge
523 cc-check-functions backtrace
524
--- auto.def
+++ auto.def
@@ -513,11 +513,29 @@
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 dn_expand resolv] ||
526 [cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
527 [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
528 ([cc-check-function-in-lib ns_parserr {bind resolv}] ||
529 [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
530 ([cc-check-function-in-lib res_query {bind resolv}] ||
531 [cc-check-function-in-lib __res_query {bind resolv}]))} {
532 msg-result "WARNING: SMTP feature will not be able to look up local MX."
533 }
534 cc-check-function-in-lib res_9_ns_initparse resolv
535
536 # Other nonstandard function checks
537 cc-check-functions utime
538 cc-check-functions usleep
539 cc-check-functions strchrnul
540 cc-check-functions pledge
541 cc-check-functions backtrace
542
+16 -5
--- src/smtp.c
+++ src/smtp.c
@@ -19,15 +19,27 @@
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_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \
25
+ (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !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(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand)
36
+# define dn_expand ns_name_uncompress
37
+# endif
38
+# if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand)
39
+# define dn_expand __ns_name_uncompress
40
+# endif
2941
# define FOSSIL_UNIX_STYLE_DNS 1
3042
#endif
3143
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
3244
# include <windows.h>
3345
# include <windns.h>
@@ -77,12 +89,11 @@
7789
iBestPriority = priority;
7890
}
7991
}
8092
}
8193
if( pBest ){
82
- ns_name_uncompress(aDns, aDns+nDns, pBest+2,
83
- zHostname, sizeof(zHostname));
94
+ dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname));
8495
return fossil_strdup(zHostname);
8596
}
8697
return 0;
8798
#elif defined(FOSSIL_WINDOWS_STYLE_DNS)
8899
DNS_STATUS status; /* Return status */
89100
--- src/smtp.c
+++ src/smtp.c
@@ -19,15 +19,27 @@
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>
@@ -77,12 +89,11 @@
77 iBestPriority = priority;
78 }
79 }
80 }
81 if( pBest ){
82 ns_name_uncompress(aDns, aDns+nDns, pBest+2,
83 zHostname, sizeof(zHostname));
84 return fossil_strdup(zHostname);
85 }
86 return 0;
87 #elif defined(FOSSIL_WINDOWS_STYLE_DNS)
88 DNS_STATUS status; /* Return status */
89
--- src/smtp.c
+++ src/smtp.c
@@ -19,15 +19,27 @@
19 ** to RFC 5321.
20 */
21 #include "config.h"
22 #include "smtp.h"
23 #include <assert.h>
24 #if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \
25 (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !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(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand)
36 # define dn_expand ns_name_uncompress
37 # endif
38 # if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand)
39 # define dn_expand __ns_name_uncompress
40 # endif
41 # define FOSSIL_UNIX_STYLE_DNS 1
42 #endif
43 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
44 # include <windows.h>
45 # include <windns.h>
@@ -77,12 +89,11 @@
89 iBestPriority = priority;
90 }
91 }
92 }
93 if( pBest ){
94 dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname));
 
95 return fossil_strdup(zHostname);
96 }
97 return 0;
98 #elif defined(FOSSIL_WINDOWS_STYLE_DNS)
99 DNS_STATUS status; /* Return status */
100

Keyboard Shortcuts

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