Permalink
Cannot retrieve contributors at this time
277 lines (246 sloc)
9.88 KB
# generated automatically by aclocal 1.16.3 -*- Autoconf -*- | |
# Copyright (C) 1996-2020 Free Software Foundation, Inc. | |
# This file is free software; the Free Software Foundation | |
# gives unlimited permission to copy and/or distribute it, | |
# with or without modifications, as long as this notice is preserved. | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
# PARTICULAR PURPOSE. | |
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) | |
# =============================================================================== | |
# https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html | |
# =============================================================================== | |
# | |
# SYNOPSIS | |
# | |
# AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN]) | |
# | |
# DESCRIPTION | |
# | |
# Checks the ordering of words within a multi-word float. This check is | |
# necessary because on some systems (e.g. certain ARM systems), the float | |
# word ordering can be different from the byte ordering. In a multi-word | |
# float context, "big-endian" implies that the word containing the sign | |
# bit is found in the memory location with the lowest address. This | |
# implementation was inspired by the AC_C_BIGENDIAN macro in autoconf. | |
# | |
# The endianness is detected by first compiling C code that contains a | |
# special double float value, then grepping the resulting object file for | |
# certain strings of ASCII values. The double is specially crafted to have | |
# a binary representation that corresponds with a simple string. In this | |
# implementation, the string "noonsees" was selected because the | |
# individual word values ("noon" and "sees") are palindromes, thus making | |
# this test byte-order agnostic. If grep finds the string "noonsees" in | |
# the object file, the target platform stores float words in big-endian | |
# order. If grep finds "seesnoon", float words are in little-endian order. | |
# If neither value is found, the user is instructed to specify the | |
# ordering. | |
# | |
# LICENSE | |
# | |
# Copyright (c) 2008 Daniel Amelang <dan@amelang.net> | |
# | |
# 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 11 | |
AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN], | |
[AC_CACHE_CHECK(whether float word ordering is bigendian, | |
ax_cv_c_float_words_bigendian, [ | |
ax_cv_c_float_words_bigendian=unknown | |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0; | |
]])], [ | |
if grep noonsees conftest.$ac_objext >/dev/null ; then | |
ax_cv_c_float_words_bigendian=yes | |
fi | |
if grep seesnoon conftest.$ac_objext >/dev/null ; then | |
if test "$ax_cv_c_float_words_bigendian" = unknown; then | |
ax_cv_c_float_words_bigendian=no | |
else | |
ax_cv_c_float_words_bigendian=unknown | |
fi | |
fi | |
])]) | |
case $ax_cv_c_float_words_bigendian in | |
yes) | |
m4_default([$1], | |
[AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1, | |
[Define to 1 if your system stores words within floats | |
with the most significant word first])]) ;; | |
no) | |
$2 ;; | |
*) | |
m4_default([$3], | |
[AC_MSG_ERROR([ | |
Unknown float word ordering. You need to manually preset | |
ax_cv_c_float_words_bigendian=no (or yes) according to your system. | |
])]) ;; | |
esac | |
])# AX_C_FLOAT_WORDS_BIGENDIAN | |
# =========================================================================== | |
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | |
# =========================================================================== | |
# | |
# SYNOPSIS | |
# | |
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | |
# | |
# DESCRIPTION | |
# | |
# Check whether the given FLAG works with the current language's compiler | |
# or gives an error. (Warnings, however, are ignored) | |
# | |
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | |
# success/failure. | |
# | |
# If EXTRA-FLAGS is defined, it is added to the current language's default | |
# flags (e.g. CFLAGS) when the check is done. The check is thus made with | |
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to | |
# force the compiler to issue an error when a bad flag is given. | |
# | |
# INPUT gives an alternative input source to AC_COMPILE_IFELSE. | |
# | |
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | |
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. | |
# | |
# LICENSE | |
# | |
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | |
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.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 | |
AC_DEFUN([AX_CHECK_COMPILE_FLAG], | |
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | |
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl | |
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ | |
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS | |
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" | |
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | |
[AS_VAR_SET(CACHEVAR,[yes])], | |
[AS_VAR_SET(CACHEVAR,[no])]) | |
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) | |
AS_VAR_IF(CACHEVAR,yes, | |
[m4_default([$2], :)], | |
[m4_default([$3], :)]) | |
AS_VAR_POPDEF([CACHEVAR])dnl | |
])dnl AX_CHECK_COMPILE_FLAGS | |
# =========================================================================== | |
# 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]) | |
]) | |