]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- OSX portability, detect if sbrk is deprecated.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 11 Dec 2015 12:44:44 +0000 (12:44 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 11 Dec 2015 12:44:44 +0000 (12:44 +0000)
git-svn-id: file:///svn/unbound/trunk@3582 be551aaa-1e26-0410-a405-d3ace91eadb9

config.h.in
configure
configure.ac
doc/Changelog

index e90f036cfaa882b1d31253417d464f853626f544..3364395c41f380cd8fbae758f3b2c8b65837f667 100644 (file)
 /* Define to 1 if you have the `recvmsg' function. */
 #undef HAVE_RECVMSG
 
-/* Define to 1 if you have the `sbrk' function. */
+/* define if you have the sbrk() call */
 #undef HAVE_SBRK
 
 /* Define to 1 if you have the `sendmsg' function. */
index 8136b8242bbd83a29d998390affa2b10d621528c..6f627b512464a2af7cd8b194e98f590b003541d1 100755 (executable)
--- a/configure
+++ b/configure
@@ -18123,7 +18123,7 @@ if test "$ac_res" != no; then :
 
 fi
 
-for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync
+for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 done
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sbrk" >&5
+$as_echo_n "checking for sbrk... " >&6; }
+# catch the warning of deprecated sbrk
+old_cflags="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+
+int main(void) { void* cur = sbrk(0); printf("%u\n", (unsigned)(size_t)((char*)cur - (char*)sbrk(0))); return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_SBRK 1" >>confdefs.h
+
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$old_cflags"
+
 # check if setreuid en setregid fail, on MacOSX10.4(darwin8).
 if echo $build_os | grep darwin8 > /dev/null; then
 
index 76950d0f439ab96305ffa41b90d8165aa6be3f0d..49075254bde1398ad6220b616604eab121d4fe1e 100644 (file)
@@ -1013,10 +1013,23 @@ AC_INCLUDES_DEFAULT
 #endif
 ])
 AC_SEARCH_LIBS([setusercontext], [util])
-AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync])
+AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync])
 AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
 AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
 
+AC_MSG_CHECKING([for sbrk])
+# catch the warning of deprecated sbrk
+old_cflags="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
+[[
+int main(void) { void* cur = sbrk(0); printf("%u\n", (unsigned)(size_t)((char*)cur - (char*)sbrk(0))); return 0; }
+]])], [
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_SBRK, 1, [define if you have the sbrk() call])
+    ], [AC_MSG_RESULT(no)])
+CFLAGS="$old_cflags"
+
 # check if setreuid en setregid fail, on MacOSX10.4(darwin8).
 if echo $build_os | grep darwin8 > /dev/null; then
        AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
index 3171d9fa31cfdf08ebbc22068b6aa93cbc4862b1..681b203e210b8b5e6a1a182d2022201e6a84c087 100644 (file)
@@ -2,6 +2,7 @@
        - remove NULL-checks before free, patch from Michael McConville.
        - updated ax_pthread.m4 to version 21 with clang support, this
          removes a warning from compilation.
+       - OSX portability, detect if sbrk is deprecated.
 
 10 December 2015: Wouter
        - 1.5.7 release