[Asterisk-code-review] build: Backport addition of librt check to configure.ac (asterisk[13])
George Joseph
asteriskteam at digium.com
Mon Nov 21 09:48:06 CST 2016
George Joseph has uploaded a new change for review. ( https://gerrit.asterisk.org/4481 )
Change subject: build: Backport addition of librt check to configure.ac
......................................................................
build: Backport addition of librt check to configure.ac
A while back, a master-only change was made to check for librt which
should probably have been cherry-picked to 13 at that time. Sometime
between then and now, part of that change did make it into 13 but it
was incomplete and non-functional. This patch backports the rest
of the librt check and allows the link of libasteriskpj to use the
results.
Change-Id: I1424008fd8c90f389dda53162ec4a340b253a3c1
---
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
M main/Makefile
M makeopts.in
5 files changed, 140 insertions(+), 63 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/81/4481/1
diff --git a/configure b/configure
index 3eb7865..69f8c0e 100755
--- a/configure
+++ b/configure
@@ -767,6 +767,10 @@
SUPPSERV_DIR
SUPPSERV_INCLUDE
SUPPSERV_LIB
+PBX_RT
+RT_DIR
+RT_INCLUDE
+RT_LIB
PBX_OPENSSL
OPENSSL_DIR
OPENSSL_INCLUDE
@@ -1230,7 +1234,6 @@
FIND
PYTHON
FLEX
-CUT
CAT
CMP
BISON
@@ -1317,7 +1320,6 @@
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1497,7 +1499,6 @@
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1750,15 +1751,6 @@
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1896,7 +1888,7 @@
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -2049,7 +2041,6 @@
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -6811,47 +6802,6 @@
fi
-# Extract the first word of "cut", so it can be a program name with args.
-set dummy cut; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CUT+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $CUT in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_CUT="$CUT" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_CUT="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_CUT" && ac_cv_path_CUT=":"
- ;;
-esac
-fi
-CUT=$ac_cv_path_CUT
-if test -n "$CUT"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUT" >&5
-$as_echo "$CUT" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
# Extract the first word of "flex", so it can be a program name with args.
set dummy flex; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -9301,7 +9251,7 @@
as_fn_error $? "nm is required to build bundled pjproject" "$LINENO" 5
fi
if test "${MD5}" = ":" ; then
- as_fn_error $? "md5dum is required to build bundled pjproject" "$LINENO" 5
+ as_fn_error $? "md5sum is required to build bundled pjproject" "$LINENO" 5
fi
if test "${CAT}" = ":" ; then
as_fn_error $? "cat is required to build bundled pjproject" "$LINENO" 5
@@ -12338,6 +12288,18 @@
+RT_DESCRIP="Realtime functions"
+
+RT_DIR=${rt_DIR}
+
+PBX_RT=0
+
+
+
+
+
+
+
SUPPSERV_DESCRIP="mISDN Supplemental Services"
SUPPSERV_OPTION="suppserv"
PBX_SUPPSERV=0
@@ -13998,6 +13960,112 @@
as_fn_error $? "*** JSON support not found (this typically means the libjansson development package is missing)" "$LINENO" 5
fi
+# See if clock_gettime is in librt
+
+if test "x${PBX_RT}" != "x1" -a "${USE_RT}" != "no"; then
+ pbxlibdir=""
+ # if --with-RT=DIR has been specified, use it.
+ if test "x${RT_DIR}" != "x"; then
+ if test -d ${RT_DIR}/lib; then
+ pbxlibdir="-L${RT_DIR}/lib"
+ else
+ pbxlibdir="-L${RT_DIR}"
+ fi
+ fi
+ pbxfuncname="clock_gettime"
+ if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
+ AST_RT_FOUND=yes
+ else
+ ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} "
+ as_ac_Lib=`$as_echo "ac_cv_lib_rt_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lrt" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lrt... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt ${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_RT_FOUND=yes
+else
+ AST_RT_FOUND=no
+fi
+
+ CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+ fi
+
+ # now check for the header.
+ if test "${AST_RT_FOUND}" = "yes"; then
+ RT_LIB="${pbxlibdir} -lrt "
+ # if --with-RT=DIR has been specified, use it.
+ if test "x${RT_DIR}" != "x"; then
+ RT_INCLUDE="-I${RT_DIR}/include"
+ fi
+ RT_INCLUDE="${RT_INCLUDE} "
+ if test "x" = "x" ; then # no header, assume found
+ RT_HEADER_FOUND="1"
+ else # check for the header
+ ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${CPPFLAGS} ${RT_INCLUDE}"
+ ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = xyes; then :
+ RT_HEADER_FOUND=1
+else
+ RT_HEADER_FOUND=0
+fi
+
+
+ CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+ fi
+ if test "x${RT_HEADER_FOUND}" = "x0" ; then
+ RT_LIB=""
+ RT_INCLUDE=""
+ else
+ if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
+ RT_LIB=""
+ fi
+ PBX_RT=1
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_RT 1
+_ACEOF
+
+ fi
+ fi
+fi
+
+
+
if test "x${PBX_LIBXML2}" != "x1" -a "${USE_LIBXML2}" != "no"; then
PBX_LIBXML2=0
@@ -14551,7 +14619,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14597,7 +14665,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14621,7 +14689,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14666,7 +14734,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14690,7 +14758,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
diff --git a/configure.ac b/configure.ac
index 15ea4a1..1aedf2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -563,6 +563,7 @@
AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_SHUTDOWN], [SRTP Library Shutdown Function], [SRTP], [srtp])
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
+AST_EXT_LIB_SETUP_OPTIONAL([RT], [Realtime functions], [rt])
AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
@@ -634,6 +635,9 @@
AC_MSG_ERROR([*** JSON support not found (this typically means the libjansson development package is missing)])
fi
+# See if clock_gettime is in librt
+AST_EXT_LIB_CHECK([RT], [rt], [clock_gettime])
+
AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
[#include <libxml/tree.h>
#include <libxml/parser.h>],
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index c47923b..6d6a28b 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -796,6 +796,9 @@
/* Define to 1 if you have the `roundl' function. */
#undef HAVE_ROUNDL
+/* Define to 1 if rt has the Realtime functions feature. */
+#undef HAVE_RT
+
/* Define if your system has the RTLD_NOLOAD headers. */
#undef HAVE_RTLD_NOLOAD
diff --git a/main/Makefile b/main/Makefile
index df9a01c..37b9446 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -287,7 +287,7 @@
$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): _ASTLDFLAGS+=-Wl,-soname=$(ASTPJ_LIB) $(PJ_LDFLAGS)
$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskpj\" $(PJ_CFLAGS)
-$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): LIBS+=$(PJPROJECT_LDLIBS) -lssl -lcrypto -luuid -lm -lpthread
+$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): LIBS+=$(PJPROJECT_LDLIBS) -lssl -lcrypto -luuid -lm -lpthread $(RT_LIB)
ifeq ($(GNU_LD),1)
$(ASTPJ_LIB).$(ASTPJ_SO_VERSION): SO_SUPPRESS_SYMBOLS=-Wl,--version-script,libasteriskpj.exports,--warn-common
endif
@@ -312,7 +312,7 @@
# /lib or /usr/lib
$(ASTPJ_LIB): _ASTLDFLAGS+=-dynamiclib -install_name $(ASTLIBDIR)/$(ASTPJ_LIB) $(PJ_LDFLAGS)
$(ASTPJ_LIB): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskpj\" $(PJ_CFLAGS)
-$(ASTPJ_LIB): LIBS+=$(PJPROJECT_LIBS) -lssl -lcrypto -luuid -lm -lrt -lpthread
+$(ASTPJ_LIB): LIBS+=$(PJPROJECT_LIBS) -lssl -lcrypto -luuid -lm -lpthread $(RT_LIB)
$(ASTPJ_LIB): SOLINK=$(DYLINK)
# Special rules for building a shared library (not a dynamically loadable module)
diff --git a/makeopts.in b/makeopts.in
index e5ab0be..3f92562 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -258,6 +258,8 @@
RESAMPLE_INCLUDE=@RESAMPLE_INCLUDE@
RESAMPLE_LIB=@RESAMPLE_LIB@
+RT_LIB=@RT_LIB@
+
SS7_INCLUDE=@SS7_INCLUDE@
SS7_LIB=@SS7_LIB@
--
To view, visit https://gerrit.asterisk.org/4481
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1424008fd8c90f389dda53162ec4a340b253a3c1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
More information about the asterisk-code-review
mailing list