aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@es.net>2017-04-20 12:37:09 -0700
committerBruce A. Mah <bmah@es.net>2017-04-20 12:37:09 -0700
commita026b29b2f8fdc223da21325aab8d0d5c77a843a (patch)
tree2cea6f89b82f9840231884426f2c8ae359597363 /config
parent02d411cb02cc9d3584527c5b175c8f9a36e5c083 (diff)
downloadiperf3-a026b29b2f8fdc223da21325aab8d0d5c77a843a.tar.gz
Move an autoconfig file into config/, get rid of a no-longer-used file.
Follow-up for #517.
Diffstat (limited to 'config')
-rw-r--r--config/ax_check_openssl.m4124
-rw-r--r--config/ax_lib_socket_nsl.m440
2 files changed, 124 insertions, 40 deletions
diff --git a/config/ax_check_openssl.m4 b/config/ax_check_openssl.m4
new file mode 100644
index 0000000..28e48cb
--- /dev/null
+++ b/config/ax_check_openssl.m4
@@ -0,0 +1,124 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+# Look for OpenSSL in a number of default spots, or in a user-selected
+# spot (via --with-openssl). Sets
+#
+# OPENSSL_INCLUDES to the include directives required
+# OPENSSL_LIBS to the -l directives required
+# OPENSSL_LDFLAGS to the -L or -R flags required
+#
+# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+# This macro sets OPENSSL_INCLUDES such that source files should use the
+# openssl/ directory in include directives:
+#
+# #include <openssl/hmac.h>
+#
+# LICENSE
+#
+# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
+# Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.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 10
+
+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
+AC_DEFUN([AX_CHECK_OPENSSL], [
+ found=false
+ AC_ARG_WITH([openssl],
+ [AS_HELP_STRING([--with-openssl=DIR],
+ [root of the OpenSSL directory])],
+ [
+ case "$withval" in
+ "" | y | ye | yes | n | no)
+ AC_MSG_ERROR([Invalid --with-openssl value])
+ ;;
+ *) ssldirs="$withval"
+ ;;
+ esac
+ ], [
+ # if pkg-config is installed and openssl has installed a .pc file,
+ # then use that information and don't search ssldirs
+ AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
+ if test x"$PKG_CONFIG" != x""; then
+ OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
+ if test $? = 0; then
+ OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
+ OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+ found=true
+ fi
+ fi
+
+ # no such luck; use some default ssldirs
+ if ! $found; then
+ ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
+ fi
+ ]
+ )
+
+
+ # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
+ # an 'openssl' subdirectory
+
+ if ! $found; then
+ OPENSSL_INCLUDES=
+ for ssldir in $ssldirs; do
+ AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
+ if test -f "$ssldir/include/openssl/ssl.h"; then
+ OPENSSL_INCLUDES="-I$ssldir/include"
+ OPENSSL_LDFLAGS="-L$ssldir/lib"
+ OPENSSL_LIBS="-lssl -lcrypto"
+ found=true
+ AC_MSG_RESULT([yes])
+ break
+ else
+ AC_MSG_RESULT([no])
+ fi
+ done
+
+ # if the file wasn't found, well, go ahead and try the link anyway -- maybe
+ # it will just work!
+ fi
+
+ # try the preprocessor and linker with our new flags,
+ # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+ AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
+ echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
+ "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+
+ save_LIBS="$LIBS"
+ save_LDFLAGS="$LDFLAGS"
+ save_CPPFLAGS="$CPPFLAGS"
+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+ LIBS="$OPENSSL_LIBS $LIBS"
+ CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
+ [
+ AC_MSG_RESULT([yes])
+ $1
+ ], [
+ AC_MSG_RESULT([no])
+ $2
+ ])
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+
+ AC_SUBST([OPENSSL_INCLUDES])
+ AC_SUBST([OPENSSL_LIBS])
+ AC_SUBST([OPENSSL_LDFLAGS])
+])
diff --git a/config/ax_lib_socket_nsl.m4 b/config/ax_lib_socket_nsl.m4
deleted file mode 100644
index 058e975..0000000
--- a/config/ax_lib_socket_nsl.m4
+++ /dev/null
@@ -1,40 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_LIB_SOCKET_NSL
-#
-# DESCRIPTION
-#
-# This macro figures out what libraries are required on this platform to
-# link sockets programs.
-#
-# The common cases are not to need any extra libraries, or to need
-# -lsocket and -lnsl. We need to avoid linking with libnsl unless we need
-# it, though, since on some OSes where it isn't necessary it will totally
-# break networking. Unisys also includes gethostbyname() in libsocket but
-# needs libnsl for socket().
-#
-# LICENSE
-#
-# Copyright (c) 2008 Russ Allbery <rra@stanford.edu>
-# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
-# Copyright (c) 2008 Warren Young <warren@etr-usa.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 6
-
-AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
-AC_DEFUN([AX_LIB_SOCKET_NSL],
-[
- AC_SEARCH_LIBS([gethostbyname], [nsl])
- AC_SEARCH_LIBS([socket], [socket], [], [
- AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
- [], [-lnsl])])
-])