Skip to content
Snippets Groups Projects
Commit 84b9f5ef authored by Sean Bright's avatar Sean Bright
Browse files

Import Asterisk's autoconf magic instead of using our own.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent fc0fecb4
No related branches found
No related tags found
No related merge requests found
# Helper function to check for gcc attributes.
# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope], [makeopts flag])
AC_DEFUN([AST_GCC_ATTRIBUTE],
[
AC_MSG_CHECKING(checking for compiler 'attribute $1' support)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
m4_ifval([$4],$4=0)
if test "x$2" = "x"
then
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
[]),
AC_MSG_RESULT(yes)
m4_ifval([$4],$4=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, ...) {return (void *) 0;}],
[]),
AC_MSG_RESULT(yes)
m4_ifval([$4],$4=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"
])
# AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
AC_DEFUN([AST_EXT_LIB_SETUP],
[
$1_DESCRIP="$2"
$1_OPTION="$3"
AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[
case ${withval} in
n|no)
USE_$1=no
;;
y|ye|yes)
$1_MANDATORY="yes"
;;
*)
$1_DIR="${withval}"
$1_MANDATORY="yes"
;;
esac
])
PBX_$1=0
AC_SUBST([$1_LIB])
AC_SUBST([$1_INCLUDE])
AC_SUBST([PBX_$1])
])
# AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
AC_DEFUN([AST_EXT_LIB_CHECK],
[
if test "${USE_$1}" != "no"; then
pbxlibdir=""
if test "x${$1_DIR}" != "x"; then
if test -d ${$1_DIR}/lib; then
pbxlibdir="-L${$1_DIR}/lib"
else
pbxlibdir="-L${$1_DIR}"
fi
fi
AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
if test "${AST_$1_FOUND}" = "yes"; then
$1_LIB="-l$2 $5"
$1_HEADER_FOUND="1"
if test "x${$1_DIR}" != "x"; then
$1_LIB="${pbxlibdir} ${$1_LIB}"
$1_INCLUDE="-I${$1_DIR}/include"
if test "x$4" != "x" ; then
AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
fi
else
if test "x$4" != "x" ; then
AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
fi
fi
if test "x${$1_HEADER_FOUND}" = "x0" ; then
if test ! -z "${$1_MANDATORY}" ;
then
AC_MSG_NOTICE( ***)
AC_MSG_NOTICE( *** It appears that you do not have the $2 development package installed.)
AC_MSG_NOTICE( *** Please install it to include ${$1_DESCRIP} support, or re-run configure)
AC_MSG_NOTICE( *** without explicitly specifying --with-${$1_OPTION})
exit 1
fi
$1_LIB=""
$1_INCLUDE=""
PBX_$1=0
else
PBX_$1=1
AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
fi
elif test ! -z "${$1_MANDATORY}";
then
AC_MSG_NOTICE(***)
AC_MSG_NOTICE(*** The ${$1_DESCRIP} installation on this system appears to be broken.)
AC_MSG_NOTICE(*** Either correct the installation, or run configure)
AC_MSG_NOTICE(*** without explicitly specifying --with-${$1_OPTION})
exit 1
fi
fi
])
AC_DEFUN(
[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK([for GNU make], [ac_cv_GNU_MAKE],
ac_cv_GNU_MAKE='Not Found' ;
ac_cv_GNU_MAKE_VERSION_MAJOR=0 ;
ac_cv_GNU_MAKE_VERSION_MINOR=0 ;
for a in make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
ac_cv_GNU_MAKE=$a ;
ac_cv_GNU_MAKE_VERSION_MAJOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'`
ac_cv_GNU_MAKE_VERSION_MINOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2`
break;
fi
done ;
) ;
if test "x$ac_cv_GNU_MAKE" = "xNot Found" ; then
AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!)
exit 1
fi
AC_SUBST([GNU_MAKE], [$ac_cv_GNU_MAKE])
])
# AST_FUNC_FORK
# -------------
AN_FUNCTION([fork], [AST_FUNC_FORK])
AN_FUNCTION([vfork], [AST_FUNC_FORK])
AC_DEFUN([AST_FUNC_FORK],
[AC_REQUIRE([AC_TYPE_PID_T])dnl
AC_CHECK_HEADERS(vfork.h)
AC_CHECK_FUNCS(fork vfork)
if test "x$ac_cv_func_fork" = xyes; then
_AST_FUNC_FORK
else
ac_cv_func_fork_works=$ac_cv_func_fork
fi
if test "x$ac_cv_func_fork_works" = xcross; then
case $host in
*-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* | *-*-linux-uclibc* )
# Override, as these systems have only a dummy fork() stub
ac_cv_func_fork_works=no
;;
*)
ac_cv_func_fork_works=yes
;;
esac
AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
if test "x$ac_cv_func_vfork" = xyes; then
_AC_FUNC_VFORK
fi;
if test "x$ac_cv_func_fork_works" = xcross; then
ac_cv_func_vfork_works=$ac_cv_func_vfork
AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
fi
if test "x$ac_cv_func_vfork_works" = xyes; then
AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
else
AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
fi
if test "x$ac_cv_func_fork_works" = xyes; then
AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
fi
])# AST_FUNC_FORK
# _AST_FUNC_FORK
# -------------
AC_DEFUN([_AST_FUNC_FORK],
[AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[
/* By Ruediger Kuhlmann. */
return fork () < 0;
])],
[ac_cv_func_fork_works=yes],
[ac_cv_func_fork_works=no],
[ac_cv_func_fork_works=cross])])]
)# _AST_FUNC_FORK
# Check for a package using $2-config. Similar to AST_EXT_LIB_CHECK,
# but use $2-config to determine cflags and libraries to use.
# $3 and $4 can be used to replace --cflags and --libs in the request
# AST_EXT_TOOL_CHECK([package], [tool name], [--cflags], [--libs], [includes], [expression])
AC_DEFUN([AST_EXT_TOOL_CHECK],
[
if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
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=$(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=$(echo ${$1_LIB} | sed -e "s|-L|-L${$1_DIR}|g")
if test x"$5" != x ; then
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
saved_libs="${LIBS}"
LIBS=${$1_LIB}
AC_LINK_IFELSE(
[ AC_LANG_PROGRAM( [ $5 ], [ $6; ])],
[ PBX_$1=1 AC_DEFINE([HAVE_$1], 1,
[Define if your system has the $1 headers.])],
[]
)
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
])
# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
......@@ -12,4 +11,9 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_include([acinclude.m4])
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_include([../autoconf/ast_check_gnu_make.m4])
m4_include([../autoconf/ast_ext_lib.m4])
m4_include([../autoconf/ast_ext_tool_check.m4])
m4_include([../autoconf/ast_gcc_attribute.m4])
m4_include([../autoconf/ast_prog_sed.m4])
......@@ -35,7 +35,7 @@
/* Define to 1 if your GCC C compiler supports the 'weakref' attribute. */
#undef HAVE_ATTRIBUTE_weakref
/* Define to indicate the ${CURSES_DESCRIP} library */
/* Define to 1 if you have the curses library. */
#undef HAVE_CURSES
/* Define to 1 if you have the `getloadavg' function. */
......@@ -53,10 +53,10 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to indicate the ${NCURSES_DESCRIP} library */
/* Define to 1 if you have the ncurses library. */
#undef HAVE_NCURSES
/* Define to indicate the ${NEWT_DESCRIP} library */
/* Define to 1 if you have the newt library. */
#undef HAVE_NEWT
/* Define to 1 if you have the `setenv' function. */
......
......@@ -17,7 +17,7 @@ then
check_for_app automake19
check_for_app aclocal19
echo "Generating the configure script ..."
aclocal19 2>/dev/null
aclocal19 -I ../autoconf 2>/dev/null
autoconf259
autoheader259
automake19 --add-missing --copy 2>/dev/null
......@@ -32,7 +32,7 @@ else
check_for_app automake
check_for_app aclocal
echo "Generating the configure script ..."
aclocal 2>/dev/null
aclocal -I ../autoconf 2>/dev/null
autoconf
autoheader
automake --add-missing --copy 2>/dev/null
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment