Fossil

Check-in [4d9970f6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | libbind-ns-alternative
Files: files | file ages | folders
SHA3-256: 4d9970f618cd1598d7439aff08f9ad592bd69436c3b6ed77f220e711cd27dc59
User & Date: wyoung 2018-09-22 06:46:45.885
Context
2018-09-22
06:57
Fix to previous for CentOS 7. ... (check-in: c7640b38 user: tangent tags: libbind-ns-alternative)
06:46
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. ... (check-in: 4d9970f6 user: wyoung tags: libbind-ns-alternative)
05:47
Added autosetup checks for alternative libraries and names for the res_query() and ns_*() functions that module smtp.c previously depended on finding in libresolv/glibc. Checking it in on a branch because it needs multiplatform testing. This version solves the problem originally reported on the forum by Andy Goth, being that the current trunk doesn't build on CentOS 5. ... (check-in: ed3b1e4d user: wyoung tags: libbind-ns-alternative)
Changes
Unified Diff Ignore Whitespace Patch
Changes to auto.def.
511
512
513
514
515
516
517







518
519
520

521
522



523
524
525
526
527
528
529
cc-check-function-in-lib gethostbyname nsl
if {![cc-check-function-in-lib socket {socket network}]} {
    # Last resort, may be Windows
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
}







if {    ![cc-check-function-in-lib   ns_name_uncompress {resolv bind}] &&
        ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} {
	user-error "We need either libresolv or libbind for res_query() and ns_*()."

}
cc-check-function-in-lib res_query resolv



cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul
cc-check-functions pledge
cc-check-functions backtrace

# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE







>
>
>
>
>
>
>


<
>


>
>
>







511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526

527
528
529
530
531
532
533
534
535
536
537
538
539
cc-check-function-in-lib gethostbyname nsl
if {![cc-check-function-in-lib socket {socket network}]} {
    # Last resort, may be Windows
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
}

# The SMTP module requires special libraries and headers for MX DNS
# record lookups and such.
cc-check-includes arpa/nameser.h
cc-include-needs bind/resolv.h netinet/in.h
cc-check-includes bind/resolv.h
cc-check-includes resolv.h
if {    ![cc-check-function-in-lib   ns_name_uncompress {resolv bind}] &&
        ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} {

    msg-result "WARNING: SMTP feature will not be able to look up local MX."
}
cc-check-function-in-lib res_query resolv
cc-check-function-in-lib res_9_ns_initparse resolv

# Other nonstandard function checks
cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul
cc-check-functions pledge
cc-check-functions backtrace

# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
Changes to src/smtp.c.
17
18
19
20
21
22
23

24
25
26




27
28




29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
**
** Implementation of SMTP (Simple Mail Transport Protocol) according
** to RFC 5321.
*/
#include "config.h"
#include "smtp.h"
#include <assert.h>

#if defined(__linux__) && !defined(FOSSIL_OMIT_DNS)
#  include <sys/types.h>
#  include <netinet/in.h>




#  include <arpa/nameser.h>
#  include <resolv.h>




#  define FOSSIL_UNIX_STYLE_DNS 1
#endif
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
#  include <windows.h>
#  include <windns.h>
#  define FOSSIL_WINDOWS_STYLE_DNS 1
#endif
#ifdef HAVE___NS_NAME_UNCOMPRESS
#  define ns_name_uncompress __ns_name_uncompress
#endif


/*
** Find the hostname for receiving email for the domain given
** in zDomain.  Return NULL if not found or not implemented.
** If multiple email receivers are advertized, pick the one with
** the lowest preference number.







>
|


>
>
>
>
|
|
>
>
>
>







<
<
<







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44



45
46
47
48
49
50
51
**
** Implementation of SMTP (Simple Mail Transport Protocol) according
** to RFC 5321.
*/
#include "config.h"
#include "smtp.h"
#include <assert.h>
#if HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \
    (defined(__linux__) && !defined(FOSSIL_OMIT_DNS))
#  include <sys/types.h>
#  include <netinet/in.h>
#  if defined(HAVE_BIND_RESOLV_H)
#    include <bind/resolv.h>
#    include <bind/arpa/nameser_compat.h>
#  else
#    include <arpa/nameser.h>
#    include <resolv.h>
#  endif
#  if !defined(ns_name_uncompress)
#    define ns_name_uncompress __ns_name_uncompress
#  endif
#  define FOSSIL_UNIX_STYLE_DNS 1
#endif
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
#  include <windows.h>
#  include <windns.h>
#  define FOSSIL_WINDOWS_STYLE_DNS 1
#endif





/*
** Find the hostname for receiving email for the domain given
** in zDomain.  Return NULL if not found or not implemented.
** If multiple email receivers are advertized, pick the one with
** the lowest preference number.