|
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 | + |
| 99 | +# =========================================================================== |
| 100 | +# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html |
| 101 | +# =========================================================================== |
| 102 | +# |
| 103 | +# SYNOPSIS |
| 104 | +# |
| 105 | +# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]]) |
| 106 | +# |
| 107 | +# DESCRIPTION |
| 108 | +# |
| 109 | +# Look for OpenSSL in a number of default spots, or in a user-selected |
| 110 | +# spot (via --with-openssl). Sets |
| 111 | +# |
| 112 | +# OPENSSL_INCLUDES to the include directives required |
| 113 | +# OPENSSL_LIBS to the -l directives required |
| 114 | +# OPENSSL_LDFLAGS to the -L or -R flags required |
| 115 | +# |
| 116 | +# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately |
| 117 | +# |
| 118 | +# This macro sets OPENSSL_INCLUDES such that source files should use the |
| 119 | +# openssl/ directory in include directives: |
| 120 | +# |
| 121 | +# #include <openssl/hmac.h> |
| 122 | +# |
| 123 | +# LICENSE |
| 124 | +# |
| 125 | +# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/> |
| 126 | +# Copyright (c) 2009,2010 Dustin J. Mitchell <[email protected]> |
| 127 | +# |
| 128 | +# Copying and distribution of this file, with or without modification, are |
| 129 | +# permitted in any medium without royalty provided the copyright notice |
| 130 | +# and this notice are preserved. This file is offered as-is, without any |
| 131 | +# warranty. |
| 132 | + |
| 133 | +#serial 10 |
| 134 | + |
| 135 | +AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL]) |
| 136 | +AC_DEFUN([AX_CHECK_OPENSSL], [ |
| 137 | + found=false |
| 138 | + AC_ARG_WITH([openssl], |
| 139 | + [AS_HELP_STRING([--with-openssl=DIR], |
| 140 | + [root of the OpenSSL directory])], |
| 141 | + [ |
| 142 | + case "$withval" in |
| 143 | + "" | y | ye | yes | n | no) |
| 144 | + AC_MSG_ERROR([Invalid --with-openssl value]) |
| 145 | + ;; |
| 146 | + *) ssldirs="$withval" |
| 147 | + ;; |
| 148 | + esac |
| 149 | + ], [ |
| 150 | + # if pkg-config is installed and openssl has installed a .pc file, |
| 151 | + # then use that information and don't search ssldirs |
| 152 | + AC_CHECK_TOOL([PKG_CONFIG], [pkg-config]) |
| 153 | + if test x"$PKG_CONFIG" != x""; then |
| 154 | + OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null` |
| 155 | + if test $? = 0; then |
| 156 | + OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null` |
| 157 | + OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null` |
| 158 | + found=true |
| 159 | + fi |
| 160 | + fi |
| 161 | +
|
| 162 | + # no such luck; use some default ssldirs |
| 163 | + if ! $found; then |
| 164 | + ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr" |
| 165 | + fi |
| 166 | + ] |
| 167 | + ) |
| 168 | +
|
| 169 | +
|
| 170 | + # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in |
| 171 | + # an 'openssl' subdirectory |
| 172 | +
|
| 173 | + if ! $found; then |
| 174 | + OPENSSL_INCLUDES= |
| 175 | + for ssldir in $ssldirs; do |
| 176 | + AC_MSG_CHECKING([for openssl/ssl.h in $ssldir]) |
| 177 | + if test -f "$ssldir/include/openssl/ssl.h"; then |
| 178 | + OPENSSL_INCLUDES="-I$ssldir/include" |
| 179 | + OPENSSL_LDFLAGS="-L$ssldir/lib" |
| 180 | + OPENSSL_LIBS="-lssl -lcrypto" |
| 181 | + found=true |
| 182 | + AC_MSG_RESULT([yes]) |
| 183 | + break |
| 184 | + else |
| 185 | + AC_MSG_RESULT([no]) |
| 186 | + fi |
| 187 | + done |
| 188 | +
|
| 189 | + # if the file wasn't found, well, go ahead and try the link anyway -- maybe |
| 190 | + # it will just work! |
| 191 | + fi |
| 192 | +
|
| 193 | + # try the preprocessor and linker with our new flags, |
| 194 | + # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS |
| 195 | +
|
| 196 | + AC_MSG_CHECKING([whether compiling and linking against OpenSSL works]) |
| 197 | + echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \ |
| 198 | + "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD |
| 199 | +
|
| 200 | + save_LIBS="$LIBS" |
| 201 | + save_LDFLAGS="$LDFLAGS" |
| 202 | + save_CPPFLAGS="$CPPFLAGS" |
| 203 | + LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" |
| 204 | + LIBS="$OPENSSL_LIBS $LIBS" |
| 205 | + CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" |
| 206 | + AC_LINK_IFELSE( |
| 207 | + [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])], |
| 208 | + [ |
| 209 | + AC_MSG_RESULT([yes]) |
| 210 | + $1 |
| 211 | + ], [ |
| 212 | + AC_MSG_RESULT([no]) |
| 213 | + $2 |
| 214 | + ]) |
| 215 | + CPPFLAGS="$save_CPPFLAGS" |
| 216 | + LDFLAGS="$save_LDFLAGS" |
| 217 | + LIBS="$save_LIBS" |
| 218 | +
|
| 219 | + AC_SUBST([OPENSSL_INCLUDES]) |
| 220 | + AC_SUBST([OPENSSL_LIBS]) |
| 221 | + AC_SUBST([OPENSSL_LDFLAGS]) |
| 222 | +]) |
| 223 | + |
15 | 224 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
16 | 225 | # serial 11 (pkg-config-0.29.1)
|
17 | 226 |
|
@@ -356,5 +565,3 @@ AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
|
356 | 565 | [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
|
357 | 566 | ])dnl PKG_HAVE_DEFINE_WITH_MODULES
|
358 | 567 |
|
359 |
| -m4_include([m4/ax_c_float_words_bigendian.m4]) |
360 |
| -m4_include([m4/ax_check_openssl.m4]) |
|
0 commit comments