From: Doug Bailey Date: Tue, 21 Apr 2009 14:00:55 +0000 (+0000) Subject: Add check in configure script to check for GLOB_NOMAGIC and GLOB_BRACE in glob.h X-Git-Tag: 1.4.25-rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d266db16a4ee6cc775d16112dd3d0ec03033a52;p=thirdparty%2Fasterisk.git 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: https://origsvn.digium.com/svn/asterisk/branches/1.4@189601 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/configure b/configure index 8eeff7e564..6c4c9b66f3 100755 --- a/configure +++ b/configure @@ -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 /* for off_t */ - #include +#include 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 /* for off_t */ - #include +#include 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; } @@ -15909,6 +15905,114 @@ 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_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 +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 +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 diff --git a/configure.ac b/configure.ac index aaa48608d6..ad7743422c 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 ], + [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 ], + [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 ], diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index e3de4487f8..a77ac3fa00 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 22261a3907..fa312d29b7 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 6163f827a4..4fc929c6f9 100644 --- a/main/config.c +++ b/main/config.c @@ -39,9 +39,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include #define AST_INCLUDE_GLOB 1 #ifdef AST_INCLUDE_GLOB -#if defined(__Darwin__) || defined(__CYGWIN__) -#define GLOB_ABORTED GLOB_ABEND -#endif # include #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);