Skip to content
Snippets Groups Projects
cares-functions.m4 84.9 KiB
Newer Older
  • Learn to ignore specific revisions
  • Yang Tse's avatar
    Yang Tse committed
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_strncmpi="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_strncmpi="no"
        ])
      fi
      #
      if test "$tst_compi_strncmpi" = "yes"; then
        AC_MSG_CHECKING([if strncmpi usage allowed])
        if test "x$cares_disallow_strncmpi" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_strncmpi="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_strncmpi="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if strncmpi might be used])
      if test "$tst_links_strncmpi" = "yes" &&
         test "$tst_proto_strncmpi" = "yes" &&
         test "$tst_compi_strncmpi" = "yes" &&
         test "$tst_allow_strncmpi" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1,
          [Define to 1 if you have the strncmpi function.])
        ac_cv_func_strncmpi="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_strncmpi="no"
      fi
    ])
    
    
    dnl CARES_CHECK_FUNC_STRNICMP
    dnl -------------------------------------------------
    dnl Verify if strnicmp is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable cares_disallow_strnicmp, then
    dnl HAVE_STRNICMP will be defined.
    
    AC_DEFUN([CARES_CHECK_FUNC_STRNICMP], [
      AC_REQUIRE([CARES_INCLUDES_STRING])dnl
      #
      tst_links_strnicmp="unknown"
      tst_proto_strnicmp="unknown"
      tst_compi_strnicmp="unknown"
      tst_allow_strnicmp="unknown"
      #
      AC_MSG_CHECKING([if strnicmp can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([strnicmp])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_strnicmp="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_strnicmp="no"
      ])
      #
      if test "$tst_links_strnicmp" = "yes"; then
        AC_MSG_CHECKING([if strnicmp is prototyped])
        AC_EGREP_CPP([strnicmp],[
          $cares_includes_string
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_strnicmp="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_strnicmp="no"
        ])
      fi
      #
      if test "$tst_proto_strnicmp" = "yes"; then
        AC_MSG_CHECKING([if strnicmp is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $cares_includes_string
          ]],[[
            if(0 != strnicmp(0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_strnicmp="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_strnicmp="no"
        ])
      fi
      #
      if test "$tst_compi_strnicmp" = "yes"; then
        AC_MSG_CHECKING([if strnicmp usage allowed])
        if test "x$cares_disallow_strnicmp" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_strnicmp="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_strnicmp="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if strnicmp might be used])
      if test "$tst_links_strnicmp" = "yes" &&
         test "$tst_proto_strnicmp" = "yes" &&
         test "$tst_compi_strnicmp" = "yes" &&
         test "$tst_allow_strnicmp" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1,
          [Define to 1 if you have the strnicmp function.])
        ac_cv_func_strnicmp="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_strnicmp="no"
      fi
    ])
    
    
    
    dnl CARES_CHECK_FUNC_WRITEV
    dnl -------------------------------------------------
    dnl Verify if writev is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable cares_disallow_writev, then
    dnl HAVE_WRITEV will be defined.
    
    AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [
      AC_REQUIRE([CARES_INCLUDES_SYS_UIO])dnl
      #
      tst_links_writev="unknown"
      tst_proto_writev="unknown"
      tst_compi_writev="unknown"
      tst_allow_writev="unknown"
      #
      AC_MSG_CHECKING([if writev can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([writev])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_writev="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_writev="no"
      ])
      #
      if test "$tst_links_writev" = "yes"; then
        AC_MSG_CHECKING([if writev is prototyped])
        AC_EGREP_CPP([writev],[
          $cares_includes_sys_uio
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_writev="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_writev="no"
        ])
      fi
      #
      if test "$tst_proto_writev" = "yes"; then
        AC_MSG_CHECKING([if writev is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $cares_includes_sys_uio
          ]],[[
            if(0 != writev(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_writev="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_writev="no"
        ])
      fi
      #
      if test "$tst_compi_writev" = "yes"; then
        AC_MSG_CHECKING([if writev usage allowed])
        if test "x$cares_disallow_writev" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_writev="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_writev="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if writev might be used])
      if test "$tst_links_writev" = "yes" &&
         test "$tst_proto_writev" = "yes" &&
         test "$tst_compi_writev" = "yes" &&
         test "$tst_allow_writev" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1,
          [Define to 1 if you have the writev function.])
        ac_cv_func_writev="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_writev="no"
      fi
    ])