diff options
author | dbailey <dbailey@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-21 14:00:55 +0000 |
---|---|---|
committer | dbailey <dbailey@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-21 14:00:55 +0000 |
commit | 607a203e201dece83b2e2eb8dd40039b23a2d358 (patch) | |
tree | d3893fa76a31c89c99116488be38db303133dac9 | |
parent | a3720841ae07657c947fc2fea90586bcdb89e9d2 (diff) |
Add check in configure script to check for GLOB_NOMAGIC and GLOB_BRACE in glob.h
This allows config.c to compile when linked against uclibc that does not support these parameters
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@189601 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | configure | 122 | ||||
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | include/asterisk/autoconfig.h.in | 6 | ||||
-rw-r--r-- | include/asterisk/compat.h | 11 | ||||
-rw-r--r-- | main/config.c | 9 |
5 files changed, 149 insertions, 17 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 182810 . +# From configure.ac Revision: 183241 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.4. # @@ -12283,13 +12283,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/types.h> /* for off_t */ - #include <stdio.h> +#include <stdio.h> int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -12329,13 +12327,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include <sys/types.h> /* for off_t */ - #include <stdio.h> +#include <stdio.h> int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -15912,6 +15908,114 @@ fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking for GLOB_NOMAGIC" >&5 +echo $ECHO_N "checking for GLOB_NOMAGIC... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <glob.h> +int +main () +{ +int foo = GLOB_NOMAGIC; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLOB_NOMAGIC 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for GLOB_BRACE" >&5 +echo $ECHO_N "checking for GLOB_BRACE... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <glob.h> +int +main () +{ +int foo = GLOB_BRACE; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GLOB_BRACE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + { echo "$as_me:$LINENO: checking for IP_MTU_DISCOVER" >&5 echo $ECHO_N "checking for IP_MTU_DISCOVER... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF diff --git a/configure.ac b/configure.ac index aaa48608d..ad7743422 100644 --- a/configure.ac +++ b/configure.ac @@ -432,6 +432,24 @@ AC_LINK_IFELSE( AC_MSG_RESULT(no) ) +AC_MSG_CHECKING(for GLOB_NOMAGIC) +AC_LINK_IFELSE( + AC_LANG_PROGRAM([#include <glob.h>], + [int foo = GLOB_NOMAGIC;]), + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_GLOB_NOMAGIC], 1, [Define to 1 if your glob function supports GLOB_NOMAGIC option.]), + AC_MSG_RESULT(no) +) + +AC_MSG_CHECKING(for GLOB_BRACE) +AC_LINK_IFELSE( + AC_LANG_PROGRAM([#include <glob.h>], + [int foo = GLOB_BRACE;]), + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_GLOB_BRACE], 1, [Define to 1 if your glob function supports GLOB_BRACE option.]), + AC_MSG_RESULT(no) +) + AC_MSG_CHECKING(for IP_MTU_DISCOVER) AC_LINK_IFELSE( AC_LANG_PROGRAM([#include <netinet/in.h>], diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index e3de4487f..a77ac3fa0 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -147,6 +147,12 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* Define to 1 if your glob function supports GLOB_BRACE option. */ +#undef HAVE_GLOB_BRACE + +/* Define to 1 if your glob function supports GLOB_NOMAGIC option. */ +#undef HAVE_GLOB_NOMAGIC + /* Define to indicate the ${GNUTLS_DESCRIP} library */ #undef HAVE_GNUTLS diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h index 22261a390..fa312d29b 100644 --- a/include/asterisk/compat.h +++ b/include/asterisk/compat.h @@ -128,4 +128,15 @@ typedef unsigned int uint; typedef unsigned long long uint64_t; #endif +/* glob compat stuff */ +#if defined(__Darwin__) || defined(__CYGWIN__) +#define GLOB_ABORTED GLOB_ABEND +#endif + +#if !defined(HAVE_GLOB_NOMAGIC) || !defined(HAVE_GLOB_BRACE) +#define MY_GLOB_FLAGS GLOB_NOCHECK +#else +#define MY_GLOB_FLAGS (GLOB_NOMAGIC | GLOB_BRACE) +#endif + #endif diff --git a/main/config.c b/main/config.c index 6163f827a..4fc929c6f 100644 --- a/main/config.c +++ b/main/config.c @@ -39,9 +39,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <sys/stat.h> #define AST_INCLUDE_GLOB 1 #ifdef AST_INCLUDE_GLOB -#if defined(__Darwin__) || defined(__CYGWIN__) -#define GLOB_ABORTED GLOB_ABEND -#endif # include <glob.h> #endif @@ -852,11 +849,7 @@ static struct ast_config *config_text_file_load(const char *database, const char int glob_ret; glob_t globbuf; globbuf.gl_offs = 0; /* initialize it to silence gcc */ -#ifdef SOLARIS - glob_ret = glob(fn, GLOB_NOCHECK, NULL, &globbuf); -#else - glob_ret = glob(fn, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf); -#endif + glob_ret = glob(fn, MY_GLOB_FLAGS, NULL, &globbuf); if (glob_ret == GLOB_NOSPACE) ast_log(LOG_WARNING, "Glob Expansion of pattern '%s' failed: Not enough memory\n", fn); |