autoconf: Use m4 conditionals where possible.

Change-Id: I530c0a72f965437acef6a9a4fbfe5c487f078b65
This commit is contained in:
Corey Farrell
2017-11-17 11:38:48 -05:00
parent 635fe8ec87
commit 6274e58a25
7 changed files with 1862 additions and 3481 deletions

View File

@@ -117,15 +117,15 @@ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
pbxlibdir="-L${$1_DIR}"
fi
fi
pbxfuncname="$3"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
m4_ifblank([$3], [
# empty lib, assume only headers
AST_$1_FOUND=yes
else
], [
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} $6"
AC_CHECK_LIB([$2], [${pbxfuncname}], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], [${pbxlibdir} $5])
AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], [${pbxlibdir} $5])
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
fi
])
# now check for the header.
if test "${AST_$1_FOUND}" = "yes"; then
@@ -135,21 +135,24 @@ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
$1_INCLUDE="-I${$1_DIR}/include"
fi
$1_INCLUDE="${$1_INCLUDE} $6"
if test "x$4" = "x" ; then # no header, assume found
m4_ifblank([$4], [
# no header, assume found
$1_HEADER_FOUND="1"
else # check for the header
], [
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0])
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
fi
])
if test "x${$1_HEADER_FOUND}" = "x0" ; then
$1_LIB=""
$1_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
m4_ifblank([$3], [
# only checking headers -> no library
$1_LIB=""
fi
])
PBX_$1=1
cat >>confdefs.h <<_ACEOF
[@%:@define] HAVE_$1 1