summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2017-09-27 07:44:41 +1000
committerDarren Tucker <dtucker@zip.com.au>2017-09-27 07:44:41 +1000
commit74c1c3660acf996d9dc329e819179418dc115f2c (patch)
treec8bbb5549b3f1a29ca7f81c9a21a099119d2049d /configure.ac
parent6a9481258a77b0b54b2a313d1761c87360c5f1f5 (diff)
Check for and handle calloc(p, 0) = NULL.
On some platforms (AIX, maybe others) allocating zero bytes of memory via the various *alloc functions returns NULL, which is permitted by the standards. Autoconf has some macros for detecting this (with the exception of calloc for some reason) so use these and if necessary activate shims for them. ok djm@
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac10
1 files changed, 10 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 545bee88e..e9c593acb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1331,7 +1331,17 @@ AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
1331AC_SEARCH_LIBS([inet_ntop], [resolv nsl]) 1331AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
1332AC_SEARCH_LIBS([gethostbyname], [resolv nsl]) 1332AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
1333 1333
1334# "Particular Function Checks"
1335# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html
1334AC_FUNC_STRFTIME 1336AC_FUNC_STRFTIME
1337AC_FUNC_MALLOC
1338AC_FUNC_REALLOC
1339# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL;
1340if test "x$ac_cv_func_malloc_0_nonnull" != "xyes"; then
1341 AC_DEFINE(HAVE_CALLOC, 0, [calloc(x, 0) returns NULL])
1342 AC_DEFINE(calloc, rpl_calloc,
1343 [Define to rpl_calloc if the replacement function should be used.])
1344fi
1335 1345
1336# Check for ALTDIRFUNC glob() extension 1346# Check for ALTDIRFUNC glob() extension
1337AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support]) 1347AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])