[svn-commits] seanbright: trunk r203569 - in /trunk: ./ include/asterisk/ main/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jun 25 22:06:10 CDT 2009
Author: seanbright
Date: Thu Jun 25 22:06:06 2009
New Revision: 203569
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203569
Log:
Add checks in configure for non-POSIX syslog facilities.
Modified:
trunk/configure
trunk/configure.ac
trunk/include/asterisk/autoconfig.h.in
trunk/main/syslog.c
Modified: trunk/configure.ac
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configure.ac?view=diff&rev=203569&r1=203568&r2=203569
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Jun 25 22:06:06 2009
@@ -1747,6 +1747,21 @@
AC_SUBST([GENERIC_ODBC_INCLUDE])
AC_SUBST([PBX_GENERIC_ODBC])
+if test "${ac_cv_header_syslog_h}" = "yes"; then
+ # syslog facilities
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTH], [LOG_AUTH], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTHPRIV], [LOG_AUTHPRIV], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_CRON], [LOG_CRON], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_DAEMON], [LOG_DAEMON], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_FTP], [LOG_FTP], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_KERN], [LOG_KERN], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LPR], [LOG_LPR], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_MAIL], [LOG_MAIL], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_NEWS], [LOG_NEWS], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_SYSLOG], [LOG_SYSLOG], [syslog.h])
+ AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_UUCP], [LOG_UUCP], [syslog.h])
+fi
+
AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
AST_CHECK_MANDATORY
Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=203569&r1=203568&r2=203569
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Thu Jun 25 22:06:06 2009
@@ -1006,6 +1006,72 @@
/* Define to 1 if your system has sysinfo support */
#undef HAVE_SYSINFO
+/* Define if your system has the SYSLOG_FACILITY_LOG_AUTH headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_AUTH
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_AUTHPRIV headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV
+
+/* Define SYSLOG_FACILITY_LOG_AUTHPRIV headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV_VERSION
+
+/* Define SYSLOG_FACILITY_LOG_AUTH headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_AUTH_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_CRON headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_CRON
+
+/* Define SYSLOG_FACILITY_LOG_CRON headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_CRON_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_DAEMON headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_DAEMON
+
+/* Define SYSLOG_FACILITY_LOG_DAEMON headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_DAEMON_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_FTP headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_FTP
+
+/* Define SYSLOG_FACILITY_LOG_FTP headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_FTP_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_KERN headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_KERN
+
+/* Define SYSLOG_FACILITY_LOG_KERN headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_KERN_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_LPR headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_LPR
+
+/* Define SYSLOG_FACILITY_LOG_LPR headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_LPR_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_MAIL headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_MAIL
+
+/* Define SYSLOG_FACILITY_LOG_MAIL headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_MAIL_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_NEWS headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_NEWS
+
+/* Define SYSLOG_FACILITY_LOG_NEWS headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_NEWS_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_SYSLOG headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_SYSLOG
+
+/* Define SYSLOG_FACILITY_LOG_SYSLOG headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_SYSLOG_VERSION
+
+/* Define if your system has the SYSLOG_FACILITY_LOG_UUCP headers. */
+#undef HAVE_SYSLOG_FACILITY_LOG_UUCP
+
+/* Define SYSLOG_FACILITY_LOG_UUCP headers version */
+#undef HAVE_SYSLOG_FACILITY_LOG_UUCP_VERSION
+
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
@@ -1211,6 +1277,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* Define to 1 if the C compiler supports function prototypes. */
+#undef PROTOTYPES
+
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
@@ -1226,6 +1295,11 @@
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+ second argument and the buffer pointer as the third, as on System V before
+ release 3. */
+#undef SETVBUF_REVERSED
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
@@ -1247,46 +1321,50 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
-/* Enable extensions on AIX 3, Interix. */
+/* Define to 1 if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
-/* Enable threading extensions on Solaris. */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Enable extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
-/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-#undef _LARGEFILE_SOURCE
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
-
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#undef _POSIX_SOURCE
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
Modified: trunk/main/syslog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/syslog.c?view=diff&rev=203569&r1=203568&r2=203569
==============================================================================
--- trunk/main/syslog.c (original)
+++ trunk/main/syslog.c Thu Jun 25 22:06:06 2009
@@ -30,73 +30,92 @@
#include <syslog.h>
+static const struct {
+ const char *name;
+ int value;
+} facility_map[] = {
+ /* POSIX only specifies USER and LOCAL0 - LOCAL7 */
+ { "USER", LOG_USER },
+ { "LOCAL0", LOG_LOCAL0 },
+ { "LOCAL1", LOG_LOCAL1 },
+ { "LOCAL2", LOG_LOCAL2 },
+ { "LOCAL3", LOG_LOCAL3 },
+ { "LOCAL4", LOG_LOCAL4 },
+ { "LOCAL5", LOG_LOCAL5 },
+ { "LOCAL6", LOG_LOCAL6 },
+ { "LOCAL7", LOG_LOCAL7 },
+#if defined(HAVE_SYSLOG_FACILITY_LOG_KERN)
+ { "KERN", LOG_KERN },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_MAIL)
+ { "MAIL", LOG_MAIL },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_DAEMON)
+ { "DAEMON", LOG_DAEMON },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_AUTH)
+ { "AUTH", LOG_AUTH },
+ { "SECURITY", LOG_AUTH },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV)
+ { "AUTHPRIV", LOG_AUTHPRIV },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_SYSLOG)
+ { "SYSLOG", LOG_SYSLOG },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_FTP)
+ { "FTP", LOG_FTP },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_LPR)
+ { "LPR", LOG_LPR },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_NEWS)
+ { "NEWS", LOG_NEWS },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_UUCP)
+ { "UUCP", LOG_UUCP },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_CRON)
+ { "CRON", LOG_CRON },
+#endif
+};
+
int ast_syslog_facility(const char *facility)
{
- if (!strcasecmp(facility, "KERN")) {
- return LOG_KERN;
- } else if (!strcasecmp(facility, "USER")) {
- return LOG_USER;
- } else if (!strcasecmp(facility, "MAIL")) {
- return LOG_MAIL;
- } else if (!strcasecmp(facility, "DAEMON")) {
- return LOG_DAEMON;
- } else if (!strcasecmp(facility, "AUTH")) {
- return LOG_AUTH;
- } else if (!strcasecmp(facility, "AUTHPRIV")) {
- return LOG_AUTHPRIV;
- } else if (!strcasecmp(facility, "SYSLOG")) {
- return LOG_SYSLOG;
- } else if (!strcasecmp(facility, "SECURITY")) {
- return LOG_AUTH;
- } else if (!strcasecmp(facility, "FTP")) {
- return LOG_FTP;
- } else if (!strcasecmp(facility, "LPR")) {
- return LOG_LPR;
- } else if (!strcasecmp(facility, "NEWS")) {
- return LOG_NEWS;
- } else if (!strcasecmp(facility, "UUCP")) {
- return LOG_UUCP;
- } else if (!strcasecmp(facility, "CRON")) {
- return LOG_CRON;
- } else if (!strcasecmp(facility, "LOCAL0")) {
- return LOG_LOCAL0;
- } else if (!strcasecmp(facility, "LOCAL1")) {
- return LOG_LOCAL1;
- } else if (!strcasecmp(facility, "LOCAL2")) {
- return LOG_LOCAL2;
- } else if (!strcasecmp(facility, "LOCAL3")) {
- return LOG_LOCAL3;
- } else if (!strcasecmp(facility, "LOCAL4")) {
- return LOG_LOCAL4;
- } else if (!strcasecmp(facility, "LOCAL5")) {
- return LOG_LOCAL5;
- } else if (!strcasecmp(facility, "LOCAL6")) {
- return LOG_LOCAL6;
- } else if (!strcasecmp(facility, "LOCAL7")) {
- return LOG_LOCAL7;
+ int index;
+
+ for (index = 0; index < ARRAY_LEN(facility_map); index++) {
+ if (!strcasecmp(facility_map[index].name, facility)) {
+ return facility_map[index].value;
+ }
}
return -1;
}
+static const struct {
+ const char *name;
+ int value;
+} priority_map[] = {
+ { "ALERT", LOG_ALERT },
+ { "CRIT", LOG_CRIT },
+ { "DEBUG", LOG_DEBUG },
+ { "EMERG", LOG_EMERG },
+ { "ERR", LOG_ERR },
+ { "ERROR", LOG_ERR },
+ { "INFO", LOG_INFO },
+ { "NOTICE", LOG_NOTICE },
+ { "WARNING", LOG_WARNING }
+};
+
int ast_syslog_priority(const char *priority)
{
- if (!strcasecmp(priority, "ALERT")) {
- return LOG_ALERT;
- } else if (!strcasecmp(priority, "CRIT")) {
- return LOG_CRIT;
- } else if (!strcasecmp(priority, "DEBUG")) {
- return LOG_DEBUG;
- } else if (!strcasecmp(priority, "EMERG")) {
- return LOG_EMERG;
- } else if (!strcasecmp(priority, "ERR")) {
- return LOG_ERR;
- } else if (!strcasecmp(priority, "INFO")) {
- return LOG_INFO;
- } else if (!strcasecmp(priority, "NOTICE")) {
- return LOG_NOTICE;
- } else if (!strcasecmp(priority, "WARNING")) {
- return LOG_WARNING;
+ int index;
+
+ for (index = 0; index < ARRAY_LEN(priority_map); index++) {
+ if (!strcasecmp(priority_map[index].name, priority)) {
+ return priority_map[index].value;
+ }
}
return -1;
More information about the svn-commits
mailing list