From 738d19a4cfb194479e9e0c4a474df6b62c57f4b4 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 5 Aug 2017 18:01:41 +0200 Subject: [PATCH] build: Prefer AC_CHECK_TYPE() over AC_LINK_IFELSE(). Both invocations of AC_LINK_IFELSE() check if a C structure is defined. We don't need to run the linker for that, saving a few cycles on Linux systems where both structures are defined. --- configure.ac | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index 811364b1..b6aac81b 100644 --- a/configure.ac +++ b/configure.ac @@ -163,17 +163,12 @@ AC_DEFINE_UNQUOTED(ICONV_CAST, $cast, [cast for second arg to iconv()]) AC_MSG_RESULT($msg) UNSTASH_FLAGS ########################################################################### ucred -AC_MSG_CHECKING(for struct ucred) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +AC_CHECK_TYPE([struct ucred], [ + AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred) +], [], [ #include #include -]], [[ - struct ucred sucred; sucred.pid=0; -]])],[have_ucred=yes],[have_ucred=no]) -AC_MSG_RESULT($have_ucred) -if test ${have_ucred} = yes; then - AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred) -fi +]) ########################################################################### curses STASH_FLAGS LIB_ARG_WITH([curses], []) @@ -184,18 +179,12 @@ curses_ldflags="$curses_ldflags $LIBS" LIB_SUBST_FLAGS(curses) UNSTASH_FLAGS ########################################################################### ip_mreqn -AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast)) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +AC_CHECK_TYPE([struct ip_mreqn], [ + AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 if you have struct ip_mreqn) +], [], [ #include #include -]], [[ - struct ip_mreqn mn; - mn.imr_ifindex = 0; -]])],[have_ip_mreqn=yes],[have_ip_mreqn=no]) -AC_MSG_RESULT($have_ip_mreqn) -if test ${have_ip_mreqn} = yes; then - AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 if you have struct ip_mreqn) -fi +]) ########################################################################### ogg STASH_FLAGS LIB_ARG_WITH([ogg], [-logg]) -- 2.39.5