Use WX_CHECK_FUNCS for strtok_r.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell 2006-08-28 07:53:48 +00:00
parent 040b34976e
commit 56632e818f
2 changed files with 42 additions and 40 deletions

75
configure vendored
View File

@ -37021,34 +37021,43 @@ fi
done done
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT" for wx_func in strtok_r
echo "$as_me:$LINENO: checking whether strtok_r is declared" >&5 do
echo $ECHO_N "checking whether strtok_r is declared... $ECHO_C" >&6 echo "$as_me:$LINENO: checking for $wx_func" >&5
if test "${ac_cv_have_decl_strtok_r+set}" = set; then 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 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF _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. */
$ac_includes_default
#define _REENTRANT
$ac_includes_default
int int
main () main ()
{ {
#ifndef strtok_r
char *p = (char *) strtok_r; #ifndef $wx_func
#endif &$wx_func;
#endif
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
rm -f conftest.$ac_objext rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_compile) 2>conftest.er1 (eval $ac_link) 2>conftest.er1
ac_status=$? ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1 rm -f conftest.er1
@ -37061,43 +37070,39 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$? ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } && (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 echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then (exit $ac_status); }; }; then
ac_cv_have_decl_strtok_r=yes eval wx_cv_func_$wx_func=yes
else else
echo "$as_me: failed program was:" >&5 echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5 sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_decl_strtok_r=no eval wx_cv_func_$wx_func=no
fi fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi fi
echo "$as_me:$LINENO: result: $ac_cv_have_decl_strtok_r" >&5 echo "$as_me:$LINENO: result: `eval echo '${'wx_cv_func_$wx_func'}'`" >&5
echo "${ECHO_T}$ac_cv_have_decl_strtok_r" >&6 echo "${ECHO_T}`eval echo '${'wx_cv_func_$wx_func'}'`" >&6
if test $ac_cv_have_decl_strtok_r = yes; then
cat >>confdefs.h <<_ACEOF if eval test \$wx_cv_func_$wx_func = yes
#define HAVE_DECL_STRTOK_R 1 then
_ACEOF cat >>confdefs.h <<_ACEOF
#define HAVE_`echo $wx_func | tr 'a-z' 'A-Z'` 1
cat >>confdefs.h <<\_ACEOF
#define HAVE_STRTOK_R 1
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRTOK_R 0
_ACEOF _ACEOF
fi else
:
fi
done
CPPFLAGS="$SAVE_CPPFLAGS"
INET_LINK= INET_LINK=
@ -40581,7 +40586,7 @@ _ACEOF
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread" SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
else 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 "$as_me:$LINENO: checking if -D_REENTRANT is needed" >&5
echo $ECHO_N "checking if -D_REENTRANT is needed... $ECHO_C" >&6 echo $ECHO_N "checking if -D_REENTRANT is needed... $ECHO_C" >&6
if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then

View File

@ -4678,10 +4678,7 @@ fi
dnl check for uname (POSIX) and gethostname (BSD) dnl check for uname (POSIX) and gethostname (BSD)
AC_CHECK_FUNCS(uname gethostname, break) AC_CHECK_FUNCS(uname gethostname, break)
SAVE_CPPFLAGS="$CPPFLAGS" WX_CHECK_FUNCS(strtok_r, [], [], [#define _REENTRANT])
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
AC_CHECK_DECLS(strtok_r, AC_DEFINE(HAVE_STRTOK_R))
CPPFLAGS="$SAVE_CPPFLAGS"
dnl check for inet_addr and inet_aton (these may live either in libc, or in dnl check for inet_addr and inet_aton (these may live either in libc, or in
dnl libnsl or libresolv or libsocket) dnl libnsl or libresolv or libsocket)
@ -5156,7 +5153,7 @@ if test "$wxUSE_THREADS" = "yes"; then
else else
dnl on some systems, _REENTRANT should be defined if we want to use any _r() 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 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) AC_MSG_CHECKING(if -D_REENTRANT is needed)
if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then
WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_REENTRANT" WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -D_REENTRANT"