X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fsetsockopt.m4;h=58c61c0ab9fa4c6a0e63989a14b8229988be6786;hb=d169e8c62f8ca4fe7d058d8e2254426105032b7e;hp=4ca7214cff9595dd1d6c1342f5b1e8809e3b2881;hpb=4cf3ce236b4a17092ca192becbd0a2f30d0ac576;p=awesomized%2Flibmemcached diff --git a/m4/setsockopt.m4 b/m4/setsockopt.m4 index 4ca7214c..58c61c0a 100644 --- a/m4/setsockopt.m4 +++ b/m4/setsockopt.m4 @@ -1,15 +1,17 @@ dnl --------------------------------------------------------------------------- -dnl Macro: SETSOCKOPT_TEST +dnl Macro: SETSOCKOPT_SANITY dnl --------------------------------------------------------------------------- -AC_LANG(C) -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ +AC_DEFUN([SETSOCKOPT_SANITY],[ + AC_CACHE_CHECK([for working SO_SNDTIMEO], [ac_cv_have_so_sndtimeo], + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ #include #include #include #include #include - ], [ + ]],[[ int sock = socket(AF_INET, SOCK_STREAM, 0); struct timeval waittime; @@ -23,17 +25,26 @@ AC_RUN_IFELSE([ } } return 0; - ]) - ], AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])) + ]])], + [ac_cv_have_so_sndtimeo=yes], + [ac_cv_have_so_sndtimeo=no], + [ac_cv_have_so_sndtimeo=yes]) -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ + AS_IF([test "x$ac_cv_have_so_sndtimeo" = "xyes"], [ + AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])]) + AC_LANG_POP + ) + + AC_CACHE_CHECK([for working SO_RCVTIMEO], [ac_cv_have_so_rcvtimeo], + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ #include #include #include #include #include - ], [ + ]],[[ int sock = socket(AF_INET, SOCK_STREAM, 0); struct timeval waittime; @@ -47,9 +58,16 @@ AC_RUN_IFELSE([ } } return 0; - ]) - ], AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])) + ]])], + [ac_cv_have_so_rcvtimeo=yes], + [ac_cv_have_so_rcvtimeo=no], + [ac_cv_have_so_rcvtimeo=yes]) + AS_IF([test "x$ac_cv_have_so_rcvtimeo" = "xyes"], [ + AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])]) + AC_LANG_POP + ) +]) dnl --------------------------------------------------------------------------- -dnl End Macro: SETSOCKOPT_TEST +dnl End Macro: SETSOCKOPT_SANITY dnl ---------------------------------------------------------------------------