llvm.org GIT mirror llvm / e29b0ac
lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*. AC_CHECK_FUNCS seeks a symbol only in libs. We should check the declaration in string.h. FIXME: I have never seen mingw(s) have strerror_s() (not _strerror_s()). FIXME: Autoconf/CMake may seek strerror_s() with the definition MINGW_HAS_SECURE_API in future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125172 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 8 years ago
6 changed file(s) with 102 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
13901390 AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
13911391 AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
13921392 AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ])
1393 AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ])
1393 AC_CHECK_FUNCS([strerror strerror_r setenv ])
13941394 AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
13951395 AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
13961396 AC_C_PRINTF_A
13971397 AC_FUNC_RAND48
1398
1399 dnl Check the declaration "Secure API" on Windows environments.
1400 AC_CHECK_DECLS([strerror_s])
13981401
13991402 dnl Check symbols in libgcc.a for JIT on Mingw.
14001403 if test "$llvm_cv_os_type" = "MingW" ; then
148148 check_symbol_exists(strtoq stdlib.h HAVE_STRTOQ)
149149 check_symbol_exists(strerror string.h HAVE_STRERROR)
150150 check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
151 check_symbol_exists(strerror_s string.h HAVE_STRERROR_S)
151 check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S)
152152 check_symbol_exists(memcpy string.h HAVE_MEMCPY)
153153 check_symbol_exists(memmove string.h HAVE_MEMMOVE)
154154 check_symbol_exists(setenv stdlib.h HAVE_SETENV)
1867818678
1867918679
1868018680
18681
18682 for ac_func in strerror strerror_r strerror_s setenv
18681 for ac_func in strerror strerror_r setenv
1868318682 do
1868418683 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
1868518684 { echo "$as_me:$LINENO: checking for $ac_func" >&5
1919619195 _ACEOF
1919719196
1919819197 fi
19198
19199
19200 { echo "$as_me:$LINENO: checking whether strerror_s is declared" >&5
19201 echo $ECHO_N "checking whether strerror_s is declared... $ECHO_C" >&6; }
19202 if test "${ac_cv_have_decl_strerror_s+set}" = set; then
19203 echo $ECHO_N "(cached) $ECHO_C" >&6
19204 else
19205 cat >conftest.$ac_ext <<_ACEOF
19206 /* confdefs.h. */
19207 _ACEOF
19208 cat confdefs.h >>conftest.$ac_ext
19209 cat >>conftest.$ac_ext <<_ACEOF
19210 /* end confdefs.h. */
19211 $ac_includes_default
19212 int
19213 main ()
19214 {
19215 #ifndef strerror_s
19216 char *p = (char *) strerror_s;
19217 return !p;
19218 #endif
19219
19220 ;
19221 return 0;
19222 }
19223 _ACEOF
19224 rm -f conftest.$ac_objext
19225 if { (ac_try="$ac_compile"
19226 case "(($ac_try" in
19227 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19228 *) ac_try_echo=$ac_try;;
19229 esac
19230 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19231 (eval "$ac_compile") 2>conftest.er1
19232 ac_status=$?
19233 grep -v '^ *+' conftest.er1 >conftest.err
19234 rm -f conftest.er1
19235 cat conftest.err >&5
19236 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19237 (exit $ac_status); } &&
19238 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
19239 { (case "(($ac_try" in
19240 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19241 *) ac_try_echo=$ac_try;;
19242 esac
19243 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19244 (eval "$ac_try") 2>&5
19245 ac_status=$?
19246 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19247 (exit $ac_status); }; } &&
19248 { ac_try='test -s conftest.$ac_objext'
19249 { (case "(($ac_try" in
19250 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19251 *) ac_try_echo=$ac_try;;
19252 esac
19253 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19254 (eval "$ac_try") 2>&5
19255 ac_status=$?
19256 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19257 (exit $ac_status); }; }; then
19258 ac_cv_have_decl_strerror_s=yes
19259 else
19260 echo "$as_me: failed program was:" >&5
19261 sed 's/^/| /' conftest.$ac_ext >&5
19262
19263 ac_cv_have_decl_strerror_s=no
19264 fi
19265
19266 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
19267 fi
19268 { echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_s" >&5
19269 echo "${ECHO_T}$ac_cv_have_decl_strerror_s" >&6; }
19270 if test $ac_cv_have_decl_strerror_s = yes; then
19271
19272 cat >>confdefs.h <<_ACEOF
19273 #define HAVE_DECL_STRERROR_S 1
19274 _ACEOF
19275
19276
19277 else
19278 cat >>confdefs.h <<_ACEOF
19279 #define HAVE_DECL_STRERROR_S 0
19280 _ACEOF
19281
19282
19283 fi
19284
1919919285
1920019286
1920119287 if test "$llvm_cv_os_type" = "MingW" ; then
6161 /* Define to 1 if you have the header file. */
6262 #cmakedefine HAVE_CTYPE_H ${HAVE_CTYPE_H}
6363
64 /* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
65 don't. */
66 #cmakedefine01 HAVE_DECL_STRERROR_S
67
6468 /* Define to 1 if you have the header file, and it defines `DIR'.
6569 */
6670 #cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H}
366370
367371 /* Define to 1 if you have the `strerror_r' function. */
368372 #cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R}
369
370 /* Define to 1 if you have the `strerror_s' function. */
371 #cmakedefine HAVE_STRERROR_S ${HAVE_STRERROR_S}
372373
373374 /* Define to 1 if you have the header file. */
374375 #cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H}
7676
7777 /* Define to 1 if you have the header file. */
7878 #undef HAVE_CTYPE_H
79
80 /* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
81 don't. */
82 #undef HAVE_DECL_STRERROR_S
7983
8084 /* Define to 1 if you have the header file, and it defines `DIR'.
8185 */
383387 /* Define to 1 if you have the `strerror_r' function. */
384388 #undef HAVE_STRERROR_R
385389
386 /* Define to 1 if you have the `strerror_s' function. */
387 #undef HAVE_STRERROR_S
388
389390 /* Define to 1 if you have the header file. */
390391 #undef HAVE_STRINGS_H
391392
4949 # else
5050 strerror_r(errnum,buffer,MaxErrStrLen-1);
5151 # endif
52 #elif defined(HAVE_STRERROR_S) // Windows.
52 #elif HAVE_DECL_STRERROR_S // "Windows Secure API"
5353 if (errnum)
5454 strerror_s(buffer, errnum);
5555 #elif defined(HAVE_STRERROR)