summaryrefslogtreecommitdiff
path: root/m4/log.m4
diff options
context:
space:
mode:
authorRegis Merlino <regis.merlino@intel.com>2013-02-25 16:24:43 +0100
committerMark Ryan <mark.d.ryan@intel.com>2013-02-26 13:45:54 +0100
commit9e05256ff2a125a9b4f0b7b1b2bde59a04323369 (patch)
tree48267603aa6f164449da371dd839abbd69e579c3 /m4/log.m4
parentcba359ce422149a70c031311dd5e68483e753c29 (diff)
downloaddleyna-renderer-9e05256ff2a125a9b4f0b7b1b2bde59a04323369.tar.gz
[Init] Add initial source code
Signed-off-by: Regis Merlino <regis.merlino@intel.com>
Diffstat (limited to 'm4/log.m4')
-rw-r--r--m4/log.m495
1 files changed, 95 insertions, 0 deletions
diff --git a/m4/log.m4 b/m4/log.m4
new file mode 100644
index 0000000..56ddfc4
--- /dev/null
+++ b/m4/log.m4
@@ -0,0 +1,95 @@
+dnl
+dnl dLeyna
+dnl
+dnl Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
+dnl
+dnl This program is free software; you can redistribute it and/or modify it
+dnl under the terms and conditions of the GNU Lesser General Public License,
+dnl version 2.1, as published by the Free Software Foundation.
+dnl
+dnl This program is distributed in the hope it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+dnl for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with this program; if not, write to the Free Software Foundation, Inc.,
+dnl 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+dnl
+dnl Ludovic Ferrandis <ludovic.ferrandis@intel.com>
+dnl
+
+
+AC_DEFUN([_DLEYNA_LOG_LEVEL_CHECK_VALUE],
+[
+ AS_CASE($1,
+ [[[1-6]]], [AS_IF([test ${log_array[[${log_level}]]} -ne 0],
+ [
+ AC_MSG_ERROR(["$1 should be set once"], 1)
+ ],
+ [test "x${log_single}" = xyes],
+ [
+ AC_MSG_ERROR(["Unique value element already set"], 1)
+ ])
+ ],
+
+ [0|7|8], [AS_IF([test ${log_level_count} -ne 0],
+ [
+ AC_MSG_ERROR(["$1 should be a unique value element"], 1)
+ ])
+ log_single=yes
+ ],
+
+ [AC_MSG_ERROR(["$1 is not a valid value"], 1)]
+ )
+
+ log_name=LOG_LEVEL_${log_level}
+ eval log_value=\$${log_name}
+ let "LOG_LEVEL |= ${log_value}"
+]
+)
+
+AC_DEFUN([DLEYNA_LOG_LEVEL_CHECK],
+[
+ AC_MSG_CHECKING([for --with-log-level=$1])
+
+ old_IFS=${IFS}
+ IFS=","
+
+ log_ok=yes
+ log_single=no
+ log_level_count=0
+ LOG_LEVEL=0
+ log_array=(0 0 0 0 0 0 0 0 0)
+
+ for log_level in $1
+ do
+ IFS=${old_IFS}
+ _DLEYNA_LOG_LEVEL_CHECK_VALUE([$log_level])
+ IFS=","
+
+ let log_level_count++
+ let log_array[[${log_level}]]++
+ done
+
+ IFS=${old_IFS}
+
+ AC_DEFINE_UNQUOTED([DLEYNA_LOG_LEVEL], [${LOG_LEVEL}], [Log level flag for debug messages])
+
+ AC_MSG_RESULT([ok])
+]
+)
+
+AC_DEFUN([DLEYNA_LOG_TYPE_CHECK],
+[
+ AC_MSG_CHECKING([for --with-log-type=$1])
+
+ AS_CASE($1,
+ [0|1], [],
+
+ [AC_MSG_ERROR(["$1 is not a valid value"], 1)]
+ )
+
+ AC_MSG_RESULT([ok])
+]
+)