[Asterisk-code-review] BuildSystem: Enable Jansson in Solaris 11. (asterisk[13])
Alexander Traud
asteriskteam at digium.com
Sat Jul 28 08:09:12 CDT 2018
Alexander Traud has uploaded this change for review. ( https://gerrit.asterisk.org/9768
Change subject: BuildSystem: Enable Jansson in Solaris 11.
......................................................................
BuildSystem: Enable Jansson in Solaris 11.
In Solaris, the header <jansson.h> is in /usr/include/jansson. To find
Jansson even in such a subdirectory, the tool pkg-config is queried via
AST_PKG_CONFIG_CHECK. For those platforms, which do not list Jansson via
pkg-config, the previous check remains and is executed thereafter.
Because the check for the NetBSD Editline library uses the tool pkg-config
conditionally PKG_PROG_PKG_CONFIG must be used. Because that check happens
earlier than Jansson, it must be placed in front of that.
The script configure does some pre-checks for the script configure of the
Asterisk internal NetBSD Editline library. The check for the library ncurses
should use not use the header <curses.h> but <ncurses.h>, because on some
platforms <curses.h> is not a drop-in replacement for <ncurses.h>: For example
in Solaris, the symbol initscr is a typedef in <curses.h> to a symbol which
does not exist in the library ncurses (initscr32). Simply use <ncurses.h> when
you link to ncurses.
ASTERISK-27991
Change-Id: I69ea0f379f87a50049654b2487c76ee1c04fa53a
---
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
3 files changed, 117 insertions(+), 142 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/9768/1
diff --git a/configure b/configure
index b0623fd..41faa87 100755
--- a/configure
+++ b/configure
@@ -704,15 +704,17 @@
LIBOBJS
DISABLE_XMLDOC
CONFIG_LIBXML2
+JANSSON_LIBS
+JANSSON_CFLAGS
UUID_LIB
UUID_INCLUDE
EDITLINE_LIB
LIBEDIT_LIBS
LIBEDIT_CFLAGS
+LIBEDIT_INTERNAL
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
-LIBEDIT_INTERNAL
ALLOCA
PBX_ZLIB
ZLIB_DIR
@@ -1443,6 +1445,8 @@
PKG_CONFIG_LIBDIR
LIBEDIT_CFLAGS
LIBEDIT_LIBS
+JANSSON_CFLAGS
+JANSSON_LIBS
ILBC_CFLAGS
ILBC_LIBS
PJPROJECT_CFLAGS
@@ -2198,6 +2202,10 @@
C compiler flags for LIBEDIT, overriding pkg-config
LIBEDIT_LIBS
linker flags for LIBEDIT, overriding pkg-config
+ JANSSON_CFLAGS
+ C compiler flags for JANSSON, overriding pkg-config
+ JANSSON_LIBS
+ linker flags for JANSSON, overriding pkg-config
ILBC_CFLAGS C compiler flags for ILBC, overriding pkg-config
ILBC_LIBS linker flags for ILBC, overriding pkg-config
PJPROJECT_CFLAGS
@@ -13195,18 +13203,6 @@
done
-# Find required NetBSD Editline library (libedit).
-EDITLINE_LIB=""
-LIBEDIT_INTERNAL="yes"
-
-LIBEDIT_SYSTEM="yes"
-if test "${USE_LIBEDIT}" != "no"; then
- if test "${LIBEDIT_DIR}" = "internal"; then
- LIBEDIT_SYSTEM="no"
- elif test "${LIBEDIT_DIR}" != ""; then
- LIBEDIT_INTERNAL="no"
- fi
- if test "${LIBEDIT_SYSTEM}" = "yes"; then
@@ -13328,6 +13324,19 @@
fi
fi
+# Find required NetBSD Editline library (libedit).
+EDITLINE_LIB=""
+LIBEDIT_INTERNAL="yes"
+
+LIBEDIT_SYSTEM="yes"
+if test "${USE_LIBEDIT}" != "no"; then
+ if test "${LIBEDIT_DIR}" = "internal"; then
+ LIBEDIT_SYSTEM="no"
+ elif test "${LIBEDIT_DIR}" != ""; then
+ LIBEDIT_INTERNAL="no"
+ fi
+ if test "${LIBEDIT_SYSTEM}" = "yes"; then
+
if test "x${PBX_LIBEDIT}" != "x1" -a "${USE_LIBEDIT}" != "no"; then
pkg_failed=no
@@ -13914,8 +13923,8 @@
# 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"
-if test "x$ac_cv_header_curses_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default"
+if test "x$ac_cv_header_ncurses_h" = xyes; then :
NCURSES_HEADER_FOUND=1
else
NCURSES_HEADER_FOUND=0
@@ -14181,6 +14190,94 @@
# Find required JSON support if bundled is not enabled.
if test "$JANSSON_BUNDLED" = "no" ; then
+ if test "x${PBX_JANSSON}" != "x1" -a "${USE_JANSSON}" != "no"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JANSSON" >&5
+$as_echo_n "checking for JANSSON... " >&6; }
+
+if test -n "$JANSSON_CFLAGS"; then
+ pkg_cv_JANSSON_CFLAGS="$JANSSON_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "jansson") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_JANSSON_CFLAGS=`$PKG_CONFIG --cflags "jansson" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$JANSSON_LIBS"; then
+ pkg_cv_JANSSON_LIBS="$JANSSON_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "jansson") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_JANSSON_LIBS=`$PKG_CONFIG --libs "jansson" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson" 2>&1`
+ else
+ JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$JANSSON_PKG_ERRORS" >&5
+
+
+ PBX_JANSSON=0
+
+
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ PBX_JANSSON=0
+
+
+else
+ JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS
+ JANSSON_LIBS=$pkg_cv_JANSSON_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+ PBX_JANSSON=1
+ JANSSON_INCLUDE=$(echo ${JANSSON_CFLAGS} | $SED -e "s|-std=c99||g")
+ JANSSON_LIB="$JANSSON_LIBS"
+
+$as_echo "#define HAVE_JANSSON 1" >>confdefs.h
+
+
+fi
+ fi
+
+
if test "x${PBX_JANSSON}" != "x1" -a "${USE_JANSSON}" != "no"; then
pbxlibdir=""
# if --with-JANSSON=DIR has been specified, use it.
@@ -19669,128 +19766,6 @@
conftest$ac_exeext conftest.$ac_ext
fi
-# PKGCONFIG is used in later tests
-
-
-
-
-
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; 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_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # 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_PKG_CONFIG="$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
-
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; 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_ac_pt_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # 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_ac_pt_PKG_CONFIG="$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
-
- ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
-else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=0.9.0
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
-fi
-
# do the package library checks now
diff --git a/configure.ac b/configure.ac
index e7920c8..caab39d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -592,6 +592,8 @@
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h])
+PKG_PROG_PKG_CONFIG()
+
# Find required NetBSD Editline library (libedit).
EDITLINE_LIB=""
LIBEDIT_INTERNAL="yes"
@@ -634,7 +636,7 @@
if test "x$CURSES_LIB" != "x" ; then
EDITLINE_LIB="$CURSES_LIB"
else
- AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
+ AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [ncurses.h])
if test "x$NCURSES_LIB" != "x" ; then
EDITLINE_LIB="$NCURSES_LIB"
else
@@ -674,6 +676,7 @@
# Find required JSON support if bundled is not enabled.
if test "$JANSSON_BUNDLED" = "no" ; then
+ AST_PKG_CONFIG_CHECK([JANSSON], [jansson])
AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_dumps], [jansson.h])
if test "${PBX_JANSSON}" != 1; then
@@ -1495,9 +1498,6 @@
)
fi
-# PKGCONFIG is used in later tests
-PKG_PROG_PKG_CONFIG()
-
# do the package library checks now
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 2307000..739f2fb 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -383,7 +383,7 @@
/* Define to 1 if you have the Jack Audio Connection Kit library. */
#undef HAVE_JACK
-/* Define to 1 if you have the Jansson JSON library library. */
+/* Define if your system has the JANSSON libraries. */
#undef HAVE_JANSSON
/* Define to 1 if you have the `kevent64' function. */
--
To view, visit https://gerrit.asterisk.org/9768
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69ea0f379f87a50049654b2487c76ee1c04fa53a
Gerrit-Change-Number: 9768
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180728/6826c8ee/attachment-0001.html>
More information about the asterisk-code-review
mailing list