diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-11-26 11:17:49 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-11-26 11:17:49 (GMT) |
commit | e068f06110b9f53cbf7b2f4b2583185e64a836d0 (patch) | |
tree | 84aae2f6292287aec438b9be4c186edfc43963ce /unix | |
parent | 53dbd43f21b5baf917383c6373da80babbbdc0f8 (diff) | |
download | tcl-e068f06110b9f53cbf7b2f4b2583185e64a836d0.zip tcl-e068f06110b9f53cbf7b2f4b2583185e64a836d0.tar.gz tcl-e068f06110b9f53cbf7b2f4b2583185e64a836d0.tar.bz2 |
Spread the goodness of AC_CACHE_VAL a bit further. [Patch 1073524]
Diffstat (limited to 'unix')
-rw-r--r-- | unix/configure.in | 71 | ||||
-rw-r--r-- | unix/tcl.m4 | 36 |
2 files changed, 51 insertions, 56 deletions
diff --git a/unix/configure.in b/unix/configure.in index 66340d8..9ca3315 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.122 2004/11/19 14:48:33 das Exp $ +# RCS: @(#) $Id: configure.in,v 1.123 2004/11/26 11:18:01 dkf Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.57) @@ -135,9 +135,7 @@ AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD, 1, [Is getcwd Posix-compliant?])]) # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really # define USEGETWD even if the posix getcwd exists. Add a test ? -AC_REPLACE_FUNCS(opendir strstr) - -AC_REPLACE_FUNCS(strtol strtoll strtoull tmpnam waitpid) +AC_REPLACE_FUNCS(opendir strtol strtoll strtoull tmpnam waitpid) AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR, 1, [Do we have strerror()])]) AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD, 1, [Do we have getwd()])]) AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3, 1, [Do we have wait3()])]) @@ -216,21 +214,10 @@ AC_CHECK_FUNC(memmove, , [ # even if the original string is empty. #-------------------------------------------------------------------- -AC_MSG_CHECKING([proper strstr implementation]) -AC_TRY_RUN([ -extern int strstr(); -int main() -{ +SC_TCL_CHECK_BROKEN_FUNC(strstr, [ + extern int strstr(); exit(strstr("\0test", "test") ? 1 : 0); -} -], tcl_ok=yes, tcl_ok=no, tcl_ok=no) -if test $tcl_ok = yes; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT([broken, using substitute]) - AC_LIBOBJ([strstr]) - USE_COMPAT=1 -fi +]) #-------------------------------------------------------------------- # Check for strtoul function. This is tricky because under some @@ -238,50 +225,22 @@ fi # pointer for the string "0". #-------------------------------------------------------------------- -AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0) -AC_TRY_RUN([ -extern int strtoul(); -int main() -{ - char *string = "0"; - char *term; - int value; - value = strtoul(string, &term, 0); - if ((value != 0) || (term != (string+1))) { - exit(1); - } - exit(0); -}], , tcl_ok=0, tcl_ok=0) -if test "$tcl_ok" = 0; then - test -n "$verbose" && echo " Adding strtoul.o." - AC_LIBOBJ([strtoul]) - USE_COMPAT=1 -fi +SC_TCL_CHECK_BROKEN_FUNC(strtoul, [ + extern int strtoul(); + char *term, *string = "0"; + exit(strtoul(string,&term,0) != 0 || term != string+1); +]) #-------------------------------------------------------------------- # Check for the strtod function. This is tricky because in some # versions of Linux strtod mis-parses strings starting with "+". #-------------------------------------------------------------------- -AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0) -AC_TRY_RUN([ -extern double strtod(); -int main() -{ - char *string = " +69"; - char *term; - double value; - value = strtod(string, &term); - if ((value != 69) || (term != (string+4))) { - exit(1); - } - exit(0); -}], , tcl_ok=0, tcl_ok=0) -if test "$tcl_ok" = 0; then - test -n "$verbose" && echo " Adding strtod.o." - AC_LIBOBJ([strtod]) - USE_COMPAT=1 -fi +SC_TCL_CHECK_BROKEN_FUNC(strtod, [ + extern double strtod(); + char *term, *string = " +69"; + exit(strtod(string,&term) != 69 || term != string+4); +]) #-------------------------------------------------------------------- # Under Solaris 2.4, strtod returns the wrong value for the diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 707ed63..7eadca3 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2642,6 +2642,42 @@ AC_DEFUN(SC_TCL_CFG_ENCODING, [ [What encoding should be used for embedded configuration info?]) fi]) +#-------------------------------------------------------------------- +# SC_TCL_CHECK_BROKEN_FUNC +# +# Declare the encoding to use for embedded configuration information. +# +# Arguments: +# funcName - function to test for +# advancedTest - the advanced test to run if the function is present +# +# Results: +# Might cause compatability versions of the function to be used. +# Might affect the following vars: +# USE_COMPAT (implicit) +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TCL_CHECK_BROKEN_FUNC,[ + AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0) + if test ["$tcl_ok"] = 1; then + AC_MSG_CHECKING([proper ]$1[ implementation]) + AC_CACHE_VAL([tcl_cv_]$1[_unbroken], + AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok, + [tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown)) + AC_MSG_RESULT([$tcl_cv_]$1[_unbroken]) + if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then + tcl_ok=1 + else + tcl_ok=0 + fi + fi + if test ["$tcl_ok"] = 1; then + AC_LIBOBJ($1) + USE_COMPAT=1 + fi]) + + # Local Variables: # mode: autoconf # End: |