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 87a57e8d46
commit ce5cfc8ffb
7 changed files with 2048 additions and 3823 deletions

View File

@ -4,11 +4,7 @@
AC_DEFUN([AST_C_COMPILE_CHECK],
[
if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
if test "x$5" != "x"; then
AC_MSG_CHECKING([for $5])
else
AC_MSG_CHECKING([if "$2" compiles using $3])
fi
AC_MSG_CHECKING(m4_ifval([$5],[for $5],[if "$2" compiles using $3]))
saved_cppflags="${CPPFLAGS}"
if test "x${$1_DIR}" != "x"; then
$1_INCLUDE="-I${$1_DIR}/include"

View File

@ -191,11 +191,7 @@ fi
])
AC_DEFUN([AST_CHECK_PWLIB_VERSION], [
if test "x$7" != "x"; then
VNAME="$7"
else
VNAME="$2_VERSION"
fi
VNAME="m4_default([$7],[$2_VERSION])"
if test "${HAS_$2:-unset}" != "unset"; then
$2_VERSION=`grep "$VNAME \"" ${$2_INCDIR}/$3 | sed -e 's/[[[:space:]]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
@ -204,11 +200,7 @@ AC_DEFUN([AST_CHECK_PWLIB_VERSION], [
$2_BUILD_NUMBER=`echo ${$2_VERSION} | cut -f3 -d.`
$2_VER=$((${$2_MAJOR_VERSION}*10000+${$2_MINOR_VERSION}*100+${$2_BUILD_NUMBER}))
$2_REQ=$(($4*10000+$5*100+$6))
if test "x$10" = "x"; then
$2_MAX=9999999
else
$2_MAX=$(($8*10000+$9*100+$10))
fi
$2_MAX=m4_ifblank([$10], [9999999], [$(($8*10000+$9*100+$10))])
AC_MSG_CHECKING(if $1 version ${$2_VERSION} is compatible with chan_h323)
if test ${$2_VER} -lt ${$2_REQ}; then

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

View File

@ -10,15 +10,13 @@ AC_DEFUN([AST_EXT_TOOL_CHECK],
PBX_$1=0
AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
if test ! "x${CONFIG_$1}" = xNo; then
if test x"$3" = x ; then A=--cflags ; else A="$3" ; fi
$1_INCLUDE=$(${CONFIG_$1} $A)
$1_INCLUDE=$(${CONFIG_$1} m4_default([$3],[--cflags]))
$1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-I|-I${$1_DIR}|g")
if test x"$4" = x ; then A=--libs ; else A="$4" ; fi
$1_LIB=$(${CONFIG_$1} $A)
$1_LIB=$(${CONFIG_$1} m4_default([$4],[--libs]))
$1_LIB=$(echo ${$1_LIB} | $SED -e "s|-L|-L${$1_DIR}|g")
if test x"$5" != x ; then
m4_ifval([$5], [
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
@ -28,15 +26,15 @@ AC_DEFUN([AST_EXT_TOOL_CHECK],
AC_LINK_IFELSE(
[ AC_LANG_PROGRAM( [ $5 ], [ $6; ])],
[ PBX_$1=1 AC_DEFINE([HAVE_$1], 1,
[Define if your system has the $1 headers.])],
[Define if your system has the $1 libraries.])],
[]
)
CPPFLAGS="${saved_cppflags}"
LIBS="${saved_libs}"
else
], [
PBX_$1=1
AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 libraries.])
fi
])
fi
fi
])

View File

@ -9,28 +9,17 @@ CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
m4_ifval([$4],$4=0)
ax_cv_have_func_attribute_$1=0
if test "x$2" = "x"
then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
[])],
[AC_LANG_PROGRAM(
m4_ifblank([$2],
[$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
[$3 void __attribute__(($2)) *test(void *muffin, ...) ;]))],
AC_MSG_RESULT(yes)
m4_ifval([$4],$4=1)
ax_cv_have_func_attribute_$1=1
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
AC_MSG_RESULT(no)
)
else
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) ;],
[])],
AC_MSG_RESULT(yes)
m4_ifval([$4],$4=1)
ax_cv_have_func_attribute_$1=1
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
AC_MSG_RESULT(no)
)
fi
m4_ifval([$4],[AC_SUBST($4)])
CFLAGS="$saved_CFLAGS"

5663
configure vendored

File diff suppressed because it is too large Load Diff

134
menuselect/configure vendored
View File

@ -3941,16 +3941,12 @@ if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
pbxlibdir="-L${NEWT_DIR}"
fi
fi
pbxfuncname="newtBell"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_NEWT_FOUND=yes
else
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
as_ac_Lib=`$as_echo "ac_cv_lib_newt_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnewt" >&5
$as_echo_n "checking for ${pbxfuncname} in -lnewt... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for newtBell in -lnewt" >&5
$as_echo_n "checking for newtBell in -lnewt... " >&6; }
if ${ac_cv_lib_newt_newtBell+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@ -3964,35 +3960,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char ${pbxfuncname} ();
char newtBell ();
int
main ()
{
return ${pbxfuncname} ();
return newtBell ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
ac_cv_lib_newt_newtBell=yes
else
eval "$as_ac_Lib=no"
ac_cv_lib_newt_newtBell=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_newt_newtBell" >&5
$as_echo "$ac_cv_lib_newt_newtBell" >&6; }
if test "x$ac_cv_lib_newt_newtBell" = xyes; then :
AST_NEWT_FOUND=yes
else
AST_NEWT_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
fi
# now check for the header.
if test "${AST_NEWT_FOUND}" = "yes"; then
@ -4002,9 +3997,8 @@ fi
NEWT_INCLUDE="-I${NEWT_DIR}/include"
fi
NEWT_INCLUDE="${NEWT_INCLUDE} "
if test "xnewt.h" = "x" ; then # no header, assume found
NEWT_HEADER_FOUND="1"
else # check for the header
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${NEWT_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "newt.h" "ac_cv_header_newt_h" "$ac_includes_default"
@ -4016,14 +4010,12 @@ fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
fi
if test "x${NEWT_HEADER_FOUND}" = "x0" ; then
NEWT_LIB=""
NEWT_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
NEWT_LIB=""
fi
PBX_NEWT=1
cat >>confdefs.h <<_ACEOF
#define HAVE_NEWT 1
@ -4045,16 +4037,12 @@ if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
pbxlibdir="-L${CURSES_DIR}"
fi
fi
pbxfuncname="initscr"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_CURSES_FOUND=yes
else
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
as_ac_Lib=`$as_echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcurses" >&5
$as_echo_n "checking for ${pbxfuncname} in -lcurses... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5
$as_echo_n "checking for initscr in -lcurses... " >&6; }
if ${ac_cv_lib_curses_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@ -4068,35 +4056,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char ${pbxfuncname} ();
char initscr ();
int
main ()
{
return ${pbxfuncname} ();
return initscr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
ac_cv_lib_curses_initscr=yes
else
eval "$as_ac_Lib=no"
ac_cv_lib_curses_initscr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_initscr" >&5
$as_echo "$ac_cv_lib_curses_initscr" >&6; }
if test "x$ac_cv_lib_curses_initscr" = xyes; then :
AST_CURSES_FOUND=yes
else
AST_CURSES_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
fi
# now check for the header.
if test "${AST_CURSES_FOUND}" = "yes"; then
@ -4106,9 +4093,8 @@ fi
CURSES_INCLUDE="-I${CURSES_DIR}/include"
fi
CURSES_INCLUDE="${CURSES_INCLUDE} "
if test "xcurses.h" = "x" ; then # no header, assume found
CURSES_HEADER_FOUND="1"
else # check for the header
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
@ -4120,14 +4106,12 @@ fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
fi
if test "x${CURSES_HEADER_FOUND}" = "x0" ; then
CURSES_LIB=""
CURSES_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
CURSES_LIB=""
fi
PBX_CURSES=1
cat >>confdefs.h <<_ACEOF
#define HAVE_CURSES 1
@ -4149,16 +4133,12 @@ if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then
pbxlibdir="-L${NCURSES_DIR}"
fi
fi
pbxfuncname="initscr"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_NCURSES_FOUND=yes
else
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
as_ac_Lib=`$as_echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lncurses" >&5
$as_echo_n "checking for ${pbxfuncname} in -lncurses... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5
$as_echo_n "checking for initscr in -lncurses... " >&6; }
if ${ac_cv_lib_ncurses_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@ -4172,35 +4152,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char ${pbxfuncname} ();
char initscr ();
int
main ()
{
return ${pbxfuncname} ();
return initscr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
ac_cv_lib_ncurses_initscr=yes
else
eval "$as_ac_Lib=no"
ac_cv_lib_ncurses_initscr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5
$as_echo "$ac_cv_lib_ncurses_initscr" >&6; }
if test "x$ac_cv_lib_ncurses_initscr" = xyes; then :
AST_NCURSES_FOUND=yes
else
AST_NCURSES_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
fi
# now check for the header.
if test "${AST_NCURSES_FOUND}" = "yes"; then
@ -4210,9 +4189,8 @@ fi
NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
fi
NCURSES_INCLUDE="${NCURSES_INCLUDE} "
if test "xcurses.h" = "x" ; then # no header, assume found
NCURSES_HEADER_FOUND="1"
else # check for the header
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
@ -4224,14 +4202,12 @@ fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
fi
if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
NCURSES_LIB=""
NCURSES_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
NCURSES_LIB=""
fi
PBX_NCURSES=1
cat >>confdefs.h <<_ACEOF
#define HAVE_NCURSES 1
@ -4415,16 +4391,13 @@ else
fi
if test ! "x${CONFIG_LIBXML2}" = xNo; then
if test x"" = x ; then A=--cflags ; else A="" ; fi
LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} $A)
LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} --cflags)
LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g")
if test x"" = x ; then A=--libs ; else A="" ; fi
LIBXML2_LIB=$(${CONFIG_LIBXML2} $A)
LIBXML2_LIB=$(${CONFIG_LIBXML2} --libs)
LIBXML2_LIB=$(echo ${LIBXML2_LIB} | $SED -e "s|-L|-L${LIBXML2_DIR}|g")
if test x"#include <libxml/tree.h>
#include <libxml/parser.h>" != x ; then
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LIBXML2_INCLUDE}"
@ -4452,12 +4425,7 @@ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CPPFLAGS="${saved_cppflags}"
LIBS="${saved_libs}"
else
PBX_LIBXML2=1
$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
fi
fi
fi