]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add check in configure script to check for GLOB_NOMAGIC and GLOB_BRACE in glob.h
authorDoug Bailey <dbailey@digium.com>
Tue, 21 Apr 2009 14:00:55 +0000 (14:00 +0000)
committerDoug Bailey <dbailey@digium.com>
Tue, 21 Apr 2009 14:00:55 +0000 (14:00 +0000)
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

configure
configure.ac
include/asterisk/autoconfig.h.in
include/asterisk/compat.h
main/config.c

index 8eeff7e564952b24cf34fa3289045bc0b4f193f0..6c4c9b66f314e2616ae7cd6356f076bc0a94efb5 100755 (executable)
--- 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 <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;
 }
@@ -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 <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
 
index aaa48608d6c2ae8db99aba1bc9055b89a1968474..ad7743422cb859269e5bd9763d817bb974dbddb4 100644 (file)
@@ -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>],
index e3de4487f85bd392bc442ad38e82e1ddf6db7e61..a77ac3fa000cbbe2100b1e8ea432ccba1b41b6ec 100644 (file)
 /* 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
 
index 22261a39070fb5298e49b209a3e28a37844f0dbb..fa312d29b7a5949d9d030086ce4a67285ac236f7 100644 (file)
@@ -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
index 6163f827a493986ffc6ce220aa590369578e7326..4fc929c6f9928b8e242f094a017638917d64b44b 100644 (file)
@@ -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);