aboutsummaryrefslogtreecommitdiff
path: root/m4/ac_func_scanf_can_malloc.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/ac_func_scanf_can_malloc.m4')
-rw-r--r--m4/ac_func_scanf_can_malloc.m453
1 files changed, 0 insertions, 53 deletions
diff --git a/m4/ac_func_scanf_can_malloc.m4 b/m4/ac_func_scanf_can_malloc.m4
deleted file mode 100644
index 84b0a01..0000000
--- a/m4/ac_func_scanf_can_malloc.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl AC_FUNC_SCANF_CAN_MALLOC macro
-dnl
-dnl (c) Finn Thain 2006
-dnl Copying and distribution of this file, with or without modification,
-dnl are permitted in any medium without royalty provided the copyright
-dnl notice and this notice are preserved.
-
-# AC_FUNC_SCANF_CAN_MALLOC()
-# --------------------------------------
-AC_DEFUN([AC_FUNC_SCANF_CAN_MALLOC],
- [ AC_CHECK_HEADERS([stdlib.h])
- AC_CACHE_CHECK([whether scanf can malloc], [ac_scanf_can_malloc],
- [ AC_RUN_IFELSE(
- [ AC_LANG_PROGRAM(
- [
-#include <stdio.h>
-#if STDC_HEADERS || HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
- ], [
- union { float f; char *p; } u;
- char *p;
- u.f = 0;
- char *scan_this = "56789";
- int matched = sscanf(scan_this, "%as", &u);
- if(matched < 1) return 1; /* shouldn't happens */
- if(u.f == (float)56789) return 2;
-
- p = u.p;
- while(*scan_this && *p == *scan_this) {
- ++p;
- ++scan_this;
- };
- free(u.p);
- if(*scan_this == 0) return 0;
- return 3;
- ])
- ],
- [ac_scanf_can_malloc=yes],
- [ac_scanf_can_malloc=no],
- [
-case $host_alias in
- *-*-linux* ) ac_scanf_can_malloc=yes ;;
- *-*-solaris* ) ac_scanf_can_malloc=no ;;
- *-*-darwin* ) ac_scanf_can_malloc=no ;;
- * ) ac_scanf_can_malloc=no ;;
-esac
- ])
- ])
-if test x$ac_scanf_can_malloc = "xyes"; then
- AC_DEFINE([SCANF_CAN_MALLOC], 1, [Define to 1 if the scanf %a conversion format mallocs a buffer. Undefine if %a format denotes a float.])
-fi
- ])