diff options
author | Doohwan Kim <dh8210.kim@samsung.com> | 2015-02-26 17:39:16 +0900 |
---|---|---|
committer | Doohwan Kim <dh8210.kim@samsung.com> | 2015-02-26 17:39:45 +0900 |
commit | da07ee69267b4557028357eae802d2a7a57c34e7 (patch) | |
tree | 02a5d7590fc35cd3ad08aa8894ca5f32947a1da1 /m4 | |
parent | 34c41c0eecd122a3dd92b30f30267ea4d951343a (diff) | |
download | murphy-da07ee69267b4557028357eae802d2a7a57c34e7.tar.gz murphy-da07ee69267b4557028357eae802d2a7a57c34e7.tar.bz2 murphy-da07ee69267b4557028357eae802d2a7a57c34e7.zip |
Initialize Tizen 3.0submit/tizen_3.0.2015.q1_common/20150320.000000submit/tizen/20150313.025220accepted/tizen/wearable/20150313.084641accepted/tizen/tv/20150313.084515accepted/tizen/mobile/20150313.084815accepted/tizen/common/20150313.083743accepted/tizen/3.0.2015.q1/common/20150323.084221tizen_3.0.2015.q2_commontizen_3.0.2015.q1_commonaccepted/tizen_3.0.2015.q1_common
Signed-off-by: Doohwan Kim <dh8210.kim@samsung.com>
Change-Id: I2ad7e23e121506673a724f512fea429489928451
Diffstat (limited to 'm4')
-rw-r--r-- | m4/docsetup.m4 | 22 | ||||
-rw-r--r-- | m4/shave.m4 | 113 | ||||
-rw-r--r-- | m4/websockets.m4 | 234 |
3 files changed, 369 insertions, 0 deletions
diff --git a/m4/docsetup.m4 b/m4/docsetup.m4 new file mode 100644 index 0000000..7af4381 --- /dev/null +++ b/m4/docsetup.m4 @@ -0,0 +1,22 @@ +dnl Initiate the documentation directories +dnl +dnl MRP_DOCINIT([depdir],[doxyfilename],[docdir]) +dnl + +AC_DEFUN([MRP_DOCINIT], +[ + m4_ifset([$1], [depdir=$1], [depdir=.deps]) + m4_ifset([$2], [doxyfile=$1], [doxyfile=Doxyfile]) + m4_ifset([$3], [docdir=$2], [docdir=doc]) + + AC_PATH_TOOL( [MRP_FIND], find ) + AC_PROG_SED + AC_PROG_MKDIR_P + + AS_IF( [ test "x$MRP_FIND" = "x" -o "x$MKDIR_P" = "x" ], + [ AC_MSG_ERROR([essential programs are missing to init docs]) ], + [ found=`$MRP_FIND $docdir -name $doxyfile` + for f in $found ; do + $MKDIR_P `echo $f | $SED -e "s/$doxyfile//"`$depdir + done]) +]) diff --git a/m4/shave.m4 b/m4/shave.m4 new file mode 100644 index 0000000..94aec1f --- /dev/null +++ b/m4/shave.m4 @@ -0,0 +1,113 @@ +dnl Make automake/libtool output more friendly to humans +dnl +dnl Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com> +dnl +dnl Permission is hereby granted, free of charge, to any person +dnl obtaining a copy of this software and associated documentation +dnl files (the "Software"), to deal in the Software without +dnl restriction, including without limitation the rights to use, +dnl copy, modify, merge, publish, distribute, sublicense, and/or sell +dnl copies of the Software, and to permit persons to whom the +dnl Software is furnished to do so, subject to the following +dnl conditions: +dnl +dnl The above copyright notice and this permission notice shall be +dnl included in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +dnl OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +dnl HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +dnl OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl SHAVE_INIT([shavedir],[default_mode]) +dnl +dnl shavedir: the directory where the shave scripts are, it defaults to +dnl $(top_builddir) +dnl default_mode: (enable|disable) default shave mode. This parameter +dnl controls shave's behaviour when no option has been +dnl given to configure. It defaults to disable. +dnl +dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just +dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and +dnl LIBTOOL, you don't want the configure tests to have these variables +dnl re-defined. +dnl * This macro requires GNU make's -s option. + +AC_DEFUN([_SHAVE_ARG_ENABLE], +[ + AC_ARG_ENABLE([shave], + AS_HELP_STRING( + [--enable-shave], + [use shave to make the build pretty [[default=$1]]]),, + [enable_shave=$1] + ) +]) + +AC_DEFUN([SHAVE_INIT], +[ + dnl you can tweak the default value of enable_shave + m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)]) + + if test x"$enable_shave" = xyes; then + dnl where can we find the shave scripts? + m4_if([$1],, + [shavedir="$ac_pwd"], + [shavedir="$ac_pwd/$1"]) + AC_SUBST(shavedir) + + dnl make is now quiet + AC_SUBST([MAKEFLAGS], [-s]) + AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`']) + + dnl we need sed + AC_CHECK_PROG(SED,sed,sed,false) + + dnl substitute libtool + SHAVE_SAVED_LIBTOOL=$LIBTOOL + LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'" + AC_SUBST(LIBTOOL) + + dnl substitute cc/cxx + SHAVE_SAVED_CCAS=$CCAS + SHAVE_SAVED_CC=$CC + SHAVE_SAVED_CXX=$CXX + SHAVE_SAVED_FC=$FC + SHAVE_SAVED_F77=$F77 + SHAVE_SAVED_OBJC=$OBJC + SHAVE_SAVED_MCS=$MCS + SHAVE_SAVED_LEX=$LEX + SHAVE_SAVED_YACC=$YACC + SHAVE_SAVED_CC_FOR_BUILD=$CC_FOR_BUILD + CCAS="${SHELL} ${shavedir}/shave ccas ${SHAVE_SAVED_CCAS}" + CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}" + CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}" + FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}" + F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}" + OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}" + MCS="${SHELL} ${shavedir}/shave mcs ${SHAVE_SAVED_MCS}" + LEX="${SHELL} ${shavedir}/shave lex ${SHAVE_SAVED_LEX}" + YACC="${SHELL} ${shavedir}/shave yacc ${SHAVE_SAVED_YACC}" + CC_FOR_BUILD="${SHELL} ${shavedir}/shave cc_for_build ${SHAVE_SAVED_CC_FOR_BUILD}" + AC_SUBST(CCAS) + AC_SUBST(CC) + AC_SUBST(CXX) + AC_SUBST(FC) + AC_SUBST(F77) + AC_SUBST(OBJC) + AC_SUBST(MCS) + AC_SUBST(LEX) + AC_SUBST(YACC) + + V=@ + else + V=1 + fi + Q='$(V:1=)' + AC_SUBST(V) + AC_SUBST(Q) +]) + diff --git a/m4/websockets.m4 b/m4/websockets.m4 new file mode 100644 index 0000000..ab1a41d --- /dev/null +++ b/m4/websockets.m4 @@ -0,0 +1,234 @@ +# Macro to check if websockets support was enabled. This macro also +# takes care of detecting older versions of libwebsockets (lacking +# pkg-config support, no per-context userdata) and propagating this +# information to config.h and the compilation process. +# + +AC_DEFUN([CHECK_WEBSOCKETS], +[ +AC_LANG_PUSH([C]) +AC_ARG_ENABLE(websockets, + [ --enable-websockets enable websockets support], + [enable_websockets=$enableval], [enable_websockets=auto]) + +# Check if we have properly packaged libwebsockets (json-c is now mandatory +# and already has been tested for). +if test "$enable_websockets" != "no"; then + PKG_CHECK_MODULES(WEBSOCKETS, [libwebsockets], + [have_websockets=yes], [have_websockets=no]) + if test "$have_websockets" = "yes"; then + WEBSOCKETS_CFLAGS="`pkg-config --cflags libwebsockets`" + # Check for a couple of recent features we need to adopt to. + saved_CFLAGS="$CFLAGS" + saved_LDFLAGS="$LDFLAGS" + saved_LIBS="$LIBS" + # Note that (at least with autoconf 2.69 and gcc 4.7.2), setting + # LD_AS_NEEDED to 1 breaks AC_LINK_IFELSE. That macro generates + # the compilation command so that the libraries are specified + # before the generated C source so all referenced/tested symbols + # from any of the libraries end up being undefined. This fools + # AC_LINK_IFELSE to consider the test a failure and select the + # else branch. + # rpmbuild always sets LD_AS_NEEDED to 1. To work around this save + # and restore LD_AS_NEEDED for the duration of the AC_LINK_IFELSE + # tests. + saved_LD_AS_NEEDED="$LD_AS_NEEDED" + unset LD_AS_NEEDED + CFLAGS="`pkg-config --cflags libwebsockets`" + LIBS="`pkg-config --libs libwebsockets`" + + # Check for new context creation API. + AC_MSG_CHECKING([for WEBSOCKETS new context creation API]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[struct libwebsocket_context *ctx; + ctx = libwebsocket_create_context(NULL);]])], + [websockets_cci=yes], + [websockets_cci=no]) + AC_MSG_RESULT([$websockets_cci]) + + # Check for new libwebsockets_get_internal_extensions. + AC_MSG_CHECKING([for WEBSOCKETS internal extension query API]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[struct libwebsocket_extension *ext; + ext = libwebsocket_get_internal_extensions();]])], + [websockets_query_ext=yes], + [websockets_query_ext=no]) + AC_MSG_RESULT([$websockets_query_ext]) + + # Check for newer lws_set_log_level API. + # Note that we cheat heavily here: instead of rolling a proper + # test, we blindly assume gcc, turn on the -Werror flag (to catch + # calls with a mismatching function pointer) and hope that we will + # not get false negatives because of other warnings. + no_werror_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_MSG_CHECKING([for WEBSOCKETS updated logging API.]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h> + static void logger(int level, const char *line) { + return; + }]], + [[lws_set_log_level(LLL_INFO, logger);]])], + [websockets_log_with_level=yes], + [websockets_log_with_level=no]) + AC_MSG_RESULT([$websockets_log_with_level]) + + # Check whether we have libwebsocket_close_and_free_session. + AC_MSG_CHECKING([for WEBSOCKETS close_and_free_session API]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[libwebsocket_close_and_free_session(NULL, NULL, 0);]])], + [websockets_close_session=yes], + [websockets_close_session=no]) + AC_MSG_RESULT([$websockets_close_session]) + + # Check for LWS_CALLBACK_FILTER_HTTP_CONNECTION. + AC_MSG_CHECKING([for WEBSOCKETS LWS_CALLBACK_FILTER_HTTP_CONNECTION]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[int foo = LWS_CALLBACK_FILTER_HTTP_CONNECTION;]])], + [websockets_filter_http_connection=yes], + [websockets_filter_http_connection=no]) + AC_MSG_RESULT([$websockets_filter_http_connection]) + + # Check for LWS_CALLBACK_CHANGE_MODE_POLL_FD. + AC_MSG_CHECKING([for WEBSOCKETS LWS_CALLBACK_CHANGE_MODE_POLL_FD]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[int foo = LWS_CALLBACK_CHANGE_MODE_POLL_FD;]])], + [websockets_change_poll=yes], + [websockets_change_poll=no]) + AC_MSG_RESULT([$websockets_change_poll]) + + # Check the signature of libwebsockets_serve_http_file to see if + # it takes an extra (other_headers) argument. + AC_MSG_CHECKING([for WEBSOCKETS libwebsockets_serve_http_file other_headers argument]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[return libwebsockets_serve_http_file(NULL, NULL, "", "", "");]])], + [websockets_serve_file_extraarg=yes], + [websockets_serve_file_extraarg=no]) + AC_MSG_RESULT([$websockets_serve_file_extraarg]) + + CFLAGS="$saved_CFLAGS" + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" + if test -n "$saved_LD_AS_NEEDED"; then + export LD_AS_NEEDED="$saved_LD_AS_NEEDED" + fi + else + WEBSOCKETS_CFLAGS="" + fi + + # Check for older websockets. + if test "$have_websockets" = "no"; then + saved_LDFLAGS="$LDFLAGS" + saved_LIBS="$LIBS" + LIBS="-lwebsockets" + AC_MSG_CHECKING([for WEBSOCKETS without pkg-config support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[struct libwebsocket_context *ctx; + ctx = libwebsocket_create_context(0, NULL, NULL, NULL, + NULL, NULL, NULL, + -1, -1, 0, NULL);]])], + [have_websockets=yes;old_websockets=no], + [have_websockets=no]) + AC_MSG_RESULT([$have_websockets]) + fi + + # Check if we have a really old libwebsockets, still without + # per-context user data. + if test "$old_websockets" != "no"; then + AC_MSG_CHECKING([for really old WEBSOCKETS]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + #include <libwebsockets.h>]], + [[struct libwebsocket_context *ctx; + ctx = libwebsocket_create_context(0, NULL, NULL, NULL, + NULL, NULL, + -1, -1, 0);]])], + [have_websockets=yes;old_websockets=yes], + [old_websockets=no]) + AC_MSG_RESULT([$old_websockets]) + fi + + WEBSOCKETS_LIBS="-lwebsockets" + if test "$old_websockets" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_OLD" + fi + if test "$websockets_cci" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_CONTEXT_INFO" + fi + if test "$websockets_query_ext" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_QUERY_EXTENSIONS" + fi + if test "$websockets_log_with_level" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_LOG_WITH_LEVEL" + fi + if test "$websockets_close_session" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_CLOSE_SESSION" + fi + if test "$websockets_filter_http_connection" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_FILTER_HTTP_CONNECTION" + fi + if test "$websockets_change_poll" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_CHANGE_MODE_POLL_FD" + fi + if test "$websockets_serve_file_extraarg" = "yes"; then + WEBSOCKETS_CFLAGS="$WEBSOCKETS_CFLAGS -DWEBSOCKETS_SERVE_FILE_EXTRAARG" + fi + + LDFLAGS="$saved_LDFLAGS" + LIBS="$saved_LIBS" +else + AC_MSG_NOTICE([libwebsockets support is disabled.]) +fi + +# Bail out if we lack mandatory support. +if test "$enable_websockets" = "yes" -a "$have_websockets" = "no"; then + AC_MSG_ERROR([libwebsockets development libraries not found.]) +fi + +# Enable if found and autosupport requested. +if test "$enable_websockets" = "auto"; then + enable_websockets=$have_websockets +fi + +# If enabled, set up our autoconf variables accordingly. +if test "$enable_websockets" = "yes"; then + AC_DEFINE([WEBSOCKETS_ENABLED], 1, [Enable websockets support ?]) + if test "$old_websockets" = "yes"; then + AC_DEFINE([WEBSOCKETS_OLD], 1, [No per-context userdata ?]) + fi +fi + +# Finally substitute everything. +AM_CONDITIONAL(WEBSOCKETS_ENABLED, [test "$enable_websockets" = "yes"]) +AM_CONDITIONAL(WEBSOCKETS_OLD, [test "$old_websockets" = "yes"]) +AC_SUBST(WEBSOCKETS_ENABLED) +AC_SUBST(WEBSOCKETS_CFLAGS) +AC_SUBST(WEBSOCKETS_LIBS) +AC_SUBST(WEBSOCKETS_OLD) + +AC_LANG_POP +]) |