summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorpedro martelletto <pedro@ambientworks.net>2020-09-18 08:57:29 +0200
committerpedro martelletto <pedro@ambientworks.net>2020-09-18 08:57:29 +0200
commitdc098405b2939146e17567a25b08fc6122893cdf (patch)
treeaf1832d49cef8474ab75e69375f021e9115abb9c /configure.ac
parentb3855ff053f5078ec3d3c653cdaedefaa5fc362d (diff)
configure.ac: add missing includes
when testing, make sure to include the relevant header files that declare the types of the functions used by the test: - stdio.h for printf(); - stdlib.h for exit(); - string.h for strcmp(); - unistd.h for unlink(), _exit(), fork(), getppid(), sleep().
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac61
1 files changed, 51 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 28947a660..7005a503e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -653,7 +653,9 @@ case "$host" in
653*-*-darwin*) 653*-*-darwin*)
654 use_pie=auto 654 use_pie=auto
655 AC_MSG_CHECKING([if we have working getaddrinfo]) 655 AC_MSG_CHECKING([if we have working getaddrinfo])
656 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h> 656 AC_RUN_IFELSE([AC_LANG_SOURCE([[
657#include <mach-o/dyld.h>
658#include <stdlib.h>
657main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) 659main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
658 exit(0); 660 exit(0);
659 else 661 else
@@ -1241,7 +1243,7 @@ EOD
1241esac 1243esac
1242 1244
1243AC_MSG_CHECKING([compiler and flags for sanity]) 1245AC_MSG_CHECKING([compiler and flags for sanity])
1244AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])], 1246AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h> ]], [[ exit(0); ]])],
1245 [ AC_MSG_RESULT([yes]) ], 1247 [ AC_MSG_RESULT([yes]) ],
1246 [ 1248 [
1247 AC_MSG_RESULT([no]) 1249 AC_MSG_RESULT([no])
@@ -1265,6 +1267,7 @@ AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1265 [AC_LANG_SOURCE([[ 1267 [AC_LANG_SOURCE([[
1266#include <libgen.h> 1268#include <libgen.h>
1267#include <string.h> 1269#include <string.h>
1270#include <stdlib.h>
1268 1271
1269int main(int argc, char **argv) { 1272int main(int argc, char **argv) {
1270 char *s, buf[32]; 1273 char *s, buf[32];
@@ -1516,7 +1519,9 @@ AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1516AC_RUN_IFELSE( 1519AC_RUN_IFELSE(
1517 [AC_LANG_PROGRAM([[ 1520 [AC_LANG_PROGRAM([[
1518#include <sys/types.h> 1521#include <sys/types.h>
1519#include <dirent.h>]], 1522#include <dirent.h>
1523#include <stdlib.h>
1524 ]],
1520 [[ 1525 [[
1521 struct dirent d; 1526 struct dirent d;
1522 exit(sizeof(d.d_name)<=sizeof(char)); 1527 exit(sizeof(d.d_name)<=sizeof(char));
@@ -1630,7 +1635,10 @@ AC_ARG_WITH([libedit],
1630 ) 1635 )
1631 AC_MSG_CHECKING([if libedit version is compatible]) 1636 AC_MSG_CHECKING([if libedit version is compatible])
1632 AC_COMPILE_IFELSE( 1637 AC_COMPILE_IFELSE(
1633 [AC_LANG_PROGRAM([[ #include <histedit.h> ]], 1638 [AC_LANG_PROGRAM([[
1639#include <histedit.h>
1640#include <stdlib.h>
1641 ]],
1634 [[ 1642 [[
1635 int i = H_SETSIZE; 1643 int i = H_SETSIZE;
1636 el_init("", NULL, NULL, NULL); 1644 el_init("", NULL, NULL, NULL);
@@ -2120,7 +2128,11 @@ AC_CHECK_FUNCS([setresgid], [
2120 2128
2121AC_MSG_CHECKING([for working fflush(NULL)]) 2129AC_MSG_CHECKING([for working fflush(NULL)])
2122AC_RUN_IFELSE( 2130AC_RUN_IFELSE(
2123 [AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(NULL); exit(0);]])], 2131 [AC_LANG_PROGRAM([[
2132#include <stdio.h>
2133#include <stdlib.h>
2134 ]],
2135 [[fflush(NULL); exit(0);]])],
2124 AC_MSG_RESULT([yes]), 2136 AC_MSG_RESULT([yes]),
2125 [AC_MSG_RESULT([no]) 2137 [AC_MSG_RESULT([no])
2126 AC_DEFINE([FFLUSH_NULL_BUG], [1], 2138 AC_DEFINE([FFLUSH_NULL_BUG], [1],
@@ -2156,7 +2168,10 @@ AC_CHECK_FUNC([getpagesize],
2156if test "x$ac_cv_func_snprintf" = "xyes" ; then 2168if test "x$ac_cv_func_snprintf" = "xyes" ; then
2157 AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) 2169 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
2158 AC_RUN_IFELSE( 2170 AC_RUN_IFELSE(
2159 [AC_LANG_PROGRAM([[ #include <stdio.h> ]], 2171 [AC_LANG_PROGRAM([[
2172#include <stdio.h>
2173#include <stdlib.h>
2174 ]],
2160 [[ 2175 [[
2161 char b[5]; 2176 char b[5];
2162 snprintf(b,5,"123456789"); 2177 snprintf(b,5,"123456789");
@@ -2179,6 +2194,8 @@ if test "x$ac_cv_func_snprintf" = "xyes" ; then
2179 [AC_LANG_PROGRAM([[ 2194 [AC_LANG_PROGRAM([[
2180#include <sys/types.h> 2195#include <sys/types.h>
2181#include <stdio.h> 2196#include <stdio.h>
2197#include <stdlib.h>
2198#include <string.h>
2182 ]], 2199 ]],
2183 [[ 2200 [[
2184 size_t a = 1, b = 2; 2201 size_t a = 1, b = 2;
@@ -2271,6 +2288,7 @@ AC_MSG_CHECKING([for (overly) strict mkstemp])
2271AC_RUN_IFELSE( 2288AC_RUN_IFELSE(
2272 [AC_LANG_PROGRAM([[ 2289 [AC_LANG_PROGRAM([[
2273#include <stdlib.h> 2290#include <stdlib.h>
2291#include <unistd.h>
2274 ]], [[ 2292 ]], [[
2275 char template[]="conftest.mkstemp-test"; 2293 char template[]="conftest.mkstemp-test";
2276 if (mkstemp(template) == -1) 2294 if (mkstemp(template) == -1)
@@ -2298,6 +2316,8 @@ if test ! -z "$check_for_openpty_ctty_bug"; then
2298 AC_RUN_IFELSE( 2316 AC_RUN_IFELSE(
2299 [AC_LANG_PROGRAM([[ 2317 [AC_LANG_PROGRAM([[
2300#include <stdio.h> 2318#include <stdio.h>
2319#include <stdlib.h>
2320#include <unistd.h>
2301#include <sys/fcntl.h> 2321#include <sys/fcntl.h>
2302#include <sys/types.h> 2322#include <sys/types.h>
2303#include <sys/wait.h> 2323#include <sys/wait.h>
@@ -2344,6 +2364,7 @@ if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2344 AC_RUN_IFELSE( 2364 AC_RUN_IFELSE(
2345 [AC_LANG_PROGRAM([[ 2365 [AC_LANG_PROGRAM([[
2346#include <stdio.h> 2366#include <stdio.h>
2367#include <stdlib.h>
2347#include <sys/socket.h> 2368#include <sys/socket.h>
2348#include <netdb.h> 2369#include <netdb.h>
2349#include <errno.h> 2370#include <errno.h>
@@ -2412,6 +2433,7 @@ if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2412 AC_RUN_IFELSE( 2433 AC_RUN_IFELSE(
2413 [AC_LANG_PROGRAM([[ 2434 [AC_LANG_PROGRAM([[
2414#include <stdio.h> 2435#include <stdio.h>
2436#include <stdlib.h>
2415#include <sys/socket.h> 2437#include <sys/socket.h>
2416#include <netdb.h> 2438#include <netdb.h>
2417#include <errno.h> 2439#include <errno.h>
@@ -2474,7 +2496,10 @@ fi
2474 2496
2475if test "x$check_for_conflicting_getspnam" = "x1"; then 2497if test "x$check_for_conflicting_getspnam" = "x1"; then
2476 AC_MSG_CHECKING([for conflicting getspnam in shadow.h]) 2498 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2477 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]], 2499 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2500#include <shadow.h>
2501#include <stdlib.h>
2502 ]],
2478 [[ exit(0); ]])], 2503 [[ exit(0); ]])],
2479 [ 2504 [
2480 AC_MSG_RESULT([no]) 2505 AC_MSG_RESULT([no])
@@ -2504,6 +2529,7 @@ if test "x$ac_cv_func_strnvis" = "xyes"; then
2504#include <signal.h> 2529#include <signal.h>
2505#include <stdlib.h> 2530#include <stdlib.h>
2506#include <string.h> 2531#include <string.h>
2532#include <unistd.h>
2507#include <vis.h> 2533#include <vis.h>
2508static void sighandler(int sig) { _exit(1); } 2534static void sighandler(int sig) { _exit(1); }
2509 ]], [[ 2535 ]], [[
@@ -2532,6 +2558,7 @@ AC_RUN_IFELSE(
2532#include <sys/time.h> 2558#include <sys/time.h>
2533#include <stdlib.h> 2559#include <stdlib.h>
2534#include <signal.h> 2560#include <signal.h>
2561#include <unistd.h>
2535static void sighandler(int sig) { } 2562static void sighandler(int sig) { }
2536 ]], [[ 2563 ]], [[
2537 int r; 2564 int r;
@@ -2688,6 +2715,7 @@ if test "x$openssl" = "xyes" ; then
2688 AC_RUN_IFELSE( 2715 AC_RUN_IFELSE(
2689 [AC_LANG_PROGRAM([[ 2716 [AC_LANG_PROGRAM([[
2690 #include <stdio.h> 2717 #include <stdio.h>
2718 #include <stdlib.h>
2691 #include <string.h> 2719 #include <string.h>
2692 #include <openssl/opensslv.h> 2720 #include <openssl/opensslv.h>
2693 #include <openssl/crypto.h> 2721 #include <openssl/crypto.h>
@@ -2749,6 +2777,7 @@ if test "x$openssl" = "xyes" ; then
2749 AC_MSG_CHECKING([whether OpenSSL's headers match the library]) 2777 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2750 AC_RUN_IFELSE( 2778 AC_RUN_IFELSE(
2751 [AC_LANG_PROGRAM([[ 2779 [AC_LANG_PROGRAM([[
2780 #include <stdlib.h>
2752 #include <string.h> 2781 #include <string.h>
2753 #include <openssl/opensslv.h> 2782 #include <openssl/opensslv.h>
2754 #include <openssl/crypto.h> 2783 #include <openssl/crypto.h>
@@ -2888,6 +2917,7 @@ if test "x$openssl" = "xyes" ; then
2888 AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) 2917 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2889 AC_LINK_IFELSE( 2918 AC_LINK_IFELSE(
2890 [AC_LANG_PROGRAM([[ 2919 [AC_LANG_PROGRAM([[
2920 #include <stdlib.h>
2891 #include <string.h> 2921 #include <string.h>
2892 #include <openssl/evp.h> 2922 #include <openssl/evp.h>
2893 ]], [[ 2923 ]], [[
@@ -2907,6 +2937,7 @@ if test "x$openssl" = "xyes" ; then
2907 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP]) 2937 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2908 AC_LINK_IFELSE( 2938 AC_LINK_IFELSE(
2909 [AC_LANG_PROGRAM([[ 2939 [AC_LANG_PROGRAM([[
2940 #include <stdlib.h>
2910 #include <string.h> 2941 #include <string.h>
2911 #include <openssl/evp.h> 2942 #include <openssl/evp.h>
2912 ]], [[ 2943 ]], [[
@@ -2928,6 +2959,7 @@ if test "x$openssl" = "xyes" ; then
2928 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP]) 2959 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2929 AC_LINK_IFELSE( 2960 AC_LINK_IFELSE(
2930 [AC_LANG_PROGRAM([[ 2961 [AC_LANG_PROGRAM([[
2962 #include <stdlib.h>
2931 #include <string.h> 2963 #include <string.h>
2932 #include <openssl/evp.h> 2964 #include <openssl/evp.h>
2933 ]], [[ 2965 ]], [[
@@ -2955,6 +2987,7 @@ if test "x$openssl" = "xyes" ; then
2955 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int]) 2987 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2956 AC_LINK_IFELSE( 2988 AC_LINK_IFELSE(
2957 [AC_LANG_PROGRAM([[ 2989 [AC_LANG_PROGRAM([[
2990 #include <stdlib.h>
2958 #include <string.h> 2991 #include <string.h>
2959 #include <openssl/evp.h> 2992 #include <openssl/evp.h>
2960 ]], [[ 2993 ]], [[
@@ -3041,6 +3074,7 @@ if test "x$openssl" = "xyes" ; then
3041 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional]) 3074 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
3042 AC_RUN_IFELSE( 3075 AC_RUN_IFELSE(
3043 [AC_LANG_PROGRAM([[ 3076 [AC_LANG_PROGRAM([[
3077 #include <stdlib.h>
3044 #include <openssl/ec.h> 3078 #include <openssl/ec.h>
3045 #include <openssl/ecdh.h> 3079 #include <openssl/ecdh.h>
3046 #include <openssl/ecdsa.h> 3080 #include <openssl/ecdsa.h>
@@ -3223,6 +3257,7 @@ if test "x$openssl" = "xyes" ; then
3223 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) 3257 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
3224 AC_RUN_IFELSE( 3258 AC_RUN_IFELSE(
3225 [AC_LANG_PROGRAM([[ 3259 [AC_LANG_PROGRAM([[
3260 #include <stdlib.h>
3226 #include <string.h> 3261 #include <string.h>
3227 #include <openssl/rand.h> 3262 #include <openssl/rand.h>
3228 ]], [[ 3263 ]], [[
@@ -3654,6 +3689,7 @@ if test -z "$have_llong_max" && test -z "$have_long_long_max"; then
3654 AC_RUN_IFELSE( 3689 AC_RUN_IFELSE(
3655 [AC_LANG_PROGRAM([[ 3690 [AC_LANG_PROGRAM([[
3656#include <stdio.h> 3691#include <stdio.h>
3692#include <stdlib.h>
3657/* Why is this so damn hard? */ 3693/* Why is this so damn hard? */
3658#ifdef __GNUC__ 3694#ifdef __GNUC__
3659# undef __GNUC__ 3695# undef __GNUC__
@@ -4169,6 +4205,7 @@ dnl test snprintf (broken on SCO w/gcc)
4169 AC_RUN_IFELSE( 4205 AC_RUN_IFELSE(
4170 [AC_LANG_SOURCE([[ 4206 [AC_LANG_SOURCE([[
4171#include <stdio.h> 4207#include <stdio.h>
4208#include <stdlib.h>
4172#include <string.h> 4209#include <string.h>
4173#ifdef HAVE_SNPRINTF 4210#ifdef HAVE_SNPRINTF
4174main() 4211main()
@@ -4272,6 +4309,7 @@ AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
4272#include <sys/types.h> 4309#include <sys/types.h>
4273#include <sys/socket.h> 4310#include <sys/socket.h>
4274#include <sys/uio.h> 4311#include <sys/uio.h>
4312#include <stdlib.h>
4275 ]], [[ 4313 ]], [[
4276#ifdef msg_accrights 4314#ifdef msg_accrights
4277#error "msg_accrights is a macro" 4315#error "msg_accrights is a macro"
@@ -4333,6 +4371,7 @@ AC_CACHE_CHECK([for msg_control field in struct msghdr],
4333#include <sys/types.h> 4371#include <sys/types.h>
4334#include <sys/socket.h> 4372#include <sys/socket.h>
4335#include <sys/uio.h> 4373#include <sys/uio.h>
4374#include <stdlib.h>
4336 ]], [[ 4375 ]], [[
4337#ifdef msg_control 4376#ifdef msg_control
4338#error "msg_control is a macro" 4377#error "msg_control is a macro"
@@ -4353,7 +4392,7 @@ if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
4353fi 4392fi
4354 4393
4355AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [ 4394AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
4356 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], 4395 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4357 [[ extern char *__progname; printf("%s", __progname); ]])], 4396 [[ extern char *__progname; printf("%s", __progname); ]])],
4358 [ ac_cv_libc_defines___progname="yes" ], 4397 [ ac_cv_libc_defines___progname="yes" ],
4359 [ ac_cv_libc_defines___progname="no" 4398 [ ac_cv_libc_defines___progname="no"
@@ -4425,7 +4464,7 @@ if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
4425fi 4464fi
4426 4465
4427AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [ 4466AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
4428 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], 4467 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4429[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])], 4468[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
4430 [ ac_cv_libc_defines_sys_errlist="yes" ], 4469 [ ac_cv_libc_defines_sys_errlist="yes" ],
4431 [ ac_cv_libc_defines_sys_errlist="no" 4470 [ ac_cv_libc_defines_sys_errlist="no"
@@ -4438,7 +4477,7 @@ fi
4438 4477
4439 4478
4440AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [ 4479AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
4441 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], 4480 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4442[[ extern int sys_nerr; printf("%i", sys_nerr);]])], 4481[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
4443 [ ac_cv_libc_defines_sys_nerr="yes" ], 4482 [ ac_cv_libc_defines_sys_nerr="yes" ],
4444 [ ac_cv_libc_defines_sys_nerr="no" 4483 [ ac_cv_libc_defines_sys_nerr="no"
@@ -4747,6 +4786,7 @@ AC_ARG_WITH([maildir],
4747 AC_RUN_IFELSE( 4786 AC_RUN_IFELSE(
4748 [AC_LANG_PROGRAM([[ 4787 [AC_LANG_PROGRAM([[
4749#include <stdio.h> 4788#include <stdio.h>
4789#include <stdlib.h>
4750#include <string.h> 4790#include <string.h>
4751#ifdef HAVE_PATHS_H 4791#ifdef HAVE_PATHS_H
4752#include <paths.h> 4792#include <paths.h>
@@ -4991,6 +5031,7 @@ otherwise scp will not work.])
4991 [AC_LANG_PROGRAM([[ 5031 [AC_LANG_PROGRAM([[
4992/* find out what STDPATH is */ 5032/* find out what STDPATH is */
4993#include <stdio.h> 5033#include <stdio.h>
5034#include <stdlib.h>
4994#ifdef HAVE_PATHS_H 5035#ifdef HAVE_PATHS_H
4995# include <paths.h> 5036# include <paths.h>
4996#endif 5037#endif