summaryrefslogtreecommitdiff
path: root/m4/ax_include_strcasecmp.m4
diff options
context:
space:
mode:
authorLeo Davis <ldavis@speechfxinc.com>2012-09-07 11:12:05 +0200
committerPeter Simons <simons@cryp.to>2012-09-07 11:13:54 +0200
commit99407098092a2770b487f5b87d2899880f6797d4 (patch)
tree2c2ad85b2bc9339800246214bf63045adfe39d14 /m4/ax_include_strcasecmp.m4
parent9ed38de69235707cba595813e5eb87f41fcb1085 (diff)
downloadautoconf-archive-99407098092a2770b487f5b87d2899880f6797d4.tar.gz
AX_INCLUDE_STRCASECMP: initial version
The macro detects which header file defines the strcasecmp() function. See <http://savannah.gnu.org/patch/?7836> for further details.
Diffstat (limited to 'm4/ax_include_strcasecmp.m4')
-rw-r--r--m4/ax_include_strcasecmp.m455
1 files changed, 55 insertions, 0 deletions
diff --git a/m4/ax_include_strcasecmp.m4 b/m4/ax_include_strcasecmp.m4
new file mode 100644
index 0000000..d103649
--- /dev/null
+++ b/m4/ax_include_strcasecmp.m4
@@ -0,0 +1,55 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_include_strcasecmp.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_INCLUDE_STRCASECMP
+#
+# DESCRIPTION
+#
+# This macro tries to find a header for strcasecmp() in strings.h, then
+# string.h, and AC_DEFINEs AX_STRCASECMP_HEADER to the value it found. Use
+# it in your source like so:
+#
+# #ifdef AX_STRCASECMP_HEADER
+# #include AX_STRCASECMP_HEADER
+# #endif
+#
+# LICENSE
+#
+# Copyright (c) 2012 Leo Davis <ldavis@speechfxinc.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([AX_INCLUDE_STRCASECMP],
+[
+AC_CACHE_CHECK([for strcasecmp header file], [ax_cv_include_strcasecmp_found], [
+ ax_cv_include_strcasecmp_found=no
+ AC_TRY_LINK(
+ [ #include <strings.h> ],
+ [ strcasecmp("foo", "bar"); ],
+ [ax_cv_include_strcasecmp_found='<strings.h>'],
+ [ax_cv_include_strcasecmp_found=no])
+
+ if test x"$ax_cv_include_strcasecmp_found" = "xno"
+ then
+ AC_TRY_LINK(
+ [ #include <string.h> ],
+ [ strcasecmp("foo", "bar"); ],
+ [ax_cv_include_strcasecmp_found='<string.h>'],
+ [ax_cv_include_strcasecmp_found=no])
+ fi
+])
+ if test x"$ax_cv_include_strcasecmp_found" != "xno"
+ then
+ AC_DEFINE_UNQUOTED([AX_STRCASECMP_HEADER], [$ax_cv_include_strcasecmp_found],
+ [Defined to <strings.h> or <string.h> if strcasecmp is found])
+
+ fi
+]) dnl AX_INCLUDE_STRCASECMP