diff options
author | David M. Lee <dlee@digium.com> | 2013-06-03 15:57:42 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-06-03 15:57:42 +0000 |
commit | 6d805dc04ba180f531cabe780b1187352609395f (patch) | |
tree | 147928c28af1261eb5ee98e19dacee5d7ead15ce /configure | |
parent | 1458a20e47fc1cab9a22a961bff0745f7368b447 (diff) |
Correct autoconf script for finding UUID support.
The library that provides UUID support varies greatly from system to
system. On most Linux distros, it's in libuuid. On OpenBSD, it's in
libe2fs-uuid. On OS X, it is in libsystem.
This patch plays hide-and-seek with UUID support, looking for it in the
three places we know about. It also corrects the Makefile so that it uses
the configured library name and include path.
(closes issue ASTERISK-21816)
Reported by: Brad Latus (snuffy)
Tested by: Brad Latus (snuffy)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 227 |
1 files changed, 182 insertions, 45 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 383579 . +# From configure.ac Revision: 388770 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for asterisk trunk. # @@ -706,6 +706,8 @@ POW_LIB PBX_WORKING_FORK LIBOBJS CONFIG_LIBXML2 +UUID_LIB +UUID_INCLUDE EDITLINE_LIB ALLOCA PBX_ZLIB @@ -12105,19 +12107,38 @@ fi -if test "x${PBX_UUID}" != "x1" -a "${USE_UUID}" != "no"; then +EDITLINE_LIB="" +if test "x$TERMCAP_LIB" != "x" ; then + EDITLINE_LIB="$TERMCAP_LIB" +elif test "x$TINFO_LIB" != "x" ; then + EDITLINE_LIB="$TINFO_LIB" +elif test "x$CURSES_LIB" != "x" ; then + EDITLINE_LIB="$CURSES_LIB" +elif test "x$NCURSES_LIB" != "x" ; then + EDITLINE_LIB="$NCURSES_LIB" +else + as_fn_error $? "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5 +fi + + +# Find required UUID support. +# * -luuid on Linux +# * -le2fs-uuid on OpenBSD +# * in libsystem on OS X + +if test "x${PBX_LIBUUID}" != "x1" -a "${USE_LIBUUID}" != "no"; then pbxlibdir="" - # if --with-UUID=DIR has been specified, use it. - if test "x${UUID_DIR}" != "x"; then - if test -d ${UUID_DIR}/lib; then - pbxlibdir="-L${UUID_DIR}/lib" + # if --with-LIBUUID=DIR has been specified, use it. + if test "x${LIBUUID_DIR}" != "x"; then + if test -d ${LIBUUID_DIR}/lib; then + pbxlibdir="-L${LIBUUID_DIR}/lib" else - pbxlibdir="-L${UUID_DIR}" + pbxlibdir="-L${LIBUUID_DIR}" fi fi pbxfuncname="uuid_generate_random" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers - AST_UUID_FOUND=yes + AST_LIBUUID_FOUND=yes else ast_ext_lib_check_save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} " @@ -12128,7 +12149,7 @@ if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-luuid ${pbxlibdir} -luuid $LIBS" +LIBS="-luuid ${pbxlibdir} $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12160,47 +12181,47 @@ 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 : - AST_UUID_FOUND=yes + AST_LIBUUID_FOUND=yes else - AST_UUID_FOUND=no + AST_LIBUUID_FOUND=no fi CFLAGS="${ast_ext_lib_check_save_CFLAGS}" fi # now check for the header. - if test "${AST_UUID_FOUND}" = "yes"; then - UUID_LIB="${pbxlibdir} -luuid -luuid" - # if --with-UUID=DIR has been specified, use it. - if test "x${UUID_DIR}" != "x"; then - UUID_INCLUDE="-I${UUID_DIR}/include" + if test "${AST_LIBUUID_FOUND}" = "yes"; then + LIBUUID_LIB="${pbxlibdir} -luuid " + # if --with-LIBUUID=DIR has been specified, use it. + if test "x${LIBUUID_DIR}" != "x"; then + LIBUUID_INCLUDE="-I${LIBUUID_DIR}/include" fi - UUID_INCLUDE="${UUID_INCLUDE} " + LIBUUID_INCLUDE="${LIBUUID_INCLUDE} " if test "xuuid/uuid.h" = "x" ; then # no header, assume found - UUID_HEADER_FOUND="1" + LIBUUID_HEADER_FOUND="1" else # check for the header ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" - CPPFLAGS="${CPPFLAGS} ${UUID_INCLUDE}" + CPPFLAGS="${CPPFLAGS} ${LIBUUID_INCLUDE}" ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default" if test "x$ac_cv_header_uuid_uuid_h" = xyes; then : - UUID_HEADER_FOUND=1 + LIBUUID_HEADER_FOUND=1 else - UUID_HEADER_FOUND=0 + LIBUUID_HEADER_FOUND=0 fi CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" fi - if test "x${UUID_HEADER_FOUND}" = "x0" ; then - UUID_LIB="" - UUID_INCLUDE="" + if test "x${LIBUUID_HEADER_FOUND}" = "x0" ; then + LIBUUID_LIB="" + LIBUUID_INCLUDE="" else if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library - UUID_LIB="" + LIBUUID_LIB="" fi - PBX_UUID=1 + PBX_LIBUUID=1 cat >>confdefs.h <<_ACEOF -#define HAVE_UUID 1 +#define HAVE_LIBUUID 1 _ACEOF fi @@ -12209,6 +12230,140 @@ fi +if test "x${PBX_E2FSUUID}" != "x1" -a "${USE_E2FSUUID}" != "no"; then + pbxlibdir="" + # if --with-E2FSUUID=DIR has been specified, use it. + if test "x${E2FSUUID_DIR}" != "x"; then + if test -d ${E2FSUUID_DIR}/lib; then + pbxlibdir="-L${E2FSUUID_DIR}/lib" + else + pbxlibdir="-L${E2FSUUID_DIR}" + fi + fi + pbxfuncname="uuid_generate_random" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_E2FSUUID_FOUND=yes + else + ast_ext_lib_check_save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} " + as_ac_Lib=`$as_echo "ac_cv_lib_e2fs-uuid_${pbxfuncname}" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -le2fs-uuid" >&5 +$as_echo_n "checking for ${pbxfuncname} in -le2fs-uuid... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-le2fs-uuid ${pbxlibdir} $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ${pbxfuncname} (); +int +main () +{ +return ${pbxfuncname} (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=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 : + AST_E2FSUUID_FOUND=yes +else + AST_E2FSUUID_FOUND=no +fi + + CFLAGS="${ast_ext_lib_check_save_CFLAGS}" + fi + + # now check for the header. + if test "${AST_E2FSUUID_FOUND}" = "yes"; then + E2FSUUID_LIB="${pbxlibdir} -le2fs-uuid " + # if --with-E2FSUUID=DIR has been specified, use it. + if test "x${E2FSUUID_DIR}" != "x"; then + E2FSUUID_INCLUDE="-I${E2FSUUID_DIR}/include" + fi + E2FSUUID_INCLUDE="${E2FSUUID_INCLUDE} " + if test "xuuid/uuid.h" = "x" ; then # no header, assume found + E2FSUUID_HEADER_FOUND="1" + else # check for the header + ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${E2FSUUID_INCLUDE}" + ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default" +if test "x$ac_cv_header_uuid_uuid_h" = xyes; then : + E2FSUUID_HEADER_FOUND=1 +else + E2FSUUID_HEADER_FOUND=0 +fi + + + CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" + fi + if test "x${E2FSUUID_HEADER_FOUND}" = "x0" ; then + E2FSUUID_LIB="" + E2FSUUID_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + E2FSUUID_LIB="" + fi + PBX_E2FSUUID=1 + cat >>confdefs.h <<_ACEOF +#define HAVE_E2FSUUID 1 +_ACEOF + + fi + fi +fi + + +for ac_func in uuid_generate_random +do : + ac_fn_c_check_func "$LINENO" "uuid_generate_random" "ac_cv_func_uuid_generate_random" +if test "x$ac_cv_func_uuid_generate_random" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UUID_GENERATE_RANDOM 1 +_ACEOF + SYSUUID=true +else + SYSUUID="" +fi +done + + +if test "x$LIBUUID_LIB" != "x" ; then + UUID_INCLUDE="$LIBUUID_INCLUDE" + UUID_LIB="$LIBUUID_LIB" +elif test "x$E2FSUUID_LIB" != "x" ; then + UUID_INCLUDE="$E2FSUUID_INCLUDE" + UUID_LIB="$E2FSUUID_LIB" +elif test "x$SYSUUID" != "x" ; then + UUID_INCLUDE="" + UUID_LIB="" +else + as_fn_error $? "*** uuid support not found (this typically means the uuid development package is missing)" "$LINENO" 5 +fi + + + +# Find required JSON support. + if test "x${PBX_JANSSON}" != "x1" -a "${USE_JANSSON}" != "no"; then pbxlibdir="" # if --with-JANSSON=DIR has been specified, use it. @@ -12313,24 +12468,6 @@ fi -EDITLINE_LIB="" -if test "x$TERMCAP_LIB" != "x" ; then - EDITLINE_LIB="$TERMCAP_LIB" -elif test "x$TINFO_LIB" != "x" ; then - EDITLINE_LIB="$TINFO_LIB" -elif test "x$CURSES_LIB" != "x" ; then - EDITLINE_LIB="$CURSES_LIB" -elif test "x$NCURSES_LIB" != "x" ; then - EDITLINE_LIB="$NCURSES_LIB" -else - as_fn_error $? "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5 -fi - - -if test "x$UUID_LIB" == "x"; then - as_fn_error $? "*** uuid support not found (this typically means the uuid development package is missing)" "$LINENO" 5 -fi - if test "x$JANSSON_LIB" == "x"; then as_fn_error $? "*** JSON support not found (this typically means the libjansson development package is missing)" "$LINENO" 5 fi |