@ -42,8 +42,7 @@ AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS
AX_CXX_COMPILE_STDCXX_14([noext],[optional])
AX_CXX_COMPILE_STDCXX_14([noext],[optional])
AM_INIT_AUTOMAKE([foreign subdir-objects 1.9.6])
AM_INIT_AUTOMAKE([foreign subdir-objects 1.9.6])
AC_ENABLE_SHARED
LT_INIT([win32-dll,pic,disable-fast-install,aix-soname=svr4])
LT_INIT([win32-dll,shared,pic,disable-fast-install,aix-soname=svr4])
AC_LANG([C])
AC_LANG([C])
AC_PROG_CC
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_CC_C_O
@ -52,6 +51,31 @@ AC_PROG_INSTALL
AC_CANONICAL_HOST
AC_CANONICAL_HOST
AX_COMPILER_VENDOR
AX_COMPILER_VENDOR
AC_MSG_CHECKING([whether this is native windows])
ac_cv_native_windows=no
ac_cv_windows=no
case $host_os in
mingw*)
ac_cv_native_windows=yes
ac_cv_windows=yes
;;
cygwin*)
ac_cv_windows=yes
;;
esac
if test "$ax_cv_c_compiler_vendor" = "microsoft" ; then
ac_cv_native_windows=yes
ac_cv_windows=yes
fi
AC_MSG_RESULT($ac_cv_native_windows)
AC_ENABLE_SHARED
dnl Disable static builds by default on Windows unless overwritten since Windows
dnl can't simultaneously build shared and static with autotools.
AS_IF([test "x$ac_cv_windows" = "xyes"], [AC_DISABLE_STATIC], [AC_ENABLE_STATIC])
AC_ARG_ENABLE(warnings,
AC_ARG_ENABLE(warnings,
AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
AS_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]),
[ enable_warnings=${enableval} ],
[ enable_warnings=${enableval} ],
@ -162,39 +186,20 @@ esac
AM_CONDITIONAL([CARES_USE_NO_UNDEFINED], [test "$cares_use_no_undefined" = 'yes'])
AM_CONDITIONAL([CARES_USE_NO_UNDEFINED], [test "$cares_use_no_undefined" = 'yes'])
AC_MSG_CHECKING([whether this is native windows])
ac_cv_native_windows=no
ac_cv_windows=no
case $host_os in
mingw*)
ac_cv_native_windows=yes
ac_cv_windows=yes
;;
cygwin*)
ac_cv_windows=yes
;;
esac
if test "$ax_cv_c_compiler_vendor" = "microsoft" ; then
ac_cv_native_windows=yes
ac_cv_windows=yes
fi
if test "$ac_cv_native_windows" = "yes" ; then
if test "$ac_cv_native_windows" = "yes" ; then
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0602 -DWIN32_LEAN_AND_MEAN"
AM_CPPFLAGS="$AM_CPPFLAGS -D_WIN32_WINNT=0x0602 -DWIN32_LEAN_AND_MEAN"
fi
fi
AC_MSG_RESULT($ac_cv_native_windows)
dnl Disable static builds by default on Windows unless overwritten since Windows
dnl Windows can only build shared or static, not both at the same time
dnl can't simultaneously build shared and static with autotools.
if test "$ac_cv_native_windows" = "yes" -a "x$enable_shared" = "xyes" -a "x$enable_static" = "xyes" ; then
if test "x$ac_cv_windows" = "xyes" ; then
AC_MSG_ERROR([Windows cannot build both static and shared simultaneously, specify --disable-shared or --disable-static])
AC_DISABLE_STATIC
fi
fi
dnl Only windows requires CARES_STATICLIB definition
dnl Only windows requires CARES_STATICLIB definition
if test "x$enable_shared" = "xno" -a "x$enable_static" = "xyes" ; then
if test "x$enable_shared" = "xno" -a "x$enable_static" = "xyes" ; then
AC_MSG_CHECKING([whether we need CARES_STATICLIB definition])
AC_MSG_CHECKING([whether we need CARES_STATICLIB definition])
if test "$ac_cv_native_windows" = "yes" ; then
if test "$ac_cv_native_windows" = "yes" ; then
AX_APPEND_FLAG([-DCARES_STATICLIB], [CPPFLAGS])
AX_APPEND_FLAG([-DCARES_STATICLIB], [AM_CPPFLAGS])
AC_MSG_RESULT([yes])
AC_MSG_RESULT([yes])
else
else
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
@ -274,11 +279,11 @@ if test "$enable_warnings" = "yes"; then
-Werror=implicit-int \
-Werror=implicit-int \
-Werror=implicit-function-declaration \
-Werror=implicit-function-declaration \
-Werror=partial-availability \
-Werror=partial-availability \
], [CFLAGS], [-Werror])
], [AM_ CFLAGS], [-Werror])
fi
fi
if test "$ax_cv_c_compiler_vendor" = "intel"; then
if test "$ax_cv_c_compiler_vendor" = "intel"; then
CFLAGS="$CFLAGS -shared-intel"
AX_APPEND_COMPILE_FLAGS([-shared-intel], [AM_CFLAGS])
fi
fi
if test "$ac_cv_native_windows" = "yes" ; then
if test "$ac_cv_native_windows" = "yes" ; then
@ -818,7 +823,7 @@ if test "${CARES_THREADS}" = "yes" -a "x${ac_cv_native_windows}" != "xyes" ; the
if test "${CARES_THREADS}" = "yes" ; then
if test "${CARES_THREADS}" = "yes" ; then
AC_CHECK_HEADERS([pthread.h pthread_np.h])
AC_CHECK_HEADERS([pthread.h pthread_np.h])
LIBS="$PTHREAD_LIBS $LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AM_ CFLAGS="$AM_ CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
CC="$PTHREAD_CC"
CXX="$PTHREAD_CXX"
CXX="$PTHREAD_CXX"
fi
fi
@ -876,9 +881,10 @@ fi
AC_MSG_CHECKING([whether to build tests])
AC_MSG_CHECKING([whether to build tests])
AC_MSG_RESULT([$build_tests])
AC_MSG_RESULT([$build_tests])
AM_CONDITIONAL(BUILD_TESTS, test "x$build_tests" = "xyes")
AM_CONDITIONAL(BUILD_TESTS, test "x$build_tests" = "xyes")
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(BUILD_SUBDIRS)
AC_SUBST(BUILD_SUBDIRS)
AC_CONFIG_FILES([Makefile \
AC_CONFIG_FILES([Makefile \