|
12 | 12 | # PARTICULAR PURPOSE.
|
13 | 13 |
|
14 | 14 | m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
| 15 | +# =============================================================================== |
| 16 | +# https://www.gnu.org/software/autoconf-archive/ax_c_float_words_bigendian.html |
| 17 | +# =============================================================================== |
| 18 | +# |
| 19 | +# SYNOPSIS |
| 20 | +# |
| 21 | +# AX_C_FLOAT_WORDS_BIGENDIAN([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN]) |
| 22 | +# |
| 23 | +# DESCRIPTION |
| 24 | +# |
| 25 | +# Checks the ordering of words within a multi-word float. This check is |
| 26 | +# necessary because on some systems (e.g. certain ARM systems), the float |
| 27 | +# word ordering can be different from the byte ordering. In a multi-word |
| 28 | +# float context, "big-endian" implies that the word containing the sign |
| 29 | +# bit is found in the memory location with the lowest address. This |
| 30 | +# implementation was inspired by the AC_C_BIGENDIAN macro in autoconf. |
| 31 | +# |
| 32 | +# The endianness is detected by first compiling C code that contains a |
| 33 | +# special double float value, then grepping the resulting object file for |
| 34 | +# certain strings of ASCII values. The double is specially crafted to have |
| 35 | +# a binary representation that corresponds with a simple string. In this |
| 36 | +# implementation, the string "noonsees" was selected because the |
| 37 | +# individual word values ("noon" and "sees") are palindromes, thus making |
| 38 | +# this test byte-order agnostic. If grep finds the string "noonsees" in |
| 39 | +# the object file, the target platform stores float words in big-endian |
| 40 | +# order. If grep finds "seesnoon", float words are in little-endian order. |
| 41 | +# If neither value is found, the user is instructed to specify the |
| 42 | +# ordering. |
| 43 | +# |
| 44 | +# LICENSE |
| 45 | +# |
| 46 | +# Copyright (c) 2008 Daniel Amelang <[email protected]> |
| 47 | +# |
| 48 | +# Copying and distribution of this file, with or without modification, are |
| 49 | +# permitted in any medium without royalty provided the copyright notice |
| 50 | +# and this notice are preserved. This file is offered as-is, without any |
| 51 | +# warranty. |
| 52 | + |
| 53 | +#serial 11 |
| 54 | + |
| 55 | +AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN], |
| 56 | + [AC_CACHE_CHECK(whether float word ordering is bigendian, |
| 57 | + ax_cv_c_float_words_bigendian, [ |
| 58 | +
|
| 59 | +ax_cv_c_float_words_bigendian=unknown |
| 60 | +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 61 | +
|
| 62 | +double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0; |
| 63 | +
|
| 64 | +]])], [ |
| 65 | +
|
| 66 | +if grep noonsees conftest.$ac_objext >/dev/null ; then |
| 67 | + ax_cv_c_float_words_bigendian=yes |
| 68 | +fi |
| 69 | +if grep seesnoon conftest.$ac_objext >/dev/null ; then |
| 70 | + if test "$ax_cv_c_float_words_bigendian" = unknown; then |
| 71 | + ax_cv_c_float_words_bigendian=no |
| 72 | + else |
| 73 | + ax_cv_c_float_words_bigendian=unknown |
| 74 | + fi |
| 75 | +fi |
| 76 | +
|
| 77 | +])]) |
| 78 | +
|
| 79 | +case $ax_cv_c_float_words_bigendian in |
| 80 | + yes) |
| 81 | + m4_default([$1], |
| 82 | + [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1, |
| 83 | + [Define to 1 if your system stores words within floats |
| 84 | + with the most significant word first])]) ;; |
| 85 | + no) |
| 86 | + $2 ;; |
| 87 | + *) |
| 88 | + m4_default([$3], |
| 89 | + [AC_MSG_ERROR([ |
| 90 | +
|
| 91 | +Unknown float word ordering. You need to manually preset |
| 92 | +ax_cv_c_float_words_bigendian=no (or yes) according to your system. |
| 93 | +
|
| 94 | + ])]) ;; |
| 95 | +esac |
| 96 | +
|
| 97 | +])# AX_C_FLOAT_WORDS_BIGENDIAN |
| 98 | + |
15 | 99 | # ===========================================================================
|
16 | 100 | # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
17 | 101 | # ===========================================================================
|
@@ -66,6 +150,131 @@ AS_VAR_IF(CACHEVAR,yes,
|
66 | 150 | AS_VAR_POPDEF([CACHEVAR])dnl
|
67 | 151 | ])dnl AX_CHECK_COMPILE_FLAGS
|
68 | 152 |
|
| 153 | +# =========================================================================== |
| 154 | +# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html |
| 155 | +# =========================================================================== |
| 156 | +# |
| 157 | +# SYNOPSIS |
| 158 | +# |
| 159 | +# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]]) |
| 160 | +# |
| 161 | +# DESCRIPTION |
| 162 | +# |
| 163 | +# Look for OpenSSL in a number of default spots, or in a user-selected |
| 164 | +# spot (via --with-openssl). Sets |
| 165 | +# |
| 166 | +# OPENSSL_INCLUDES to the include directives required |
| 167 | +# OPENSSL_LIBS to the -l directives required |
| 168 | +# OPENSSL_LDFLAGS to the -L or -R flags required |
| 169 | +# |
| 170 | +# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately |
| 171 | +# |
| 172 | +# This macro sets OPENSSL_INCLUDES such that source files should use the |
| 173 | +# openssl/ directory in include directives: |
| 174 | +# |
| 175 | +# #include <openssl/hmac.h> |
| 176 | +# |
| 177 | +# LICENSE |
| 178 | +# |
| 179 | +# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/> |
| 180 | +# Copyright (c) 2009,2010 Dustin J. Mitchell <[email protected]> |
| 181 | +# |
| 182 | +# Copying and distribution of this file, with or without modification, are |
| 183 | +# permitted in any medium without royalty provided the copyright notice |
| 184 | +# and this notice are preserved. This file is offered as-is, without any |
| 185 | +# warranty. |
| 186 | + |
| 187 | +#serial 10 |
| 188 | + |
| 189 | +AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL]) |
| 190 | +AC_DEFUN([AX_CHECK_OPENSSL], [ |
| 191 | + found=false |
| 192 | + AC_ARG_WITH([openssl], |
| 193 | + [AS_HELP_STRING([--with-openssl=DIR], |
| 194 | + [root of the OpenSSL directory])], |
| 195 | + [ |
| 196 | + case "$withval" in |
| 197 | + "" | y | ye | yes | n | no) |
| 198 | + AC_MSG_ERROR([Invalid --with-openssl value]) |
| 199 | + ;; |
| 200 | + *) ssldirs="$withval" |
| 201 | + ;; |
| 202 | + esac |
| 203 | + ], [ |
| 204 | + # if pkg-config is installed and openssl has installed a .pc file, |
| 205 | + # then use that information and don't search ssldirs |
| 206 | + AC_CHECK_TOOL([PKG_CONFIG], [pkg-config]) |
| 207 | + if test x"$PKG_CONFIG" != x""; then |
| 208 | + OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null` |
| 209 | + if test $? = 0; then |
| 210 | + OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null` |
| 211 | + OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null` |
| 212 | + found=true |
| 213 | + fi |
| 214 | + fi |
| 215 | +
|
| 216 | + # no such luck; use some default ssldirs |
| 217 | + if ! $found; then |
| 218 | + ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr" |
| 219 | + fi |
| 220 | + ] |
| 221 | + ) |
| 222 | +
|
| 223 | +
|
| 224 | + # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in |
| 225 | + # an 'openssl' subdirectory |
| 226 | +
|
| 227 | + if ! $found; then |
| 228 | + OPENSSL_INCLUDES= |
| 229 | + for ssldir in $ssldirs; do |
| 230 | + AC_MSG_CHECKING([for openssl/ssl.h in $ssldir]) |
| 231 | + if test -f "$ssldir/include/openssl/ssl.h"; then |
| 232 | + OPENSSL_INCLUDES="-I$ssldir/include" |
| 233 | + OPENSSL_LDFLAGS="-L$ssldir/lib" |
| 234 | + OPENSSL_LIBS="-lssl -lcrypto" |
| 235 | + found=true |
| 236 | + AC_MSG_RESULT([yes]) |
| 237 | + break |
| 238 | + else |
| 239 | + AC_MSG_RESULT([no]) |
| 240 | + fi |
| 241 | + done |
| 242 | +
|
| 243 | + # if the file wasn't found, well, go ahead and try the link anyway -- maybe |
| 244 | + # it will just work! |
| 245 | + fi |
| 246 | +
|
| 247 | + # try the preprocessor and linker with our new flags, |
| 248 | + # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS |
| 249 | +
|
| 250 | + AC_MSG_CHECKING([whether compiling and linking against OpenSSL works]) |
| 251 | + echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \ |
| 252 | + "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD |
| 253 | +
|
| 254 | + save_LIBS="$LIBS" |
| 255 | + save_LDFLAGS="$LDFLAGS" |
| 256 | + save_CPPFLAGS="$CPPFLAGS" |
| 257 | + LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" |
| 258 | + LIBS="$OPENSSL_LIBS $LIBS" |
| 259 | + CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" |
| 260 | + AC_LINK_IFELSE( |
| 261 | + [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])], |
| 262 | + [ |
| 263 | + AC_MSG_RESULT([yes]) |
| 264 | + $1 |
| 265 | + ], [ |
| 266 | + AC_MSG_RESULT([no]) |
| 267 | + $2 |
| 268 | + ]) |
| 269 | + CPPFLAGS="$save_CPPFLAGS" |
| 270 | + LDFLAGS="$save_LDFLAGS" |
| 271 | + LIBS="$save_LIBS" |
| 272 | +
|
| 273 | + AC_SUBST([OPENSSL_INCLUDES]) |
| 274 | + AC_SUBST([OPENSSL_LIBS]) |
| 275 | + AC_SUBST([OPENSSL_LDFLAGS]) |
| 276 | +]) |
| 277 | + |
69 | 278 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
70 | 279 | # serial 11 (pkg-config-0.29.1)
|
71 | 280 |
|
@@ -410,5 +619,3 @@ AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
|
410 | 619 | [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
|
411 | 620 | ])dnl PKG_HAVE_DEFINE_WITH_MODULES
|
412 | 621 |
|
413 |
| -m4_include([m4/ax_c_float_words_bigendian.m4]) |
414 |
| -m4_include([m4/ax_check_openssl.m4]) |
|
0 commit comments