Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure.ac: configure script does not detect res_ninit correctly if resolv.h requires some other header files #203

Open
futatuki opened this issue Mar 8, 2024 · 0 comments

Comments

@futatuki
Copy link

futatuki commented Mar 8, 2024

On FreeBSD 14.0, after ./configure, ./config.log shows:

...
configure:14284: checking for library containing res_ninit
configure:14310: cc -o conftest -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing    -Wl,-rpath,/usr/local/lib -fstack-protector-strong  conftest.c  >&5
In file included from conftest.c:29:
/usr/include/resolv.h:158:14: error: array has incomplete element type 'struct sockaddr_in'
                nsaddr_list[MAXNS];     /*%< address of name server */
                           ^
/usr/include/resolv.h:157:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
/usr/include/resolv.h:172:18: error: field has incomplete type 'struct in_addr'
                struct in_addr  addr;
                                ^
/usr/include/resolv.h:172:10: note: forward declaration of 'struct in_addr'
                struct in_addr  addr;
                       ^
/usr/include/resolv.h:197:21: error: field has incomplete type 'struct sockaddr_in'
        struct sockaddr_in      sin;
                                ^
/usr/include/resolv.h:157:9: note: forward declaration of 'struct sockaddr_in'
        struct sockaddr_in
               ^
3 errors generated.
configure:14310: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "OpenDKIM"
| #define PACKAGE_TARNAME "opendkim"
| #define PACKAGE_VERSION "2.11.0"
| #define PACKAGE_STRING "OpenDKIM 2.11.0"
| #define PACKAGE_BUGREPORT "bugs@opendkim.org"
| #define PACKAGE_URL ""
| #define PACKAGE "opendkim"
| #define VERSION "2.11.0"
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_TIME_H 1
| #define STDC_HEADERS 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_PTHREAD_PRIO_INHERIT 1
| #define HAVE_PTHREAD 1
| #define HAVE_INET_PTON 1
| #define HAVE_INET_NTOP 1
| #define HAVE_GETADDRINFO 1
| /* end confdefs.h.  */
| #include <resolv.h>
| int
| main (void)
| {
| return res_ninit(NULL);
|   ;
|   return 0;
| }
...
configure:14465: checking for sys/types.h
configure:14465: result: yes
configure:14483: checking for netinet/in.h
configure:14483: result: yes
configure:14501: checking for arpa/nameser.h
configure:14501: result: yes
configure:14519: checking for netdb.h
configure:14519: result: yes
configure:14537: checking for resolv.h
configure:14537: result: yes
...

This is caused by the configure.ac line 110-113 where use resolv.h in check for res_ninit before checking headers required by resolv.h.

With glibc, resolv.h itself contains all declarations for the function, so it is not affected. However in all other platform which requires some other headers for using resolv.h but has res_ninit() function, the check would be failed.

Note: In FreeBSD, res_setservers() is also in libc as __res_setservers and res_setservers is a macro in resolv.h. So it is need the same technique in the case of res_ninit if we want to detect it. However there are PR #99 and issue #199 mentioned about res_setservers, so I don't think we don't need to fix in the case res_setservers.

@futatuki futatuki changed the title configure.ac: configure script does not detect res_ninit correctly if resolv.h requires some other headerfiles configure.ac: configure script does not detect res_ninit correctly if resolv.h requires some other header files Mar 8, 2024
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Mar 8, 2024
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Mar 8, 2024
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Mar 9, 2024
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Mar 9, 2024
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Mar 11, 2024
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Mar 11, 2024
PR trusteddomainproject#171, trusteddomainproject#192, and trusteddomainproject#203 contains changes in configure.ac, however
they were not always reflect their changes into configure.

So rebuild it here.
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Apr 26, 2024
…ix-configure.ac

Fix issue trusteddomainproject#203: configure.ac: Properly include headers
needed by resolve.h before use it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant