summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-06-03 15:57:42 +0000
committerDavid M. Lee <dlee@digium.com>2013-06-03 15:57:42 +0000
commit6d805dc04ba180f531cabe780b1187352609395f (patch)
tree147928c28af1261eb5ee98e19dacee5d7ead15ce
parent1458a20e47fc1cab9a22a961bff0745f7368b447 (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
-rwxr-xr-xconfigure227
-rw-r--r--configure.ac26
-rw-r--r--include/asterisk/autoconfig.h.in3
-rw-r--r--main/Makefile4
-rw-r--r--makeopts.in3
5 files changed, 214 insertions, 49 deletions
diff --git a/configure b/configure
index d8de587d3..072549253 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/configure.ac b/configure.ac
index 339f7946d..7a9881074 100644
--- a/configure.ac
+++ b/configure.ac
@@ -497,8 +497,6 @@ AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
-AST_EXT_LIB_CHECK([UUID], [uuid], [uuid_generate_random], [uuid/uuid.h], [-luuid])
-AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_dumps], [jansson.h])
EDITLINE_LIB=""
if test "x$TERMCAP_LIB" != "x" ; then
@@ -514,9 +512,31 @@ else
fi
AC_SUBST(EDITLINE_LIB)
-if test "x$UUID_LIB" == "x"; then
+# Find required UUID support.
+# * -luuid on Linux
+# * -le2fs-uuid on OpenBSD
+# * in libsystem on OS X
+AST_EXT_LIB_CHECK([LIBUUID], [uuid], [uuid_generate_random], [uuid/uuid.h], [])
+AST_EXT_LIB_CHECK([E2FSUUID], [e2fs-uuid], [uuid_generate_random], [uuid/uuid.h], [])
+AC_CHECK_FUNCS([uuid_generate_random], [SYSUUID=true], [SYSUUID=""])
+
+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
AC_MSG_ERROR([*** uuid support not found (this typically means the uuid development package is missing)])
fi
+AC_SUBST(UUID_INCLUDE)
+AC_SUBST(UUID_LIB)
+
+# Find required JSON support.
+AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_dumps], [jansson.h])
if test "x$JANSSON_LIB" == "x"; then
AC_MSG_ERROR([*** JSON support not found (this typically means the libjansson development package is missing)])
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 101829b4f..2251ab9af 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -1022,6 +1022,9 @@
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL
+/* Define to 1 if you have the `uuid_generate_random' function. */
+#undef HAVE_UUID_GENERATE_RANDOM
+
/* Define to 1 if your system can support larger than default select bitmasks.
*/
#undef HAVE_VARIABLE_FDSET
diff --git a/main/Makefile b/main/Makefile
index 9b825bd45..f249a294a 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -36,6 +36,7 @@ AST_LIBS+=$(LIBXML2_LIB)
AST_LIBS+=$(SQLITE3_LIB)
AST_LIBS+=$(ASTSSL_LIBS)
AST_LIBS+=$(JANSSON_LIB)
+AST_LIBS+=$(UUID_LIB)
ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc kfreebsd-gnu),)
ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
@@ -44,7 +45,7 @@ ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc kfreebsd-gnu),)
ifneq (x$(CAP_LIB),x)
AST_LIBS+=$(CAP_LIB)
endif
- AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv -luuid
+ AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv
else
AST_LIBS+=$(EDITLINE_LIB) -lm
endif
@@ -152,6 +153,7 @@ db.o: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
asterisk.o: _ASTCFLAGS+=$(LIBEDIT_INCLUDE)
cli.o: _ASTCFLAGS+=$(LIBEDIT_INCLUDE)
json.o: _ASTCFLAGS+=$(JANSSON_INCLUDE)
+uuid.o: _ASTCFLAGS+=$(UUID_INCLUDE)
ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)
diff --git a/makeopts.in b/makeopts.in
index ad42e293f..95e69b817 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -290,6 +290,9 @@ TONEZONE_LIB=@TONEZONE_LIB@
UNIXODBC_INCLUDE=@UNIXODBC_INCLUDE@
UNIXODBC_LIB=@UNIXODBC_LIB@
+UUID_INCLUDE=@UUID_INCLUDE@
+UUID_LIB=@UUID_LIB@
+
VORBIS_INCLUDE=@VORBIS_INCLUDE@
VORBIS_LIB=@VORBIS_LIB@