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
This commit is contained in:
Doug Bailey
2009-04-21 14:00:55 +00:00
parent 591dd05d9e
commit 9d266db16a
5 changed files with 149 additions and 17 deletions

122
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.ac Revision: 182810 . # From configure.ac Revision: 183241 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.4. # Generated by GNU Autoconf 2.61 for asterisk 1.4.
# #
@@ -12283,13 +12283,11 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
#include <sys/types.h> /* for off_t */ #include <stdio.h>
#include <stdio.h>
int int
main () main ()
{ {
int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
; ;
return 0; return 0;
} }
@@ -12329,13 +12327,11 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
#define _LARGEFILE_SOURCE 1 #define _LARGEFILE_SOURCE 1
#include <sys/types.h> /* for off_t */ #include <stdio.h>
#include <stdio.h>
int int
main () main ()
{ {
int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
; ;
return 0; return 0;
} }
@@ -15909,6 +15905,114 @@ echo "${ECHO_T}no" >&6; }
fi 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 \ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext

View File

@@ -432,6 +432,24 @@ AC_LINK_IFELSE(
AC_MSG_RESULT(no) 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_MSG_CHECKING(for IP_MTU_DISCOVER)
AC_LINK_IFELSE( AC_LINK_IFELSE(
AC_LANG_PROGRAM([#include <netinet/in.h>], AC_LANG_PROGRAM([#include <netinet/in.h>],

View File

@@ -147,6 +147,12 @@
/* Define to 1 if you have the `gettimeofday' function. */ /* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY #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 */ /* Define to indicate the ${GNUTLS_DESCRIP} library */
#undef HAVE_GNUTLS #undef HAVE_GNUTLS

View File

@@ -128,4 +128,15 @@ typedef unsigned int uint;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
#endif #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 #endif

View File

@@ -39,9 +39,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/stat.h> #include <sys/stat.h>
#define AST_INCLUDE_GLOB 1 #define AST_INCLUDE_GLOB 1
#ifdef AST_INCLUDE_GLOB #ifdef AST_INCLUDE_GLOB
#if defined(__Darwin__) || defined(__CYGWIN__)
#define GLOB_ABORTED GLOB_ABEND
#endif
# include <glob.h> # include <glob.h>
#endif #endif
@@ -852,11 +849,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
int glob_ret; int glob_ret;
glob_t globbuf; glob_t globbuf;
globbuf.gl_offs = 0; /* initialize it to silence gcc */ globbuf.gl_offs = 0; /* initialize it to silence gcc */
#ifdef SOLARIS glob_ret = glob(fn, MY_GLOB_FLAGS, NULL, &globbuf);
glob_ret = glob(fn, GLOB_NOCHECK, NULL, &globbuf);
#else
glob_ret = glob(fn, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);
#endif
if (glob_ret == GLOB_NOSPACE) if (glob_ret == GLOB_NOSPACE)
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: Not enough memory\n", fn); "Glob Expansion of pattern '%s' failed: Not enough memory\n", fn);