From: Michael Wetherell Date: Mon, 28 Aug 2006 07:53:48 +0000 (+0000) Subject: Use WX_CHECK_FUNCS for strtok_r. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/56632e818f782b492c9ee05925b2ac38a932eead?hp=040b34976ecef760b0c18db7fb408664f32319dd Use WX_CHECK_FUNCS for strtok_r. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure b/configure index c0b7783e5c..bfdbf41c00 100755 --- a/configure +++ b/configure @@ -37021,34 +37021,43 @@ fi done -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -D_REENTRANT" -echo "$as_me:$LINENO: checking whether strtok_r is declared" >&5 -echo $ECHO_N "checking whether strtok_r is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl_strtok_r+set}" = set; then + + for wx_func in strtok_r + do + echo "$as_me:$LINENO: checking for $wx_func" >&5 +echo $ECHO_N "checking for $wx_func... $ECHO_C" >&6 +if eval "test \"\${wx_cv_func_$wx_func+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default + + #define _REENTRANT + $ac_includes_default + int main () { -#ifndef strtok_r - char *p = (char *) strtok_r; -#endif + + #ifndef $wx_func + &$wx_func; + #endif + ; return 0; } + _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -37061,43 +37070,39 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_have_decl_strtok_r=yes + eval wx_cv_func_$wx_func=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_strtok_r=no +eval wx_cv_func_$wx_func=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_strtok_r" >&5 -echo "${ECHO_T}$ac_cv_have_decl_strtok_r" >&6 -if test $ac_cv_have_decl_strtok_r = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRTOK_R 1 -_ACEOF +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -cat >>confdefs.h <<\_ACEOF -#define HAVE_STRTOK_R 1 -_ACEOF +fi +echo "$as_me:$LINENO: result: `eval echo '${'wx_cv_func_$wx_func'}'`" >&5 +echo "${ECHO_T}`eval echo '${'wx_cv_func_$wx_func'}'`" >&6 -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRTOK_R 0 + if eval test \$wx_cv_func_$wx_func = yes + then + cat >>confdefs.h <<_ACEOF +#define HAVE_`echo $wx_func | tr 'a-z' 'A-Z'` 1 _ACEOF -fi + else + : + fi + done -CPPFLAGS="$SAVE_CPPFLAGS" INET_LINK= @@ -40581,7 +40586,7 @@ _ACEOF SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread" else - if test "$ac_cv_have_decl_strtok_r" = "yes"; then + if test "$wx_cv_func_strtok_r" = "yes"; then echo "$as_me:$LINENO: checking if -D_REENTRANT is needed" >&5 echo $ECHO_N "checking if -D_REENTRANT is needed... $ECHO_C" >&6 if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then diff --git a/configure.in b/configure.in index 9c47e877d2..26ceecb3ce 100644 --- a/configure.in +++ b/configure.in @@ -4678,10 +4678,7 @@ fi dnl check for uname (POSIX) and gethostname (BSD) AC_CHECK_FUNCS(uname gethostname, break) -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -D_REENTRANT" -AC_CHECK_DECLS(strtok_r, AC_DEFINE(HAVE_STRTOK_R)) -CPPFLAGS="$SAVE_CPPFLAGS" +WX_CHECK_FUNCS(strtok_r, [], [], [#define _REENTRANT]) dnl check for inet_addr and inet_aton (these may live either in libc, or in dnl libnsl or libresolv or libsocket) @@ -5156,7 +5153,7 @@ if test "$wxUSE_THREADS" = "yes"; then else dnl on some systems, _REENTRANT should be defined if we want to use any _r() dnl functions - add tests for other functions here as well - if test "$ac_cv_have_decl_strtok_r" = "yes"; then + if test "$wx_cv_func_strtok_r" = "yes"; then AC_MSG_CHECKING(if -D_REENTRANT is needed) if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_REENTRANT"