summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorJoe Nahmias <joe@nahmias.net>2012-12-07 21:44:43 -0500
committerJoe Nahmias <joe@nahmias.net>2012-12-07 21:44:43 -0500
commit879e6db06338166657609930768f76d8d7e7afbb (patch)
tree3018a2ec0a6aca4150250084bdaf4451ec4e1c3b /acinclude.m4
Imported Upstream version 1.2
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m473
1 files changed, 73 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..a42461f
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,73 @@
+dnl
+dnl Contains the following macros
+dnl BJNP_CHECK_IPV6
+dnl
+
+#
+# Check for AF_INET6, determines whether or not to enable IPv6 support
+# Check for ss_family member in struct sockaddr_storage
+# Taken from sane-backends
+AC_DEFUN([BJNP_CHECK_IPV6],
+[
+ AC_MSG_CHECKING([whether to enable IPv6])
+ AC_ARG_ENABLE(ipv6,
+ AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
+ [ if test "$enableval" = "no" ; then
+ AC_MSG_RESULT([no, manually disabled])
+ ipv6=no
+ fi
+ ])
+
+ if test "$ipv6" != "no" ; then
+ AC_TRY_COMPILE([
+ #define INET6
+ #include <sys/types.h>
+ #include <sys/socket.h> ], [
+ /* AF_INET6 available check */
+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+ exit(1);
+ else
+ exit(0);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([ENABLE_IPV6], 1, [Define to 1 if the system supports IPv6])
+ ipv6=yes
+ ],[
+ AC_MSG_RESULT([no (couldn't compile test program)])
+ ipv6=no
+ ])
+ fi
+
+ if test "$ipv6" != "no" ; then
+ AC_MSG_CHECKING([whether struct sockaddr_storage has an ss_family member])
+ AC_TRY_COMPILE([
+ #define INET6
+ #include <sys/types.h>
+ #include <sys/socket.h> ], [
+ /* test if the ss_family member exists in struct sockaddr_storage */
+ struct sockaddr_storage ss;
+ ss.ss_family = AF_INET;
+ exit (0);
+ ], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAS_SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has an ss_family member])
+ ], [
+ AC_TRY_COMPILE([
+ #define INET6
+ #include <sys/types.h>
+ #include <sys/socket.h> ], [
+ /* test if the __ss_family member exists in struct sockaddr_storage */
+ struct sockaddr_storage ss;
+ ss.__ss_family = AF_INET;
+ exit (0);
+ ], [
+ AC_MSG_RESULT([no, but __ss_family exists])
+ AC_DEFINE([HAS___SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has __ss_family instead of ss_family])
+ ], [
+ AC_MSG_RESULT([no])
+ ipv6=no
+ ])
+ ])
+ fi
+])
+