From: Wouter Wijngaards Date: Wed, 19 Oct 2011 12:20:45 +0000 (+0000) Subject: run strptime check while runnable. X-Git-Tag: release-1.4.14rc1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01027a8322bbaa4e493af0a773e2fe093ef09f37;p=thirdparty%2Funbound.git run strptime check while runnable. git-svn-id: file:///svn/unbound/trunk@2515 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/configure b/configure index 485b16621..fb15b02a1 100755 --- a/configure +++ b/configure @@ -13144,6 +13144,8 @@ if test "$ac_res" != no; then : fi +# check wether strptime also works + # check some functions of the OS before linking libs (while still runnable). for ac_header in unistd.h do : @@ -13987,6 +13989,74 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +for ac_func in strptime +do : + ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime" +if test "x$ac_cv_func_strptime" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRPTIME 1 +_ACEOF + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strptime works" >&5 +$as_echo_n "checking whether strptime works... " >&6; } +if test c${cross_compiling} = cno; then +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE +#include +int main(void) { struct tm tm; char *res; +res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm); +if (!res) return 2; +res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); +if (!res) return 1; return 0; } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + eval "ac_cv_c_strptime_works=yes" +else + eval "ac_cv_c_strptime_works=no" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +else +eval "ac_cv_c_strptime_works=maybe" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_strptime_works" >&5 +$as_echo "$ac_cv_c_strptime_works" >&6; } +if test $ac_cv_c_strptime_works = no; then +case " $LIBOBJS " in + *" strptime.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strptime.$ac_objext" + ;; +esac + +else + +cat >>confdefs.h <<_ACEOF +#define STRPTIME_WORKS 1 +_ACEOF + +fi + +else + case " $LIBOBJS " in + *" strptime.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strptime.$ac_objext" + ;; +esac + +fi +done + # check windows threads (we use them, not pthreads, on windows). if test "$on_mingw" = "yes"; then @@ -16353,75 +16423,6 @@ fi fi -# check wether strptime also works -for ac_func in strptime -do : - ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime" -if test "x$ac_cv_func_strptime" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRPTIME 1 -_ACEOF - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strptime works" >&5 -$as_echo_n "checking whether strptime works... " >&6; } -if test c${cross_compiling} = cno; then -if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _XOPEN_SOURCE -#include -int main(void) { struct tm tm; char *res; -res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm); -if (!res) return 2; -res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); -if (!res) return 1; return 0; } - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - eval "ac_cv_c_strptime_works=yes" -else - eval "ac_cv_c_strptime_works=no" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -else -eval "ac_cv_c_strptime_works=maybe" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_strptime_works" >&5 -$as_echo "$ac_cv_c_strptime_works" >&6; } -if test $ac_cv_c_strptime_works = no; then -case " $LIBOBJS " in - *" strptime.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strptime.$ac_objext" - ;; -esac - -else - -cat >>confdefs.h <<_ACEOF -#define STRPTIME_WORKS 1 -_ACEOF - -fi - -else - case " $LIBOBJS " in - *" strptime.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strptime.$ac_objext" - ;; -esac - -fi -done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setusercontext" >&5 $as_echo_n "checking for library containing setusercontext... " >&6; } if test "${ac_cv_search_setusercontext+set}" = set; then : diff --git a/configure.ac b/configure.ac index f10b25a37..0ac8094ea 100644 --- a/configure.ac +++ b/configure.ac @@ -286,6 +286,31 @@ AC_SUBST(RUNTIME_PATH) AC_SEARCH_LIBS([inet_pton], [nsl]) AC_SEARCH_LIBS([socket], [socket]) +# check wether strptime also works +AC_DEFUN([AC_CHECK_STRPTIME_WORKS], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(whether strptime works) +if test c${cross_compiling} = cno; then +AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#define _XOPEN_SOURCE +#include +int main(void) { struct tm tm; char *res; +res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm); +if (!res) return 2; +res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); +if (!res) return 1; return 0; } +]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"]) +else +eval "ac_cv_c_strptime_works=maybe" +fi +AC_MSG_RESULT($ac_cv_c_strptime_works) +if test $ac_cv_c_strptime_works = no; then +AC_LIBOBJ(strptime) +else +AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) +fi +])dnl + # check some functions of the OS before linking libs (while still runnable). AC_FUNC_CHOWN AC_FUNC_FORK @@ -294,6 +319,7 @@ AC_FUNC_FSEEKO ACX_SYS_LARGEFILE ACX_CHECK_NONBLOCKING_BROKEN ACX_MKDIR_ONE_ARG +AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) # check windows threads (we use them, not pthreads, on windows). if test "$on_mingw" = "yes"; then @@ -659,31 +685,6 @@ if test $ac_cv_func_daemon = yes; then ]) fi -# check wether strptime also works -AC_DEFUN([AC_CHECK_STRPTIME_WORKS], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(whether strptime works) -if test c${cross_compiling} = cno; then -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#define _XOPEN_SOURCE -#include -int main(void) { struct tm tm; char *res; -res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm); -if (!res) return 2; -res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); -if (!res) return 1; return 0; } -]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"]) -else -eval "ac_cv_c_strptime_works=maybe" -fi -AC_MSG_RESULT($ac_cv_c_strptime_works) -if test $ac_cv_c_strptime_works = no; then -AC_LIBOBJ(strptime) -else -AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) -fi -])dnl -AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) AC_SEARCH_LIBS([setusercontext], [util]) AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex]) AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])