Merged revisions 289104 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 28 Sep 2010 18:20:20 +0000 (18:20 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 28 Sep 2010 18:20:20 +0000 (18:20 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r289104 | tilghman | 2010-09-28 13:18:43 -0500 (Tue, 28 Sep 2010) | 4 lines

  Solaris compatibility fixes

  Review: https://reviewboard.asterisk.org/r/942/
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@289112 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
apps/app_voicemail.c
configure
configure.ac
include/asterisk/autoconfig.h.in
include/asterisk/compat.h
main/strcompat.c
makeopts.in
tests/test_time.c
tests/test_utils.c

index d0f02a3..613003e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -124,46 +124,6 @@ OVERWRITE=y
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g3
 
-# Define standard directories for various platforms
-# These apply if they are not redefined in asterisk.conf 
-ifeq ($(OSARCH),SunOS)
-  ASTETCDIR=/var/etc/asterisk
-  ASTLIBDIR=/opt/asterisk/lib
-  ASTVARLIBDIR=/var/opt/asterisk
-  ASTDBDIR=$(ASTVARLIBDIR)
-  ASTKEYDIR=$(ASTVARLIBDIR)
-  ASTSPOOLDIR=/var/spool/asterisk
-  ASTLOGDIR=/var/log/asterisk
-  ASTHEADERDIR=/opt/asterisk/include
-  ASTSBINDIR=/opt/asterisk/sbin
-  ASTVARRUNDIR=/var/run/asterisk
-  ASTMANDIR=/opt/asterisk/man
-else
-  ASTETCDIR=$(sysconfdir)/asterisk
-  ASTLIBDIR=$(libdir)/asterisk
-  ASTHEADERDIR=$(includedir)/asterisk
-  ASTSBINDIR=$(sbindir)
-  ASTSPOOLDIR=$(localstatedir)/spool/asterisk
-  ASTLOGDIR=$(localstatedir)/log/asterisk
-  ASTVARRUNDIR=$(localstatedir)/run/asterisk
-  ASTMANDIR=$(mandir)
-ifneq ($(findstring BSD,$(OSARCH)),)
-  ASTVARLIBDIR=$(prefix)/share/asterisk
-  ASTVARRUNDIR=$(localstatedir)/run/asterisk
-  ASTDBDIR=$(localstatedir)/db/asterisk
-else
-  ASTVARLIBDIR=$(localstatedir)/lib/asterisk
-  ASTDBDIR=$(ASTVARLIBDIR)
-endif
-ifneq ($(findstring darwin,$(OSARCH)),)
-  ASTVARRUNDIR=/Library/Application Support/Asterisk/Run
-endif
-  ASTKEYDIR=$(ASTVARLIBDIR)
-endif
-ifeq ($(ASTDATADIR),)
-  ASTDATADIR:=$(ASTVARLIBDIR)
-endif
-
 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
 # when starting Asterisk
 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
index 87bfcab..46c3f4d 100644 (file)
@@ -12432,7 +12432,7 @@ AST_TEST_DEFINE(test_voicemail_notify_endl)
        char testcontext[] = "test";
        char testmailbox[] = "00000000";
        char from[] = "test@example.net", cidnum[] = "1234", cidname[] = "Mark Spencer", format[] = "gsm";
-       char attach[] = "/var/lib/asterisk/sounds/en/tt-weasels", attach2[] = "/var/lib/asterisk/sounds/en/tt-somethingwrong";
+       char attach[256], attach2[256];
        char buf[256] = ""; /* No line should actually be longer than 80 */
        struct ast_channel *chan = NULL;
        struct ast_vm_user *vmu, vmus = {
@@ -12470,6 +12470,9 @@ AST_TEST_DEFINE(test_voicemail_notify_endl)
                break;
        }
 
+       snprintf(attach, sizeof(attach), "%s/sounds/en/tt-weasels", ast_config_AST_VAR_DIR);
+       snprintf(attach2, sizeof(attach2), "%s/sounds/en/tt-somethingwrong", ast_config_AST_VAR_DIR);
+
        if (!(vmu = find_user(&vmus, testcontext, testmailbox)) &&
                !(vmu = find_or_create(testcontext, testmailbox))) {
                ast_test_status_update(test, "Cannot create vmu structure\n");
index d51111d..236b49f 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 285932 .
+# From configure.ac Revision: 288639 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk trunk.
 #
@@ -679,6 +679,18 @@ OBJEXT
 CPP
 GREP
 EGREP
+astsbindir
+astetcdir
+astheaderdir
+astlibdir
+astmandir
+astvarlibdir
+astdatadir
+astdbdir
+astkeydir
+astspooldir
+astlogdir
+astvarrundir
 BUILD_PLATFORM
 BUILD_CPU
 BUILD_VENDOR
@@ -4258,7 +4270,34 @@ _ACEOF
 #define _TANDEM_SOURCE 1
 _ACEOF
 
-       # note- does not work on FreeBSD
+
+# System default paths
+astsbindir='${sbindir}'
+astetcdir='${sysconfdir}/asterisk'
+astheaderdir='${includedir}/asterisk'
+astlibdir='${libdir}/asterisk'
+astmandir='${mandir}'
+astvarlibdir='${localstatedir}/lib/asterisk'
+astdatadir='${astvarlibdir}'
+astdbdir='${astvarlibdir}'
+astkeydir='${astvarlibdir}'
+astspooldir='${localstatedir}/spool/asterisk'
+astlogdir='${localstatedir}/log/asterisk'
+astvarrundir='${localstatedir}/run/asterisk'
+
+case "${host_os}" in
+     *bsd*)
+     if test ${prefix} = 'NONE'; then
+        astvarlibdir='${prefix}/share/asterisk'
+        astdbdir='${localstatedir}/db/asterisk'
+     fi
+     ;;
+     darwin*)
+     if test ${prefix} = 'NONE'; then
+        astvarrundir='/Library/Application Support/Asterisk/Run'
+     fi
+     ;;
+esac
 
 case "${host_os}" in
      freebsd*)
@@ -4270,10 +4309,10 @@ case "${host_os}" in
 
      if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
         if test ${sysconfdir} = '${prefix}/etc'; then
-           sysconfdir=/etc
+           astetcdir=/etc/asterisk
         fi
         if test ${mandir} = '${prefix}/man'; then
-           mandir=/usr/share/man
+           astmandir=/usr/share/man
         fi
      fi
      CPPFLAGS=-I/usr/local/include
@@ -4291,6 +4330,19 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
      ;;
+     solaris*)
+     if test ${prefix} = 'NONE'; then
+        astetcdir=/var/etc/asterisk
+        astsbindir=/opt/asterisk/sbin
+        astlibdir=/opt/asterisk/lib
+        astheaderdir=/opt/asterisk/include
+        astmandir=/opt/asterisk/man
+        astvarlibdir=/var/opt/asterisk
+        astspooldir=/var/spool/asterisk
+        astlogdir=/var/log/asterisk
+        astvarrundir=/var/run/asterisk
+     fi
+     ;;
      *)
 
      if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
@@ -17898,7 +17950,8 @@ done
 
 
 
-for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
+
+for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -54359,6 +54412,18 @@ OBJEXT!$OBJEXT$ac_delim
 CPP!$CPP$ac_delim
 GREP!$GREP$ac_delim
 EGREP!$EGREP$ac_delim
+astsbindir!$astsbindir$ac_delim
+astetcdir!$astetcdir$ac_delim
+astheaderdir!$astheaderdir$ac_delim
+astlibdir!$astlibdir$ac_delim
+astmandir!$astmandir$ac_delim
+astvarlibdir!$astvarlibdir$ac_delim
+astdatadir!$astdatadir$ac_delim
+astdbdir!$astdbdir$ac_delim
+astkeydir!$astkeydir$ac_delim
+astspooldir!$astspooldir$ac_delim
+astlogdir!$astlogdir$ac_delim
+astvarrundir!$astvarrundir$ac_delim
 BUILD_PLATFORM!$BUILD_PLATFORM$ac_delim
 BUILD_CPU!$BUILD_CPU$ac_delim
 BUILD_VENDOR!$BUILD_VENDOR$ac_delim
@@ -54387,18 +54452,6 @@ GNU_MAKE!$GNU_MAKE$ac_delim
 STRIP!$STRIP$ac_delim
 ac_ct_STRIP!$ac_ct_STRIP$ac_delim
 AR!$AR$ac_delim
-ac_ct_AR!$ac_ct_AR$ac_delim
-SHA1SUM!$SHA1SUM$ac_delim
-ac_ct_SHA1SUM!$ac_ct_SHA1SUM$ac_delim
-OPENSSL!$OPENSSL$ac_delim
-ac_ct_OPENSSL!$ac_ct_OPENSSL$ac_delim
-GNU_LD!$GNU_LD$ac_delim
-BISON!$BISON$ac_delim
-FLEX!$FLEX$ac_delim
-FIND!$FIND$ac_delim
-COMPRESS!$COMPRESS$ac_delim
-BASENAME!$BASENAME$ac_delim
-DIRNAME!$DIRNAME$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54440,6 +54493,18 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+ac_ct_AR!$ac_ct_AR$ac_delim
+SHA1SUM!$SHA1SUM$ac_delim
+ac_ct_SHA1SUM!$ac_ct_SHA1SUM$ac_delim
+OPENSSL!$OPENSSL$ac_delim
+ac_ct_OPENSSL!$ac_ct_OPENSSL$ac_delim
+GNU_LD!$GNU_LD$ac_delim
+BISON!$BISON$ac_delim
+FLEX!$FLEX$ac_delim
+FIND!$FIND$ac_delim
+COMPRESS!$COMPRESS$ac_delim
+BASENAME!$BASENAME$ac_delim
+DIRNAME!$DIRNAME$ac_delim
 LN!$LN$ac_delim
 DOT!$DOT$ac_delim
 WGET!$WGET$ac_delim
@@ -54525,18 +54590,6 @@ PBX_ICONV!$PBX_ICONV$ac_delim
 IKSEMEL_LIB!$IKSEMEL_LIB$ac_delim
 IKSEMEL_INCLUDE!$IKSEMEL_INCLUDE$ac_delim
 IKSEMEL_DIR!$IKSEMEL_DIR$ac_delim
-PBX_IKSEMEL!$PBX_IKSEMEL$ac_delim
-IMAP_TK_LIB!$IMAP_TK_LIB$ac_delim
-IMAP_TK_INCLUDE!$IMAP_TK_INCLUDE$ac_delim
-IMAP_TK_DIR!$IMAP_TK_DIR$ac_delim
-PBX_IMAP_TK!$PBX_IMAP_TK$ac_delim
-INOTIFY_LIB!$INOTIFY_LIB$ac_delim
-INOTIFY_INCLUDE!$INOTIFY_INCLUDE$ac_delim
-INOTIFY_DIR!$INOTIFY_DIR$ac_delim
-PBX_INOTIFY!$PBX_INOTIFY$ac_delim
-IODBC_LIB!$IODBC_LIB$ac_delim
-IODBC_INCLUDE!$IODBC_INCLUDE$ac_delim
-IODBC_DIR!$IODBC_DIR$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54578,6 +54631,18 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+PBX_IKSEMEL!$PBX_IKSEMEL$ac_delim
+IMAP_TK_LIB!$IMAP_TK_LIB$ac_delim
+IMAP_TK_INCLUDE!$IMAP_TK_INCLUDE$ac_delim
+IMAP_TK_DIR!$IMAP_TK_DIR$ac_delim
+PBX_IMAP_TK!$PBX_IMAP_TK$ac_delim
+INOTIFY_LIB!$INOTIFY_LIB$ac_delim
+INOTIFY_INCLUDE!$INOTIFY_INCLUDE$ac_delim
+INOTIFY_DIR!$INOTIFY_DIR$ac_delim
+PBX_INOTIFY!$PBX_INOTIFY$ac_delim
+IODBC_LIB!$IODBC_LIB$ac_delim
+IODBC_INCLUDE!$IODBC_INCLUDE$ac_delim
+IODBC_DIR!$IODBC_DIR$ac_delim
 PBX_IODBC!$PBX_IODBC$ac_delim
 ISDNNET_LIB!$ISDNNET_LIB$ac_delim
 ISDNNET_INCLUDE!$ISDNNET_INCLUDE$ac_delim
@@ -54663,18 +54728,6 @@ OSS_LIB!$OSS_LIB$ac_delim
 OSS_INCLUDE!$OSS_INCLUDE$ac_delim
 OSS_DIR!$OSS_DIR$ac_delim
 PBX_OSS!$PBX_OSS$ac_delim
-PGSQL_LIB!$PGSQL_LIB$ac_delim
-PGSQL_INCLUDE!$PGSQL_INCLUDE$ac_delim
-PGSQL_DIR!$PGSQL_DIR$ac_delim
-PBX_PGSQL!$PBX_PGSQL$ac_delim
-POPT_LIB!$POPT_LIB$ac_delim
-POPT_INCLUDE!$POPT_INCLUDE$ac_delim
-POPT_DIR!$POPT_DIR$ac_delim
-PBX_POPT!$PBX_POPT$ac_delim
-PORTAUDIO_LIB!$PORTAUDIO_LIB$ac_delim
-PORTAUDIO_INCLUDE!$PORTAUDIO_INCLUDE$ac_delim
-PORTAUDIO_DIR!$PORTAUDIO_DIR$ac_delim
-PBX_PORTAUDIO!$PBX_PORTAUDIO$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54716,6 +54769,18 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+PGSQL_LIB!$PGSQL_LIB$ac_delim
+PGSQL_INCLUDE!$PGSQL_INCLUDE$ac_delim
+PGSQL_DIR!$PGSQL_DIR$ac_delim
+PBX_PGSQL!$PBX_PGSQL$ac_delim
+POPT_LIB!$POPT_LIB$ac_delim
+POPT_INCLUDE!$POPT_INCLUDE$ac_delim
+POPT_DIR!$POPT_DIR$ac_delim
+PBX_POPT!$PBX_POPT$ac_delim
+PORTAUDIO_LIB!$PORTAUDIO_LIB$ac_delim
+PORTAUDIO_INCLUDE!$PORTAUDIO_INCLUDE$ac_delim
+PORTAUDIO_DIR!$PORTAUDIO_DIR$ac_delim
+PBX_PORTAUDIO!$PBX_PORTAUDIO$ac_delim
 PRI_LIB!$PRI_LIB$ac_delim
 PRI_INCLUDE!$PRI_INCLUDE$ac_delim
 PRI_DIR!$PRI_DIR$ac_delim
@@ -54801,18 +54866,6 @@ SDL_IMAGE_INCLUDE!$SDL_IMAGE_INCLUDE$ac_delim
 SDL_IMAGE_DIR!$SDL_IMAGE_DIR$ac_delim
 PBX_SDL_IMAGE!$PBX_SDL_IMAGE$ac_delim
 SOUNDS_CACHE_DIR!$SOUNDS_CACHE_DIR$ac_delim
-SPANDSP_LIB!$SPANDSP_LIB$ac_delim
-SPANDSP_INCLUDE!$SPANDSP_INCLUDE$ac_delim
-SPANDSP_DIR!$SPANDSP_DIR$ac_delim
-PBX_SPANDSP!$PBX_SPANDSP$ac_delim
-SS7_LIB!$SS7_LIB$ac_delim
-SS7_INCLUDE!$SS7_INCLUDE$ac_delim
-SS7_DIR!$SS7_DIR$ac_delim
-PBX_SS7!$PBX_SS7$ac_delim
-SPEEX_LIB!$SPEEX_LIB$ac_delim
-SPEEX_INCLUDE!$SPEEX_INCLUDE$ac_delim
-SPEEX_DIR!$SPEEX_DIR$ac_delim
-PBX_SPEEX!$PBX_SPEEX$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54854,6 +54907,18 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+SPANDSP_LIB!$SPANDSP_LIB$ac_delim
+SPANDSP_INCLUDE!$SPANDSP_INCLUDE$ac_delim
+SPANDSP_DIR!$SPANDSP_DIR$ac_delim
+PBX_SPANDSP!$PBX_SPANDSP$ac_delim
+SS7_LIB!$SS7_LIB$ac_delim
+SS7_INCLUDE!$SS7_INCLUDE$ac_delim
+SS7_DIR!$SS7_DIR$ac_delim
+PBX_SS7!$PBX_SS7$ac_delim
+SPEEX_LIB!$SPEEX_LIB$ac_delim
+SPEEX_INCLUDE!$SPEEX_INCLUDE$ac_delim
+SPEEX_DIR!$SPEEX_DIR$ac_delim
+PBX_SPEEX!$PBX_SPEEX$ac_delim
 SPEEX_PREPROCESS_LIB!$SPEEX_PREPROCESS_LIB$ac_delim
 SPEEX_PREPROCESS_INCLUDE!$SPEEX_PREPROCESS_INCLUDE$ac_delim
 SPEEX_PREPROCESS_DIR!$SPEEX_PREPROCESS_DIR$ac_delim
@@ -54939,18 +55004,6 @@ GC_CFLAGS!$GC_CFLAGS$ac_delim
 GC_LDFLAGS!$GC_LDFLAGS$ac_delim
 AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
 AST_FORTIFY_SOURCE!$AST_FORTIFY_SOURCE$ac_delim
-AST_NO_STRICT_OVERFLOW!$AST_NO_STRICT_OVERFLOW$ac_delim
-AST_SHADOW_WARNINGS!$AST_SHADOW_WARNINGS$ac_delim
-PBX_GLOB_NOMAGIC!$PBX_GLOB_NOMAGIC$ac_delim
-PBX_GLOB_BRACE!$PBX_GLOB_BRACE$ac_delim
-PBX_IP_MTU_DISCOVER!$PBX_IP_MTU_DISCOVER$ac_delim
-PBX_DAHDI_HALF_FULL!$PBX_DAHDI_HALF_FULL$ac_delim
-GSM_INTERNAL!$GSM_INTERNAL$ac_delim
-CONFIG_LIBXML2!$CONFIG_LIBXML2$ac_delim
-PBX_MISDN_FAC_RESULT!$PBX_MISDN_FAC_RESULT$ac_delim
-PBX_MISDN_FAC_ERROR!$PBX_MISDN_FAC_ERROR$ac_delim
-CONFIG_MYSQLCLIENT!$CONFIG_MYSQLCLIENT$ac_delim
-CONFIG_NEON!$CONFIG_NEON$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54992,6 +55045,18 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+AST_NO_STRICT_OVERFLOW!$AST_NO_STRICT_OVERFLOW$ac_delim
+AST_SHADOW_WARNINGS!$AST_SHADOW_WARNINGS$ac_delim
+PBX_GLOB_NOMAGIC!$PBX_GLOB_NOMAGIC$ac_delim
+PBX_GLOB_BRACE!$PBX_GLOB_BRACE$ac_delim
+PBX_IP_MTU_DISCOVER!$PBX_IP_MTU_DISCOVER$ac_delim
+PBX_DAHDI_HALF_FULL!$PBX_DAHDI_HALF_FULL$ac_delim
+GSM_INTERNAL!$GSM_INTERNAL$ac_delim
+CONFIG_LIBXML2!$CONFIG_LIBXML2$ac_delim
+PBX_MISDN_FAC_RESULT!$PBX_MISDN_FAC_RESULT$ac_delim
+PBX_MISDN_FAC_ERROR!$PBX_MISDN_FAC_ERROR$ac_delim
+CONFIG_MYSQLCLIENT!$CONFIG_MYSQLCLIENT$ac_delim
+CONFIG_NEON!$CONFIG_NEON$ac_delim
 CONFIG_NEON29!$CONFIG_NEON29$ac_delim
 CONFIG_NETSNMP!$CONFIG_NETSNMP$ac_delim
 PG_CONFIG!$PG_CONFIG$ac_delim
@@ -55035,7 +55100,7 @@ PBX_SYSLOG!$PBX_SYSLOG$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 41; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 53; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 98fd515..341ae36 100644 (file)
@@ -37,7 +37,35 @@ AC_SUBST(CONFIG_LDFLAGS)
 # specify output header file
 AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
 
-AC_USE_SYSTEM_EXTENSIONS       # note- does not work on FreeBSD
+AC_USE_SYSTEM_EXTENSIONS       dnl note- does not work on FreeBSD
+
+# System default paths
+AC_SUBST([astsbindir],        ['${sbindir}'])dnl
+AC_SUBST([astetcdir],         ['${sysconfdir}/asterisk'])dnl
+AC_SUBST([astheaderdir],      ['${includedir}/asterisk'])dnl
+AC_SUBST([astlibdir],         ['${libdir}/asterisk'])dnl
+AC_SUBST([astmandir],         ['${mandir}'])dnl
+AC_SUBST([astvarlibdir],      ['${localstatedir}/lib/asterisk'])dnl
+AC_SUBST([astdatadir],        ['${astvarlibdir}'])dnl
+AC_SUBST([astdbdir],          ['${astvarlibdir}'])dnl
+AC_SUBST([astkeydir],         ['${astvarlibdir}'])dnl
+AC_SUBST([astspooldir],       ['${localstatedir}/spool/asterisk'])dnl
+AC_SUBST([astlogdir],         ['${localstatedir}/log/asterisk'])dnl
+AC_SUBST([astvarrundir],      ['${localstatedir}/run/asterisk'])dnl
+
+case "${host_os}" in
+     *bsd*)
+     if test ${prefix} = 'NONE'; then
+        astvarlibdir='${prefix}/share/asterisk'
+        astdbdir='${localstatedir}/db/asterisk'
+     fi
+     ;;
+     darwin*)
+     if test ${prefix} = 'NONE'; then
+        astvarrundir='/Library/Application Support/Asterisk/Run'
+     fi
+     ;;
+esac
 
 case "${host_os}" in
      freebsd*)
@@ -49,10 +77,10 @@ case "${host_os}" in
      AC_PREFIX_DEFAULT([/usr/local])
      if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
         if test ${sysconfdir} = '${prefix}/etc'; then
-           sysconfdir=/etc
+           astetcdir=/etc/asterisk
         fi
         if test ${mandir} = '${prefix}/man'; then
-           mandir=/usr/share/man
+           astmandir=/usr/share/man
         fi
      fi
      CPPFLAGS=-I/usr/local/include
@@ -62,6 +90,19 @@ case "${host_os}" in
      AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
      AC_DEFINE([_DARWIN_UNLIMITED_SELECT], 1, [Define to 1 if running on Darwin.])
      ;;
+     solaris*)
+     if test ${prefix} = 'NONE'; then
+        astetcdir=/var/etc/asterisk
+        astsbindir=/opt/asterisk/sbin
+        astlibdir=/opt/asterisk/lib
+        astheaderdir=/opt/asterisk/include
+        astmandir=/opt/asterisk/man
+        astvarlibdir=/var/opt/asterisk
+        astspooldir=/var/spool/asterisk
+        astlogdir=/var/log/asterisk
+        astvarrundir=/var/run/asterisk
+     fi
+     ;;
      *)
      AC_PREFIX_DEFAULT([/usr])
      if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
@@ -467,7 +508,7 @@ AC_FUNC_STRNLEN
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
 
 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
 # so that AC_CHECK_FUNCS can detect functions in that library.
index b438f42..cfc9f41 100644 (file)
 /* Define to 1 if you have the `mkdir' function. */
 #undef HAVE_MKDIR
 
+/* Define to 1 if you have the `mkdtemp' function. */
+#undef HAVE_MKDTEMP
+
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
index 78c2671..62e456b 100644 (file)
@@ -97,6 +97,10 @@ int getloadavg(double *list, int nelem);
 uint64_t htonll(uint64_t host64);
 #endif
 
+#ifndef HAVE_MKDTEMP
+char *mkdtemp(char *template_s);
+#endif
+
 #ifndef HAVE_NTOHLL
 uint64_t ntohll(uint64_t net64);
 #endif
index 831ab0c..e718cc6 100644 (file)
@@ -29,6 +29,8 @@
 #include <unistd.h>         /* for fcntl(2) */
 #include <fcntl.h>          /* for fcntl(2) */
 
+#include "asterisk/utils.h"
+
 #ifndef HAVE_STRSEP
 char *strsep(char **str, const char *delims)
 {
@@ -478,3 +480,91 @@ void closefrom(int n)
 }
 #endif
 
+#ifndef HAVE_MKDTEMP
+/*     $OpenBSD: mktemp.c,v 1.30 2010/03/21 23:09:30 schwarze Exp $ */
+/*
+ * Copyright (c) 1996-1998, 2008 Theo de Raadt
+ * Copyright (c) 1997, 2008-2009 Todd C. Miller
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define MKTEMP_NAME    0
+#define MKTEMP_FILE    1
+#define MKTEMP_DIR     2
+
+#define TEMPCHARS      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."
+#define NUM_CHARS      (sizeof(TEMPCHARS) - 1)
+
+static int mktemp_internal(char *path, int slen, int mode)
+{
+       char *start, *cp, *ep;
+       const char *tempchars = TEMPCHARS;
+       unsigned int r, tries;
+       struct stat sb;
+       size_t len;
+       int fd;
+
+       len = strlen(path);
+       if (len == 0 || slen >= len) {
+               errno = EINVAL;
+               return(-1);
+       }
+       ep = path + len - slen;
+
+       tries = 1;
+       for (start = ep; start > path && start[-1] == 'X'; start--) {
+               if (tries < INT_MAX / NUM_CHARS) {
+                       tries *= NUM_CHARS;
+               }
+       }
+       tries *= 2;
+
+       do {
+               for (cp = start; cp != ep; cp++) {
+                       r = ast_random() % NUM_CHARS;
+                       *cp = tempchars[r];
+               }
+
+               switch (mode) {
+               case MKTEMP_NAME:
+                       if (lstat(path, &sb) != 0) {
+                               return (errno == ENOENT ? 0 : -1);
+                       }
+                       break;
+               case MKTEMP_FILE:
+                       fd = open(path, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
+                       if (fd != -1 || errno != EEXIST) {
+                               return (fd);
+                       }
+                       break;
+               case MKTEMP_DIR:
+                       if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) == 0) {
+                               return (0);
+                       }
+                       if (errno != EEXIST) {
+                               return (-1);
+                       }
+                       break;
+               }
+       } while (--tries);
+
+       errno = EEXIST;
+       return(-1);
+}
+
+char *mkdtemp(char *path)
+{
+       return mktemp_internal(path, 0, MKTEMP_DIR) ? NULL : path;
+}
+#endif
index 2680968..5e9ef8c 100644 (file)
@@ -77,6 +77,20 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 
+ASTSBINDIR = @astsbindir@
+ASTETCDIR = @astetcdir@
+ASTHEADERDIR = @astheaderdir@
+ASTLIBDIR = @astlibdir@
+ASTMANDIR = @astmandir@
+astvarlibdir = @astvarlibdir@
+ASTVARLIBDIR = @astvarlibdir@
+ASTDATADIR = @astdatadir@
+ASTDBDIR = @astdbdir@
+ASTKEYDIR = @astkeydir@
+ASTSPOOLDIR = @astspooldir@
+ASTLOGDIR = @astlogdir@
+ASTVARRUNDIR = @astvarrundir@
+
 AST_DEVMODE=@AST_DEVMODE@
 NOISY_BUILD=@NOISY_BUILD@
 
index 0fc7785..0fca0fd 100644 (file)
@@ -82,6 +82,7 @@ AST_TEST_DEFINE(test_timezone_watch)
                                ast_log(LOG_WARNING, "system(%s) returned non-zero: %d\n", syscmd, system_res);
                        }
                        ast_localtime_wakeup_monitor();
+                       sched_yield();
                        ast_localtime(&tv, &atm[i], tzfile);
                        if (i != 0) {
                                if (atm[i].tm_hour == atm[i - 1].tm_hour) {
index b6ff324..ceeb57c 100644 (file)
@@ -253,6 +253,7 @@ AST_TEST_DEFINE(crypto_loaded_test)
                break;
        }
 
+#if 0 /* Not defined on Solaris */
        ast_test_status_update(test,
                               "address of __stub__ast_crypto_loaded is %p\n",
                               __stub__ast_crypto_loaded);
@@ -264,6 +265,7 @@ AST_TEST_DEFINE(crypto_loaded_test)
        ast_test_status_update(test,
                               "pointer to ast_crypto_loaded is %p\n",
                               ast_crypto_loaded);
+#endif
 
        return ast_crypto_loaded() ? AST_TEST_PASS : AST_TEST_FAIL;
 }
@@ -308,6 +310,7 @@ AST_TEST_DEFINE(agi_loaded_test)
                break;
        }
 
+#if 0
        ast_test_status_update(test,
                               "address of __stub__ast_agi_register is %p\n",
                               __stub__ast_agi_register);
@@ -319,6 +322,7 @@ AST_TEST_DEFINE(agi_loaded_test)
        ast_test_status_update(test,
                               "pointer to ast_agi_register is %p\n",
                               ast_agi_register);
+#endif
 
        if (ast_agi_register(ast_module_info->self, &noop_command) == AST_OPTIONAL_API_UNAVAILABLE) {
                return AST_TEST_FAIL;