Blame m4/cares-compilers.m4

Packit 514978
#***************************************************************************
Packit 514978
#
Packit 514978
# Copyright (C) 2009-2013 by Daniel Stenberg et al
Packit 514978
#
Packit 514978
# Permission to use, copy, modify, and distribute this software and its
Packit 514978
# documentation for any purpose and without fee is hereby granted, provided
Packit 514978
# that the above copyright notice appear in all copies and that both that
Packit 514978
# copyright notice and this permission notice appear in supporting
Packit 514978
# documentation, and that the name of M.I.T. not be used in advertising or
Packit 514978
# publicity pertaining to distribution of the software without specific,
Packit 514978
# written prior permission.  M.I.T. makes no representations about the
Packit 514978
# suitability of this software for any purpose.  It is provided "as is"
Packit 514978
# without express or implied warranty.
Packit 514978
#
Packit 514978
#***************************************************************************
Packit 514978
Packit 514978
# File version for 'aclocal' use. Keep it a single number.
Packit 514978
# serial 75
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if the C compiler being used is known.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER], [
Packit 514978
  #
Packit 514978
  compiler_id="unknown"
Packit 514978
  compiler_num="0"
Packit 514978
  #
Packit 514978
  flags_dbg_all="unknown"
Packit 514978
  flags_dbg_yes="unknown"
Packit 514978
  flags_dbg_off="unknown"
Packit 514978
  flags_opt_all="unknown"
Packit 514978
  flags_opt_yes="unknown"
Packit 514978
  flags_opt_off="unknown"
Packit 514978
  #
Packit 514978
  flags_prefer_cppflags="no"
Packit 514978
  #
Packit 514978
  CARES_CHECK_COMPILER_DEC_C
Packit 514978
  CARES_CHECK_COMPILER_HPUX_C
Packit 514978
  CARES_CHECK_COMPILER_IBM_C
Packit 514978
  CARES_CHECK_COMPILER_INTEL_C
Packit 514978
  CARES_CHECK_COMPILER_CLANG
Packit 514978
  CARES_CHECK_COMPILER_GNU_C
Packit 514978
  CARES_CHECK_COMPILER_LCC
Packit 514978
  CARES_CHECK_COMPILER_SGI_MIPSPRO_C
Packit 514978
  CARES_CHECK_COMPILER_SGI_MIPS_C
Packit 514978
  CARES_CHECK_COMPILER_SUNPRO_C
Packit 514978
  CARES_CHECK_COMPILER_TINY_C
Packit 514978
  CARES_CHECK_COMPILER_WATCOM_C
Packit 514978
  #
Packit 514978
  if test "$compiler_id" = "unknown"; then
Packit 514978
  cat <<_EOF 1>&2
Packit 514978
***
Packit 514978
*** Warning: This configure script does not have information about the
Packit 514978
*** compiler you are using, relative to the flags required to enable or
Packit 514978
*** disable generation of debug info, optimization options or warnings.
Packit 514978
***
Packit 514978
*** Whatever settings are present in CFLAGS will be used for this run.
Packit 514978
***
Packit 514978
*** If you wish to help the c-ares project to better support your compiler
Packit 514978
*** you can report this and the required info on the c-ares development
Packit 514978
*** mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
Packit 514978
***
Packit 514978
_EOF
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_CLANG
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is clang.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_CLANG], [
Packit 514978
  AC_BEFORE([$0],[CARES_CHECK_COMPILER_GNU_C])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler is clang])
Packit 514978
  CURL_CHECK_DEF([__clang__], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___clang__" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="CLANG"
Packit 514978
    clangver=`$CC -dumpversion`
Packit 514978
    clangvhi=`echo $clangver | cut -d . -f1`
Packit 514978
    clangvlo=`echo $clangver | cut -d . -f2`
Packit 514978
    compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
Packit 514978
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
Packit 514978
    flags_dbg_all="$flags_dbg_all -ggdb"
Packit 514978
    flags_dbg_all="$flags_dbg_all -gstabs"
Packit 514978
    flags_dbg_all="$flags_dbg_all -gstabs+"
Packit 514978
    flags_dbg_all="$flags_dbg_all -gcoff"
Packit 514978
    flags_dbg_all="$flags_dbg_all -gxcoff"
Packit 514978
    flags_dbg_all="$flags_dbg_all -gdwarf-2"
Packit 514978
    flags_dbg_all="$flags_dbg_all -gvms"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off="-g0"
Packit 514978
    flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
Packit 514978
    flags_opt_yes="-Os"
Packit 514978
    flags_opt_off="-O0"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_DEC_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is DEC C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_DEC_C], [
Packit 514978
  AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
Packit 514978
  CURL_CHECK_DEF([__DECC], [], [silent])
Packit 514978
  CURL_CHECK_DEF([__DECC_VER], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___DECC" = "yes" &&
Packit 514978
    test "$curl_cv_have_def___DECC_VER" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="DEC_C"
Packit 514978
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
Packit 514978
    flags_dbg_yes="-g2"
Packit 514978
    flags_dbg_off="-g0"
Packit 514978
    flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
Packit 514978
    flags_opt_yes="-O1"
Packit 514978
    flags_opt_off="-O0"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_GNU_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is GNU C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_GNU_C], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER_INTEL_C])dnl
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER_CLANG])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler is GNU C])
Packit 514978
  CURL_CHECK_DEF([__GNUC__], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___GNUC__" = "yes" &&
Packit 514978
    test "$compiler_id" = "unknown"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="GNU_C"
Packit 514978
    gccver=`$CC -dumpversion`
Packit 514978
    gccvhi=`echo $gccver | cut -d . -f1`
Packit 514978
    gccvlo=`echo $gccver | cut -d . -f2`
Packit 514978
    compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
Packit Service 3e667c
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -ggdb"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -gstabs"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -gstabs+"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -gcoff"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -gxcoff"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -gdwarf-2"
Packit Service 3e667c
    flags_dbg_all="$flags_dbg_all -gvms"
Packit Service 3e667c
    flags_dbg_yes="-g"
Packit Service 3e667c
    flags_dbg_off="-g0"
Packit Service 3e667c
    flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
Packit Service 3e667c
    flags_opt_yes="-O2"
Packit Service 3e667c
    flags_opt_off="-O0"
Packit 514978
    CURL_CHECK_DEF([_WIN32], [], [silent])
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_HPUX_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is HP-UX C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_HPUX_C], [
Packit 514978
  AC_MSG_CHECKING([if compiler is HP-UX C])
Packit 514978
  CURL_CHECK_DEF([__HP_cc], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___HP_cc" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="HP_UX_C"
Packit 514978
    flags_dbg_all="-g -s"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off="-s"
Packit 514978
    flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
Packit 514978
    flags_opt_yes="+O2"
Packit 514978
    flags_opt_off="+O0"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_IBM_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is IBM C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_IBM_C], [
Packit 514978
  AC_MSG_CHECKING([if compiler is IBM C])
Packit 514978
  CURL_CHECK_DEF([__IBMC__], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___IBMC__" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="IBM_C"
Packit 514978
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off=""
Packit 514978
    flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
Packit 514978
    flags_opt_all="$flags_opt_all -qnooptimize"
Packit 514978
    flags_opt_all="$flags_opt_all -qoptimize=0"
Packit 514978
    flags_opt_all="$flags_opt_all -qoptimize=1"
Packit 514978
    flags_opt_all="$flags_opt_all -qoptimize=2"
Packit 514978
    flags_opt_all="$flags_opt_all -qoptimize=3"
Packit 514978
    flags_opt_all="$flags_opt_all -qoptimize=4"
Packit 514978
    flags_opt_all="$flags_opt_all -qoptimize=5"
Packit 514978
    flags_opt_yes="-O2"
Packit 514978
    flags_opt_off="-qnooptimize"
Packit 514978
    flags_prefer_cppflags="yes"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_INTEL_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is Intel C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_INTEL_C], [
Packit 514978
  AC_BEFORE([$0],[CARES_CHECK_COMPILER_GNU_C])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler is Intel C])
Packit 514978
  CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_num="$curl_cv_def___INTEL_COMPILER"
Packit 514978
    CURL_CHECK_DEF([__unix__], [], [silent])
Packit 514978
    if test "$curl_cv_have_def___unix__" = "yes"; then
Packit 514978
      compiler_id="INTEL_UNIX_C"
Packit 514978
      flags_dbg_all="-g -g0"
Packit 514978
      flags_dbg_yes="-g"
Packit 514978
      flags_dbg_off="-g0"
Packit 514978
      flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
Packit 514978
      flags_opt_yes="-O2"
Packit 514978
      flags_opt_off="-O0"
Packit 514978
    else
Packit 514978
      compiler_id="INTEL_WINDOWS_C"
Packit 514978
      flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug:none"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug:minimal"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug:partial"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug:full"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
Packit 514978
      flags_dbg_all="$flags_dbg_all /debug:extended"
Packit 514978
      flags_dbg_yes="/Zi /Oy-"
Packit 514978
      flags_dbg_off="/debug:none /Oy-"
Packit 514978
      flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
Packit 514978
      flags_opt_yes="/O2"
Packit 514978
      flags_opt_off="/Od"
Packit 514978
    fi
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_LCC
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is LCC.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_LCC], [
Packit 514978
  AC_MSG_CHECKING([if compiler is LCC])
Packit 514978
  CURL_CHECK_DEF([__LCC__], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___LCC__" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="LCC"
Packit 514978
    flags_dbg_all="-g"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off=""
Packit 514978
    flags_opt_all=""
Packit 514978
    flags_opt_yes=""
Packit 514978
    flags_opt_off=""
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_SGI_MIPS_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is SGI MIPS C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_SGI_MIPS_C], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER_SGI_MIPSPRO_C])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler is SGI MIPS C])
Packit 514978
  CURL_CHECK_DEF([__GNUC__], [], [silent])
Packit 514978
  CURL_CHECK_DEF([__sgi], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___GNUC__" = "no" &&
Packit 514978
    test "$curl_cv_have_def___sgi" = "yes" &&
Packit 514978
    test "$compiler_id" = "unknown"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="SGI_MIPS_C"
Packit 514978
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off="-g0"
Packit 514978
    flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
Packit 514978
    flags_opt_yes="-O2"
Packit 514978
    flags_opt_off="-O0"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_SGI_MIPSPRO_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is SGI MIPSpro C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_SGI_MIPSPRO_C], [
Packit 514978
  AC_BEFORE([$0],[CARES_CHECK_COMPILER_SGI_MIPS_C])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
Packit 514978
  CURL_CHECK_DEF([__GNUC__], [], [silent])
Packit 514978
  CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
Packit 514978
  CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___GNUC__" = "no" &&
Packit 514978
    (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
Packit 514978
     test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="SGI_MIPSPRO_C"
Packit 514978
    flags_dbg_all="-g -g0 -g1 -g2 -g3"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off="-g0"
Packit 514978
    flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
Packit 514978
    flags_opt_yes="-O2"
Packit 514978
    flags_opt_off="-O0"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_SUNPRO_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is SunPro C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_SUNPRO_C], [
Packit 514978
  AC_MSG_CHECKING([if compiler is SunPro C])
Packit 514978
  CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="SUNPRO_C"
Packit 514978
    flags_dbg_all="-g -s"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off="-s"
Packit 514978
    flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
Packit 514978
    flags_opt_yes="-xO2"
Packit 514978
    flags_opt_off=""
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_TINY_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is Tiny C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_TINY_C], [
Packit 514978
  AC_MSG_CHECKING([if compiler is Tiny C])
Packit 514978
  CURL_CHECK_DEF([__TINYC__], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___TINYC__" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    compiler_id="TINY_C"
Packit 514978
    flags_dbg_all="-g -b"
Packit 514978
    flags_dbg_yes="-g"
Packit 514978
    flags_dbg_off=""
Packit 514978
    flags_opt_all=""
Packit 514978
    flags_opt_yes=""
Packit 514978
    flags_opt_off=""
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_WATCOM_C
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler being used is Watcom C.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_WATCOM_C], [
Packit 514978
  AC_MSG_CHECKING([if compiler is Watcom C])
Packit 514978
  CURL_CHECK_DEF([__WATCOMC__], [], [silent])
Packit 514978
  if test "$curl_cv_have_def___WATCOMC__" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    CURL_CHECK_DEF([__UNIX__], [], [silent])
Packit 514978
    if test "$curl_cv_have_def___UNIX__" = "yes"; then
Packit 514978
      compiler_id="WATCOM_UNIX_C"
Packit 514978
      flags_dbg_all="-g1 -g1+ -g2 -g3"
Packit 514978
      flags_dbg_yes="-g2"
Packit 514978
      flags_dbg_off=""
Packit 514978
      flags_opt_all="-O0 -O1 -O2 -O3"
Packit 514978
      flags_opt_yes="-O2"
Packit 514978
      flags_opt_off="-O0"
Packit 514978
    else
Packit 514978
      compiler_id="WATCOM_WINDOWS_C"
Packit 514978
      flags_dbg_all=""
Packit 514978
      flags_dbg_yes=""
Packit 514978
      flags_dbg_off=""
Packit 514978
      flags_opt_all=""
Packit 514978
      flags_opt_yes=""
Packit 514978
      flags_opt_off=""
Packit 514978
    fi
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CONVERT_INCLUDE_TO_ISYSTEM
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Changes standard include paths present in CFLAGS
Packit 514978
dnl and CPPFLAGS into isystem include paths. This is
Packit 514978
dnl done to prevent GNUC from generating warnings on
Packit 514978
dnl headers from these locations, although on ancient
Packit 514978
dnl GNUC versions these warnings are not silenced.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER])dnl
Packit 514978
  if test "$compiler_id" = "GNU_C" ||
Packit 514978
    test "$compiler_id" = "CLANG"; then
Packit 514978
    tmp_has_include="no"
Packit 514978
    tmp_chg_FLAGS="$CFLAGS"
Packit 514978
    for word1 in $tmp_chg_FLAGS; do
Packit 514978
      case "$word1" in
Packit 514978
        -I*)
Packit 514978
          tmp_has_include="yes"
Packit 514978
          ;;
Packit 514978
      esac
Packit 514978
    done
Packit 514978
    if test "$tmp_has_include" = "yes"; then
Packit 514978
      tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
Packit 514978
      tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
Packit 514978
      CFLAGS="$tmp_chg_FLAGS"
Packit 514978
      squeeze CFLAGS
Packit 514978
    fi
Packit 514978
    tmp_has_include="no"
Packit 514978
    tmp_chg_FLAGS="$CPPFLAGS"
Packit 514978
    for word1 in $tmp_chg_FLAGS; do
Packit 514978
      case "$word1" in
Packit 514978
        -I*)
Packit 514978
          tmp_has_include="yes"
Packit 514978
          ;;
Packit 514978
      esac
Packit 514978
    done
Packit 514978
    if test "$tmp_has_include" = "yes"; then
Packit 514978
      tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
Packit 514978
      tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
Packit 514978
      CPPFLAGS="$tmp_chg_FLAGS"
Packit 514978
      squeeze CPPFLAGS
Packit 514978
    fi
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if the C compiler seems to work with the
Packit 514978
dnl settings that are 'active' at the time the test
Packit 514978
dnl is performed.
Packit 514978
Packit 514978
AC_DEFUN([CARES_COMPILER_WORKS_IFELSE], [
Packit 514978
  dnl compilation capability verification
Packit 514978
  tmp_compiler_works="unknown"
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
    ]],[[
Packit 514978
      int i = 1;
Packit 514978
      return i;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    tmp_compiler_works="yes"
Packit 514978
  ],[
Packit 514978
    tmp_compiler_works="no"
Packit 514978
    echo " " >&6
Packit 514978
    sed 's/^/cc-fail: /' conftest.err >&6
Packit 514978
    echo " " >&6
Packit 514978
  ])
Packit 514978
  dnl linking capability verification
Packit 514978
  if test "$tmp_compiler_works" = "yes"; then
Packit 514978
    AC_LINK_IFELSE([
Packit 514978
      AC_LANG_PROGRAM([[
Packit 514978
      ]],[[
Packit 514978
        int i = 1;
Packit 514978
        return i;
Packit 514978
      ]])
Packit 514978
    ],[
Packit 514978
      tmp_compiler_works="yes"
Packit 514978
    ],[
Packit 514978
      tmp_compiler_works="no"
Packit 514978
      echo " " >&6
Packit 514978
      sed 's/^/link-fail: /' conftest.err >&6
Packit 514978
      echo " " >&6
Packit 514978
    ])
Packit 514978
  fi
Packit 514978
  dnl only do runtime verification when not cross-compiling
Packit 514978
  if test "x$cross_compiling" != "xyes" &&
Packit 514978
    test "$tmp_compiler_works" = "yes"; then
Packit 514978
    AC_RUN_IFELSE([
Packit 514978
      AC_LANG_PROGRAM([[
Packit 514978
#       ifdef __STDC__
Packit 514978
#         include <stdlib.h>
Packit 514978
#       endif
Packit 514978
      ]],[[
Packit 514978
        int i = 0;
Packit 514978
        exit(i);
Packit 514978
      ]])
Packit 514978
    ],[
Packit 514978
      tmp_compiler_works="yes"
Packit 514978
    ],[
Packit 514978
      tmp_compiler_works="no"
Packit 514978
      echo " " >&6
Packit 514978
      echo "run-fail: test program exited with status $ac_status" >&6
Packit 514978
      echo " " >&6
Packit 514978
    ])
Packit 514978
  fi
Packit 514978
  dnl branch upon test result
Packit 514978
  if test "$tmp_compiler_works" = "yes"; then
Packit 514978
  ifelse($1,,:,[$1])
Packit 514978
  ifelse($2,,,[else
Packit 514978
    $2])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_SET_COMPILER_BASIC_OPTS
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Sets compiler specific options/flags which do not
Packit 514978
dnl depend on configure's debug, optimize or warnings
Packit 514978
dnl options.
Packit 514978
Packit 514978
AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER])dnl
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  #
Packit 514978
  if test "$compiler_id" != "unknown"; then
Packit 514978
    #
Packit 514978
    if test "$compiler_id" = "GNU_C" ||
Packit 514978
      test "$compiler_id" = "CLANG"; then
Packit 514978
      CARES_CONVERT_INCLUDE_TO_ISYSTEM
Packit 514978
    fi
Packit 514978
    #
Packit 514978
    tmp_save_CPPFLAGS="$CPPFLAGS"
Packit 514978
    tmp_save_CFLAGS="$CFLAGS"
Packit 514978
    tmp_CPPFLAGS=""
Packit 514978
    tmp_CFLAGS=""
Packit 514978
    #
Packit 514978
    case "$compiler_id" in
Packit 514978
        #
Packit 514978
      CLANG)
Packit 514978
        #
Packit 514978
        dnl Disable warnings for unused arguments, otherwise clang will
Packit 514978
        dnl warn about compile-time arguments used during link-time, like
Packit 514978
        dnl -O and -g and -pedantic.
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      DEC_C)
Packit 514978
        #
Packit 514978
        dnl Select strict ANSI C compiler mode
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -std1"
Packit 514978
        dnl Turn off optimizer ANSI C aliasing rules
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
Packit 514978
        dnl Generate warnings for missing function prototypes
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
Packit 514978
        dnl Change some warnings into fatal errors
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      GNU_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      HP_UX_C)
Packit 514978
        #
Packit 514978
        dnl Disallow run-time dereferencing of null pointers
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -z"
Packit 514978
        dnl Disable some remarks
Packit 514978
        dnl #4227: padding struct with n bytes to align member
Packit 514978
        dnl #4255: padding size of struct with n bytes to alignment boundary
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      IBM_C)
Packit 514978
        #
Packit 514978
        dnl Ensure that compiler optimizations are always thread-safe.
Packit 514978
        tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
Packit 514978
        dnl Disable type based strict aliasing optimizations, using worst
Packit 514978
        dnl case aliasing assumptions when compiling. Type based aliasing
Packit 514978
        dnl would restrict the lvalues that could be safely used to access
Packit 514978
        dnl a data object.
Packit 514978
        tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
Packit 514978
        dnl Force compiler to stop after the compilation phase, without
Packit 514978
        dnl generating an object code file when compilation has errors.
Packit 514978
        tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      INTEL_UNIX_C)
Packit 514978
        #
Packit 514978
        dnl On unix this compiler uses gcc's header files, so
Packit 514978
        dnl we select ANSI C89 dialect plus GNU extensions.
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
Packit 514978
        dnl Change some warnings into errors
Packit 514978
        dnl #140: too many arguments in function call
Packit 514978
        dnl #147: declaration is incompatible with 'previous one'
Packit 514978
        dnl #165: too few arguments in function call
Packit 514978
        dnl #266: function declared implicitly
Packit 514978
        tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
Packit 514978
        dnl Disable some remarks
Packit 514978
        dnl #279: controlling expression is constant
Packit 514978
        dnl #981: operands are evaluated in unspecified order
Packit 514978
        dnl #1469: "cc" clobber ignored
Packit 514978
        tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      INTEL_WINDOWS_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      LCC)
Packit 514978
        #
Packit 514978
        dnl Disallow run-time dereferencing of null pointers
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -n"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      SGI_MIPS_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      SGI_MIPSPRO_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      SUNPRO_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      TINY_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      WATCOM_UNIX_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      WATCOM_WINDOWS_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
    esac
Packit 514978
    #
Packit 514978
    squeeze tmp_CPPFLAGS
Packit 514978
    squeeze tmp_CFLAGS
Packit 514978
    #
Packit 514978
    if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
Packit 514978
      AC_MSG_CHECKING([if compiler accepts some basic options])
Packit 514978
      CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
Packit 514978
      CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
Packit 514978
      squeeze CPPFLAGS
Packit 514978
      squeeze CFLAGS
Packit 514978
      CARES_COMPILER_WORKS_IFELSE([
Packit 514978
        AC_MSG_RESULT([yes])
Packit 514978
        AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
Packit 514978
      ],[
Packit 514978
        AC_MSG_RESULT([no])
Packit 514978
        AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
Packit 514978
        dnl restore initial settings
Packit 514978
        CPPFLAGS="$tmp_save_CPPFLAGS"
Packit 514978
        CFLAGS="$tmp_save_CFLAGS"
Packit 514978
      ])
Packit 514978
    fi
Packit 514978
    #
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_SET_COMPILER_DEBUG_OPTS
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Sets compiler specific options/flags which depend
Packit 514978
dnl on configure's debug option.
Packit 514978
Packit 514978
AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER])dnl
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  #
Packit 514978
  if test "$compiler_id" != "unknown"; then
Packit 514978
    #
Packit 514978
    tmp_save_CFLAGS="$CFLAGS"
Packit 514978
    tmp_save_CPPFLAGS="$CPPFLAGS"
Packit 514978
    #
Packit 514978
    tmp_options=""
Packit 514978
    tmp_CFLAGS="$CFLAGS"
Packit 514978
    tmp_CPPFLAGS="$CPPFLAGS"
Packit 514978
    CARES_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
Packit 514978
    CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
Packit 514978
    #
Packit 514978
    if test "$want_debug" = "yes"; then
Packit 514978
      AC_MSG_CHECKING([if compiler accepts debug enabling options])
Packit 514978
      tmp_options="$flags_dbg_yes"
Packit 514978
    fi
Packit 514978
    if test "$want_debug" = "no"; then
Packit 514978
      AC_MSG_CHECKING([if compiler accepts debug disabling options])
Packit 514978
      tmp_options="$flags_dbg_off"
Packit 514978
    fi
Packit 514978
    #
Packit 514978
    if test "$flags_prefer_cppflags" = "yes"; then
Packit 514978
      CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
Packit 514978
      CFLAGS="$tmp_CFLAGS"
Packit 514978
    else
Packit 514978
      CPPFLAGS="$tmp_CPPFLAGS"
Packit 514978
      CFLAGS="$tmp_CFLAGS $tmp_options"
Packit 514978
    fi
Packit 514978
    squeeze CPPFLAGS
Packit 514978
    squeeze CFLAGS
Packit 514978
    CARES_COMPILER_WORKS_IFELSE([
Packit 514978
      AC_MSG_RESULT([yes])
Packit 514978
      AC_MSG_NOTICE([compiler options added: $tmp_options])
Packit 514978
    ],[
Packit 514978
      AC_MSG_RESULT([no])
Packit 514978
      AC_MSG_WARN([compiler options rejected: $tmp_options])
Packit 514978
      dnl restore initial settings
Packit 514978
      CPPFLAGS="$tmp_save_CPPFLAGS"
Packit 514978
      CFLAGS="$tmp_save_CFLAGS"
Packit 514978
    ])
Packit 514978
    #
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_SET_COMPILER_OPTIMIZE_OPTS
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Sets compiler specific options/flags which depend
Packit 514978
dnl on configure's optimize option.
Packit 514978
Packit 514978
AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_OPTION_OPTIMIZE])dnl
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER])dnl
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  #
Packit 514978
  if test "$compiler_id" != "unknown"; then
Packit 514978
    #
Packit 514978
    tmp_save_CFLAGS="$CFLAGS"
Packit 514978
    tmp_save_CPPFLAGS="$CPPFLAGS"
Packit 514978
    #
Packit 514978
    tmp_options=""
Packit 514978
    tmp_CFLAGS="$CFLAGS"
Packit 514978
    tmp_CPPFLAGS="$CPPFLAGS"
Packit 514978
    honor_optimize_option="yes"
Packit 514978
    #
Packit 514978
    dnl If optimization request setting has not been explicitly specified,
Packit 514978
    dnl it has been derived from the debug setting and initially assumed.
Packit 514978
    dnl This initially assumed optimizer setting will finally be ignored
Packit 514978
    dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
Packit 514978
    dnl that an initially assumed optimizer setting might not be honored.
Packit 514978
    #
Packit 514978
    if test "$want_optimize" = "assume_no" ||
Packit 514978
       test "$want_optimize" = "assume_yes"; then
Packit 514978
      AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
Packit 514978
      CARES_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
Packit 514978
        honor_optimize_option="no"
Packit 514978
      ])
Packit 514978
      CARES_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
Packit 514978
        honor_optimize_option="no"
Packit 514978
      ])
Packit 514978
      AC_MSG_RESULT([$honor_optimize_option])
Packit 514978
      if test "$honor_optimize_option" = "yes"; then
Packit 514978
        if test "$want_optimize" = "assume_yes"; then
Packit 514978
          want_optimize="yes"
Packit 514978
        fi
Packit 514978
        if test "$want_optimize" = "assume_no"; then
Packit 514978
          want_optimize="no"
Packit 514978
        fi
Packit 514978
      fi
Packit 514978
    fi
Packit 514978
    #
Packit 514978
    if test "$honor_optimize_option" = "yes"; then
Packit 514978
      CARES_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
Packit 514978
      CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
Packit 514978
      if test "$want_optimize" = "yes"; then
Packit 514978
        AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
Packit 514978
        tmp_options="$flags_opt_yes"
Packit 514978
      fi
Packit 514978
      if test "$want_optimize" = "no"; then
Packit 514978
        AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
Packit 514978
        tmp_options="$flags_opt_off"
Packit 514978
      fi
Packit 514978
      if test "$flags_prefer_cppflags" = "yes"; then
Packit 514978
        CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
Packit 514978
        CFLAGS="$tmp_CFLAGS"
Packit 514978
      else
Packit 514978
        CPPFLAGS="$tmp_CPPFLAGS"
Packit 514978
        CFLAGS="$tmp_CFLAGS $tmp_options"
Packit 514978
      fi
Packit 514978
      squeeze CPPFLAGS
Packit 514978
      squeeze CFLAGS
Packit 514978
      CARES_COMPILER_WORKS_IFELSE([
Packit 514978
        AC_MSG_RESULT([yes])
Packit 514978
        AC_MSG_NOTICE([compiler options added: $tmp_options])
Packit 514978
      ],[
Packit 514978
        AC_MSG_RESULT([no])
Packit 514978
        AC_MSG_WARN([compiler options rejected: $tmp_options])
Packit 514978
        dnl restore initial settings
Packit 514978
        CPPFLAGS="$tmp_save_CPPFLAGS"
Packit 514978
        CFLAGS="$tmp_save_CFLAGS"
Packit 514978
      ])
Packit 514978
    fi
Packit 514978
    #
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_SET_COMPILER_WARNING_OPTS
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Sets compiler options/flags which depend on
Packit 514978
dnl configure's warnings given option.
Packit 514978
Packit 514978
AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_OPTION_WARNINGS])dnl
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER])dnl
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  #
Packit 514978
  if test "$compiler_id" != "unknown"; then
Packit 514978
    #
Packit 514978
    tmp_save_CPPFLAGS="$CPPFLAGS"
Packit 514978
    tmp_save_CFLAGS="$CFLAGS"
Packit 514978
    tmp_CPPFLAGS=""
Packit 514978
    tmp_CFLAGS=""
Packit 514978
    #
Packit 514978
    case "$compiler_id" in
Packit 514978
        #
Packit 514978
      CLANG)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -pedantic"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wshadow"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wundef"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32"
Packit 514978
          #
Packit 514978
          dnl Only clang 1.1 or later
Packit 514978
          if test "$compiler_num" -ge "101"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wunused"
Packit 514978
          fi
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      DEC_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Select a higher warning level than default level2
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      GNU_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          #
Packit 514978
          dnl Do not enable -pedantic when cross-compiling with a gcc older
Packit 514978
          dnl than 3.0, to avoid warnings from third party system headers.
Packit 514978
          if test "x$cross_compiling" != "xyes" ||
Packit 514978
            test "$compiler_num" -ge "300"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -pedantic"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Set of options we believe *ALL* gcc versions support:
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wall -W"
Packit 514978
          #
Packit 514978
          dnl Only gcc 1.4 or later
Packit 514978
          if test "$compiler_num" -ge "104"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
Packit 514978
            dnl If not cross-compiling with a gcc older than 3.0
Packit 514978
            if test "x$cross_compiling" != "xyes" ||
Packit 514978
              test "$compiler_num" -ge "300"; then
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow"
Packit 514978
            fi
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 2.7 or later
Packit 514978
          if test "$compiler_num" -ge "207"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
Packit 514978
            dnl If not cross-compiling with a gcc older than 3.0
Packit 514978
            if test "x$cross_compiling" != "xyes" ||
Packit 514978
              test "$compiler_num" -ge "300"; then
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
Packit 514978
            fi
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 2.95 or later
Packit 514978
          if test "$compiler_num" -ge "295"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 2.96 or later
Packit 514978
          if test "$compiler_num" -ge "296"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
Packit 514978
            dnl -Wundef used only if gcc is 2.96 or later since we get
Packit 514978
            dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
Packit 514978
            dnl headers with gcc 2.95.4 on FreeBSD 4.9
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wundef"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 2.97 or later
Packit 514978
          if test "$compiler_num" -ge "297"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 3.0 or later
Packit 514978
          if test "$compiler_num" -ge "300"; then
Packit 514978
            dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
Packit 514978
            dnl on i686-Linux as it gives us heaps with false positives.
Packit 514978
            dnl Also, on gcc 4.0.X it is totally unbearable and complains all
Packit 514978
            dnl over making it unusable for generic purposes. Let's not use it.
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 3.3 or later
Packit 514978
          if test "$compiler_num" -ge "303"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 3.4 or later
Packit 514978
          if test "$compiler_num" -ge "304"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 4.0 or later
Packit 514978
          if test "$compiler_num" -ge "400"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 4.2 or later
Packit 514978
          if test "$compiler_num" -ge "402"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 4.3 or later
Packit 514978
          if test "$compiler_num" -ge "403"; then
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
Packit 514978
            tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
Packit 514978
          fi
Packit 514978
          #
Packit 514978
          dnl Only gcc 4.5 or later
Packit 514978
          if test "$compiler_num" -ge "405"; then
Packit 514978
            dnl Only windows targets
Packit 514978
            if test "$curl_cv_have_def__WIN32" = "yes"; then
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
Packit 514978
            fi
Packit 514978
          fi
Packit 514978
          #
Packit 514978
        fi
Packit 514978
        #
Packit 514978
        dnl Do not issue warnings for code in system include paths.
Packit 514978
        if test "$compiler_num" -ge "300"; then
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
Packit 514978
        else
Packit 514978
          dnl When cross-compiling with a gcc older than 3.0, disable
Packit 514978
          dnl some warnings triggered on third party system headers.
Packit 514978
          if test "x$cross_compiling" = "xyes"; then
Packit 514978
            if test "$compiler_num" -ge "104"; then
Packit 514978
              dnl gcc 1.4 or later
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
Packit 514978
            fi
Packit 514978
            if test "$compiler_num" -ge "207"; then
Packit 514978
              dnl gcc 2.7 or later
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
Packit 514978
              tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
Packit 514978
            fi
Packit 514978
          fi
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      HP_UX_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Issue all warnings
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS +w1"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      IBM_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      INTEL_UNIX_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          if test "$compiler_num" -gt "600"; then
Packit 514978
            dnl Show errors, warnings, and remarks
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
Packit 514978
            dnl Perform extra compile-time code checking
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
Packit 514978
            dnl Warn on nested comments
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
Packit 514978
            dnl Show warnings relative to deprecated features
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
Packit 514978
            dnl Enable warnings for missing prototypes
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
Packit 514978
            dnl Enable warnings for 64-bit portability issues
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
Packit 514978
            dnl Enable warnings for questionable pointer arithmetic
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
Packit 514978
            dnl Check for function return typw issues
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
Packit 514978
            dnl Warn on variable declarations hiding a previous one
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
Packit 514978
            dnl Warn when a variable is used before initialized
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
Packit 514978
            dnl Warn if a declared function is not used
Packit 514978
            tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
Packit 514978
          fi
Packit 514978
        fi
Packit 514978
        dnl Disable using EBP register in optimizations
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
Packit 514978
        dnl Disable use of ANSI C aliasing rules in optimizations
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
Packit 514978
        dnl Value-safe optimizations on floating-point data
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
Packit 514978
        dnl Only icc 10.0 or later
Packit 514978
        if test "$compiler_num" -ge "1000"; then
Packit 514978
          dnl Disable vectorizer diagnostic information
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -vec-report0"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      INTEL_WINDOWS_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      LCC)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Highest warning level is double -A, next is single -A.
Packit 514978
          dnl Due to the big number of warnings these trigger on third
Packit 514978
          dnl party header files it is impractical for us to use any of
Packit 514978
          dnl them here. If you want them simply define it in CPPFLAGS.
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      SGI_MIPS_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Perform stricter semantic and lint-like checks
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      SGI_MIPSPRO_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Perform stricter semantic and lint-like checks
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
Packit 514978
          dnl Disable some remarks
Packit 514978
          dnl #1209: controlling expression is constant
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      SUNPRO_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Perform stricter semantic and lint-like checks
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -v"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      TINY_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Activate all warnings
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wall"
Packit 514978
          dnl Make string constants be of type const char *
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
Packit 514978
          dnl Warn use of unsupported GCC features ignored by TCC
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      WATCOM_UNIX_C)
Packit 514978
        #
Packit 514978
        if test "$want_warnings" = "yes"; then
Packit 514978
          dnl Issue all warnings
Packit 514978
          tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
Packit 514978
        fi
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
      WATCOM_WINDOWS_C)
Packit 514978
        #
Packit 514978
        dnl Placeholder
Packit 514978
        tmp_CFLAGS="$tmp_CFLAGS"
Packit 514978
        ;;
Packit 514978
        #
Packit 514978
    esac
Packit 514978
    #
Packit 514978
    squeeze tmp_CPPFLAGS
Packit 514978
    squeeze tmp_CFLAGS
Packit 514978
    #
Packit 514978
    if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
Packit 514978
      AC_MSG_CHECKING([if compiler accepts strict warning options])
Packit 514978
      CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
Packit 514978
      CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
Packit 514978
      squeeze CPPFLAGS
Packit 514978
      squeeze CFLAGS
Packit 514978
      CARES_COMPILER_WORKS_IFELSE([
Packit 514978
        AC_MSG_RESULT([yes])
Packit 514978
        AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
Packit 514978
      ],[
Packit 514978
        AC_MSG_RESULT([no])
Packit 514978
        AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
Packit 514978
        dnl restore initial settings
Packit 514978
        CPPFLAGS="$tmp_save_CPPFLAGS"
Packit 514978
        CFLAGS="$tmp_save_CFLAGS"
Packit 514978
      ])
Packit 514978
    fi
Packit 514978
    #
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_SHFUNC_SQUEEZE
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Declares a shell function squeeze() which removes
Packit 514978
dnl redundant whitespace out of a shell variable.
Packit 514978
Packit 514978
AC_DEFUN([CARES_SHFUNC_SQUEEZE], [
Packit 514978
squeeze() {
Packit 514978
  _sqz_result=""
Packit 514978
  eval _sqz_input=\[$][$]1
Packit 514978
  for _sqz_token in $_sqz_input; do
Packit 514978
    if test -z "$_sqz_result"; then
Packit 514978
      _sqz_result="$_sqz_token"
Packit 514978
    else
Packit 514978
      _sqz_result="$_sqz_result $_sqz_token"
Packit 514978
    fi
Packit 514978
  done
Packit 514978
  eval [$]1=\$_sqz_result
Packit 514978
  return 0
Packit 514978
}
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_CURLDEBUG
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Settings which depend on configure's curldebug given
Packit 514978
dnl option, and other additional configure pre-requisites.
Packit 514978
dnl Using the curl debug memory tracking feature in c-ares
Packit 514978
dnl is a hack that actually can only be used/enabled when
Packit 514978
dnl c-ares is built directly in curl's CVS tree, as a static
Packit 514978
dnl library or as a shared one on those systems on which
Packit 514978
dnl shared libraries support undefined symbols, along with
Packit 514978
dnl an equally configured libcurl.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_CURLDEBUG], [
Packit 514978
  AC_REQUIRE([XC_LIBTOOL])dnl
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  cares_builddir=`pwd`
Packit 514978
  supports_curldebug="unknown"
Packit 514978
  if test "$want_curldebug" = "yes"; then
Packit 514978
    if test "x$enable_shared" != "xno" &&
Packit 514978
      test "x$enable_shared" != "xyes"; then
Packit 514978
      AC_MSG_WARN([unknown enable_shared setting.])
Packit 514978
      supports_curldebug="no"
Packit 514978
    fi
Packit 514978
    if test "x$enable_static" != "xno" &&
Packit 514978
      test "x$enable_static" != "xyes"; then
Packit 514978
      AC_MSG_WARN([unknown enable_static setting.])
Packit 514978
      supports_curldebug="no"
Packit 514978
    fi
Packit 514978
    if test "$supports_curldebug" != "no"; then
Packit 514978
      if test "$enable_shared" = "yes" &&
Packit 514978
        test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then
Packit 514978
        supports_curldebug="no"
Packit 514978
        AC_MSG_WARN([shared library does not support undefined symbols.])
Packit 514978
      fi
Packit 514978
      if test ! -f "$srcdir/../include/curl/curlbuild.h.dist"; then
Packit 514978
        AC_MSG_WARN([c-ares source not embedded in curl's CVS tree.])
Packit 514978
        supports_curldebug="no"
Packit 514978
      elif test ! -f "$srcdir/../include/curl/Makefile.in"; then
Packit 514978
        AC_MSG_WARN([curl's buildconf has not been run.])
Packit 514978
        supports_curldebug="no"
Packit 514978
      elif test ! -f "$cares_builddir/../libcurl.pc" ||
Packit 514978
        test ! -f "$cares_builddir/../include/curl/curlbuild.h"; then
Packit 514978
        AC_MSG_WARN([curl's configure has not been run.])
Packit 514978
        supports_curldebug="no"
Packit 514978
      elif test ! -f "$cares_builddir/../lib/curl_config.h"; then
Packit 514978
        AC_MSG_WARN([libcurl's curl_config.h is missing.])
Packit 514978
        supports_curldebug="no"
Packit 514978
      elif test ! -f "$cares_builddir/../config.status"; then
Packit 514978
        AC_MSG_WARN([curl's config.status is missing.])
Packit 514978
        supports_curldebug="no"
Packit 514978
      fi
Packit 514978
      if test "$supports_curldebug" != "no"; then
Packit 514978
        grep '^#define USE_ARES' "$cares_builddir/../lib/curl_config.h" >/dev/null
Packit 514978
        if test "$?" -ne "0"; then
Packit 514978
          AC_MSG_WARN([libcurl configured without c-ares support.])
Packit 514978
          supports_curldebug="no"
Packit 514978
        fi
Packit 514978
      fi
Packit 514978
      if test "$supports_curldebug" != "no"; then
Packit 514978
        grep 'CPPFLAGS.*CURLDEBUG' "$cares_builddir/../config.status" >/dev/null
Packit 514978
        if test "$?" -ne "0"; then
Packit 514978
          AC_MSG_WARN([libcurl configured without curldebug support.])
Packit 514978
          supports_curldebug="no"
Packit 514978
        fi
Packit 514978
      fi
Packit 514978
    fi
Packit 514978
  fi
Packit 514978
  #
Packit 514978
  if test "$want_curldebug" = "yes"; then
Packit 514978
    AC_MSG_CHECKING([if curl debug memory tracking can be enabled])
Packit 514978
    test "$supports_curldebug" = "no" || supports_curldebug="yes"
Packit 514978
    AC_MSG_RESULT([$supports_curldebug])
Packit 514978
    if test "$supports_curldebug" = "no"; then
Packit 514978
      AC_MSG_WARN([cannot enable curl debug memory tracking.])
Packit 514978
      want_curldebug="no"
Packit 514978
    fi
Packit 514978
  fi
Packit 514978
  #
Packit 514978
  if test "$want_curldebug" = "yes"; then
Packit 514978
    dnl TODO: Verify if the BUILDING_LIBCURL definition is still required.
Packit 514978
    AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
Packit 514978
    CPPFLAGS="-DCURLDEBUG $CPPFLAGS"
Packit 514978
    squeeze CPPFLAGS
Packit 514978
  fi
Packit 514978
  #
Packit 514978
  if test "$want_debug" = "yes"; then
Packit 514978
    CPPFLAGS="-DDEBUGBUILD $CPPFLAGS"
Packit 514978
    squeeze CPPFLAGS
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_HALT_ON_ERROR
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verifies if the compiler actually halts after the
Packit 514978
dnl compilation phase without generating any object
Packit 514978
dnl code file, when the source compiles with errors.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_HALT_ON_ERROR], [
Packit 514978
  AC_MSG_CHECKING([if compiler halts on compilation errors])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
    ]],[[
Packit 514978
      force compilation error
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
    AC_MSG_ERROR([compiler does not halt on compilation errors.])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verifies if the compiler actually halts after the
Packit 514978
dnl compilation phase without generating any object
Packit 514978
dnl code file, when the source code tries to define a
Packit 514978
dnl type for a constant array with negative dimension.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER_HALT_ON_ERROR])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler halts on negative sized arrays])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
      typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
Packit 514978
    ]],[[
Packit 514978
      bad_t dummy;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
    AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verifies if the compiler is capable of handling the
Packit 514978
dnl size of a struct member, struct which is a function
Packit 514978
dnl result, as a compilation-time condition inside the
Packit 514978
dnl type definition of a constant array.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler struct member size checking works])
Packit 514978
  tst_compiler_check_one_works="unknown"
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
      struct mystruct {
Packit 514978
        int  mi;
Packit 514978
        char mc;
Packit 514978
        struct mystruct *next;
Packit 514978
      };
Packit 514978
      struct mystruct myfunc();
Packit 514978
      typedef char good_t1[sizeof(myfunc().mi) == sizeof(int)  ? 1 : -1 ];
Packit 514978
      typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
Packit 514978
    ]],[[
Packit 514978
      good_t1 dummy1;
Packit 514978
      good_t2 dummy2;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    tst_compiler_check_one_works="yes"
Packit 514978
  ],[
Packit 514978
    tst_compiler_check_one_works="no"
Packit 514978
    sed 's/^/cc-src: /' conftest.$ac_ext >&6
Packit 514978
    sed 's/^/cc-err: /' conftest.err >&6
Packit 514978
  ])
Packit 514978
  tst_compiler_check_two_works="unknown"
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
      struct mystruct {
Packit 514978
        int  mi;
Packit 514978
        char mc;
Packit 514978
        struct mystruct *next;
Packit 514978
      };
Packit 514978
      struct mystruct myfunc();
Packit 514978
      typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int)  ? 1 : -1 ];
Packit 514978
      typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
Packit 514978
    ]],[[
Packit 514978
      bad_t1 dummy1;
Packit 514978
      bad_t2 dummy2;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    tst_compiler_check_two_works="no"
Packit 514978
  ],[
Packit 514978
    tst_compiler_check_two_works="yes"
Packit 514978
  ])
Packit 514978
  if test "$tst_compiler_check_one_works" = "yes" &&
Packit 514978
    test "$tst_compiler_check_two_works" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
    AC_MSG_ERROR([compiler fails struct member size checking.])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_SYMBOL_HIDING
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verify if compiler supports hiding library internal symbols, setting
Packit 514978
dnl shell variable supports_symbol_hiding value as appropriate, as well as
Packit 514978
dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_SYMBOL_HIDING], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER])dnl
Packit 514978
  AC_BEFORE([$0],[CARES_CONFIGURE_SYMBOL_HIDING])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
Packit 514978
  supports_symbol_hiding="no"
Packit 514978
  symbol_hiding_CFLAGS=""
Packit 514978
  symbol_hiding_EXTERN=""
Packit 514978
  tmp_CFLAGS=""
Packit 514978
  tmp_EXTERN=""
Packit 514978
  case "$compiler_id" in
Packit 514978
    CLANG)
Packit 514978
      dnl All versions of clang support -fvisibility=
Packit 514978
      tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
Packit 514978
      tmp_CFLAGS="-fvisibility=hidden"
Packit 514978
      supports_symbol_hiding="yes"
Packit 514978
      ;;
Packit 514978
    GNU_C)
Packit 514978
      dnl Only gcc 3.4 or later
Packit 514978
      if test "$compiler_num" -ge "304"; then
Packit 514978
        if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
Packit 514978
          tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
Packit 514978
          tmp_CFLAGS="-fvisibility=hidden"
Packit 514978
          supports_symbol_hiding="yes"
Packit 514978
        fi
Packit 514978
      fi
Packit 514978
      ;;
Packit 514978
    INTEL_UNIX_C)
Packit 514978
      dnl Only icc 9.0 or later
Packit 514978
      if test "$compiler_num" -ge "900"; then
Packit 514978
        if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
Packit 514978
          tmp_save_CFLAGS="$CFLAGS"
Packit 514978
          CFLAGS="$CFLAGS -fvisibility=hidden"
Packit 514978
          AC_LINK_IFELSE([
Packit 514978
            AC_LANG_PROGRAM([[
Packit 514978
#             include <stdio.h>
Packit 514978
            ]],[[
Packit 514978
              printf("icc fvisibility bug test");
Packit 514978
            ]])
Packit 514978
          ],[
Packit 514978
            tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
Packit 514978
            tmp_CFLAGS="-fvisibility=hidden"
Packit 514978
            supports_symbol_hiding="yes"
Packit 514978
          ])
Packit 514978
          CFLAGS="$tmp_save_CFLAGS"
Packit 514978
        fi
Packit 514978
      fi
Packit 514978
      ;;
Packit 514978
    SUNPRO_C)
Packit 514978
      if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
Packit 514978
        tmp_EXTERN="__global"
Packit 514978
        tmp_CFLAGS="-xldscope=hidden"
Packit 514978
        supports_symbol_hiding="yes"
Packit 514978
      fi
Packit 514978
      ;;
Packit 514978
  esac
Packit 514978
  if test "$supports_symbol_hiding" = "yes"; then
Packit 514978
    tmp_save_CFLAGS="$CFLAGS"
Packit 514978
    CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
Packit 514978
    squeeze CFLAGS
Packit 514978
    AC_COMPILE_IFELSE([
Packit 514978
      AC_LANG_PROGRAM([[
Packit 514978
        $tmp_EXTERN char *dummy(char *buff);
Packit 514978
        char *dummy(char *buff)
Packit 514978
        {
Packit 514978
         if(buff)
Packit 514978
           return ++buff;
Packit 514978
         else
Packit 514978
           return buff;
Packit 514978
        }
Packit 514978
      ]],[[
Packit 514978
        char b[16];
Packit 514978
        char *r = dummy(&b[0]);
Packit 514978
        if(r)
Packit 514978
          return (int)*r;
Packit 514978
      ]])
Packit 514978
    ],[
Packit 514978
      supports_symbol_hiding="yes"
Packit 514978
      if test -f conftest.err; then
Packit 514978
        grep 'visibility' conftest.err >/dev/null
Packit 514978
        if test "$?" -eq "0"; then
Packit 514978
          supports_symbol_hiding="no"
Packit 514978
        fi
Packit 514978
      fi
Packit 514978
    ],[
Packit 514978
      supports_symbol_hiding="no"
Packit 514978
      echo " " >&6
Packit 514978
      sed 's/^/cc-src: /' conftest.$ac_ext >&6
Packit 514978
      sed 's/^/cc-err: /' conftest.err >&6
Packit 514978
      echo " " >&6
Packit 514978
    ])
Packit 514978
    CFLAGS="$tmp_save_CFLAGS"
Packit 514978
  fi
Packit 514978
  if test "$supports_symbol_hiding" = "yes"; then
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
    symbol_hiding_CFLAGS="$tmp_CFLAGS"
Packit 514978
    symbol_hiding_EXTERN="$tmp_EXTERN"
Packit 514978
  else
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verifies if the compiler actually halts after the
Packit 514978
dnl compilation phase without generating any object
Packit 514978
dnl code file, when the source code tries to redefine
Packit 514978
dnl a prototype which does not match previous one.
Packit 514978
Packit 514978
AC_DEFUN([CARES_CHECK_COMPILER_PROTOTYPE_MISMATCH], [
Packit 514978
  AC_REQUIRE([CARES_CHECK_COMPILER_HALT_ON_ERROR])dnl
Packit 514978
  AC_MSG_CHECKING([if compiler halts on function prototype mismatch])
Packit 514978
  AC_COMPILE_IFELSE([
Packit 514978
    AC_LANG_PROGRAM([[
Packit 514978
#     include <stdlib.h>
Packit 514978
      int rand(int n);
Packit 514978
      int rand(int n)
Packit 514978
      {
Packit 514978
        if(n)
Packit 514978
          return ++n;
Packit 514978
        else
Packit 514978
          return n;
Packit 514978
      }
Packit 514978
    ]],[[
Packit 514978
      int i[2];
Packit 514978
      int j = rand(i[0]);
Packit 514978
      if(j)
Packit 514978
        return j;
Packit 514978
    ]])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([no])
Packit 514978
    AC_MSG_ERROR([compiler does not halt on function prototype mismatch.])
Packit 514978
  ],[
Packit 514978
    AC_MSG_RESULT([yes])
Packit 514978
  ])
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_VAR_MATCH (VARNAME, VALUE)
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Verifies if shell variable VARNAME contains VALUE.
Packit 514978
dnl Contents of variable VARNAME and VALUE are handled
Packit 514978
dnl as whitespace separated lists of words. If at least
Packit 514978
dnl one word of VALUE is present in VARNAME the match
Packit 514978
dnl is considered positive, otherwise false.
Packit 514978
Packit 514978
AC_DEFUN([CARES_VAR_MATCH], [
Packit 514978
  ac_var_match_word="no"
Packit 514978
  for word1 in $[$1]; do
Packit 514978
    for word2 in [$2]; do
Packit 514978
      if test "$word1" = "$word2"; then
Packit 514978
        ac_var_match_word="yes"
Packit 514978
      fi
Packit 514978
    done
Packit 514978
  done
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_VAR_MATCH_IFELSE (VARNAME, VALUE,
Packit 514978
dnl                        [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl This performs a CURL_VAR_MATCH check and executes
Packit 514978
dnl first branch if the match is positive, otherwise
Packit 514978
dnl the second branch is executed.
Packit 514978
Packit 514978
AC_DEFUN([CARES_VAR_MATCH_IFELSE], [
Packit 514978
  CARES_VAR_MATCH([$1],[$2])
Packit 514978
  if test "$ac_var_match_word" = "yes"; then
Packit 514978
  ifelse($3,,:,[$3])
Packit 514978
  ifelse($4,,,[else
Packit 514978
    $4])
Packit 514978
  fi
Packit 514978
])
Packit 514978
Packit 514978
Packit 514978
dnl CARES_VAR_STRIP (VARNAME, VALUE)
Packit 514978
dnl -------------------------------------------------
Packit 514978
dnl Contents of variable VARNAME and VALUE are handled
Packit 514978
dnl as whitespace separated lists of words. Each word
Packit 514978
dnl from VALUE is removed from VARNAME when present.
Packit 514978
Packit 514978
AC_DEFUN([CARES_VAR_STRIP], [
Packit 514978
  AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
Packit 514978
  ac_var_stripped=""
Packit 514978
  for word1 in $[$1]; do
Packit 514978
    ac_var_strip_word="no"
Packit 514978
    for word2 in [$2]; do
Packit 514978
      if test "$word1" = "$word2"; then
Packit 514978
        ac_var_strip_word="yes"
Packit 514978
      fi
Packit 514978
    done
Packit 514978
    if test "$ac_var_strip_word" = "no"; then
Packit 514978
      ac_var_stripped="$ac_var_stripped $word1"
Packit 514978
    fi
Packit 514978
  done
Packit 514978
  dnl squeeze whitespace out of result
Packit 514978
  [$1]="$ac_var_stripped"
Packit 514978
  squeeze [$1]
Packit 514978
])
Packit 514978