forked from wolfSSL/wolfssl
Merge branch 'master' of github.com:cyassl/cyassl
This commit is contained in:
9
README
9
README
@ -35,7 +35,14 @@ before calling SSL_new(); Though it's not recommended.
|
|||||||
*** end Notes ***
|
*** end Notes ***
|
||||||
|
|
||||||
|
|
||||||
CyaSSL Release 2.8.0 (8/30/2013)
|
CyaSSL Release 2.9.0 (X/XX/XXXX)
|
||||||
|
|
||||||
|
The Freescale Kinetis K53 RNGB documentation can be found in Chapter 33 of the
|
||||||
|
K53 Sub-Family Reference Manual:
|
||||||
|
http://cache.freescale.com/files/32bit/doc/ref_manual/K53P144M100SF2RM.pdf
|
||||||
|
|
||||||
|
|
||||||
|
*****************CyaSSL Release 2.8.0 (8/30/2013)
|
||||||
|
|
||||||
Release 2.8.0 CyaSSL has bug fixes and new features including:
|
Release 2.8.0 CyaSSL has bug fixes and new features including:
|
||||||
- AES-GCM and AES-CCM use AES-NI
|
- AES-GCM and AES-CCM use AES-NI
|
||||||
|
12
autogen.sh
12
autogen.sh
@ -3,6 +3,15 @@
|
|||||||
# Create configure and makefile stuff...
|
# Create configure and makefile stuff...
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Git hooks should come before autoreconf.
|
||||||
|
if test -d .git; then
|
||||||
|
if ! test -d .git/hooks; then
|
||||||
|
mkdir .git/hooks
|
||||||
|
fi
|
||||||
|
ln -s -f ../../pre-commit.sh .git/hooks/pre-commit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If this is a source checkout then call autoreconf with error as well
|
||||||
if test -d .git; then
|
if test -d .git; then
|
||||||
WARNINGS="all,error"
|
WARNINGS="all,error"
|
||||||
else
|
else
|
||||||
@ -11,6 +20,3 @@ fi
|
|||||||
|
|
||||||
autoreconf --install --force --verbose
|
autoreconf --install --force --verbose
|
||||||
|
|
||||||
if test -d .git; then
|
|
||||||
ln -s -f ../../pre-commit.sh .git/hooks/pre-commit
|
|
||||||
fi
|
|
||||||
|
23
configure.ac
23
configure.ac
@ -6,25 +6,30 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
AC_INIT([cyassl],[2.8.1],[http://www.yassl.com])
|
AC_INIT([cyassl],[2.8.1],[https://github.com/cyassl/cyassl/issues],[cyassl],[http://www.yassl.com])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
|
||||||
|
|
||||||
AC_CANONICAL_TARGET
|
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects])
|
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AC_CANONICAL_BUILD
|
AC_CANONICAL_BUILD
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
|
||||||
AC_PREREQ([2.63])
|
AC_PREREQ([2.63])
|
||||||
|
|
||||||
|
AC_ARG_PROGRAM
|
||||||
|
AC_DEFUN([PROTECT_AC_USE_SYSTEM_EXTENSIONS],
|
||||||
|
[AX_SAVE_FLAGS
|
||||||
|
AC_LANG_PUSH([C])
|
||||||
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
AC_LANG_POP([C])
|
||||||
|
AX_RESTORE_FLAGS
|
||||||
|
])
|
||||||
|
#PROTECT_AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
|
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
|
||||||
|
|
||||||
|
|
||||||
#shared library versioning
|
#shared library versioning
|
||||||
CYASSL_LIBRARY_VERSION=5:2:0
|
CYASSL_LIBRARY_VERSION=5:2:0
|
||||||
# | | |
|
# | | |
|
||||||
@ -57,8 +62,6 @@ AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
|
|||||||
|
|
||||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
AX_CXX_COMPILER_VERSION
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS([gethostbyname])
|
AC_CHECK_FUNCS([gethostbyname])
|
||||||
AC_CHECK_FUNCS([getaddrinfo])
|
AC_CHECK_FUNCS([getaddrinfo])
|
||||||
AC_CHECK_FUNCS([gettimeofday])
|
AC_CHECK_FUNCS([gettimeofday])
|
||||||
|
@ -1011,13 +1011,13 @@ void bench_eccKeyAgree(void)
|
|||||||
|
|
||||||
double current_time(int reset)
|
double current_time(int reset)
|
||||||
{
|
{
|
||||||
(void)reset;
|
|
||||||
|
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
static LARGE_INTEGER freq;
|
static LARGE_INTEGER freq;
|
||||||
|
|
||||||
LARGE_INTEGER count;
|
LARGE_INTEGER count;
|
||||||
|
|
||||||
|
(void)reset;
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
QueryPerformanceFrequency(&freq);
|
QueryPerformanceFrequency(&freq);
|
||||||
init = 1;
|
init = 1;
|
||||||
@ -1060,9 +1060,10 @@ void bench_eccKeyAgree(void)
|
|||||||
|
|
||||||
double current_time(int reset)
|
double current_time(int reset)
|
||||||
{
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
(void) reset;
|
(void) reset;
|
||||||
|
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
|
|
||||||
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
|
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
|
||||||
|
@ -525,6 +525,45 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(FREESCALE_K53_RNGB)
|
||||||
|
/*
|
||||||
|
* Generates a RNG seed using the Random Number Generator (RNGB)
|
||||||
|
* on the Kinetis K53. Documentation located in Chapter 33 of
|
||||||
|
* K53 Sub-Family Reference Manual (see note in the README for link).
|
||||||
|
*/
|
||||||
|
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* turn on RNGB module */
|
||||||
|
SIM_SCGC3 |= SIM_SCGC3_RNGB_MASK;
|
||||||
|
|
||||||
|
/* reset RNGB */
|
||||||
|
RNG_CMD |= RNG_CMD_SR_MASK;
|
||||||
|
|
||||||
|
/* FIFO generate interrupt, return all zeros on underflow,
|
||||||
|
* set auto reseed */
|
||||||
|
RNG_CR |= (RNG_CR_FUFMOD_MASK | RNG_CR_AR_MASK);
|
||||||
|
|
||||||
|
/* gen seed, clear interrupts, clear errors */
|
||||||
|
RNG_CMD |= (RNG_CMD_GS_MASK | RNG_CMD_CI_MASK | RNG_CMD_CE_MASK);
|
||||||
|
|
||||||
|
/* wait for seeding to complete */
|
||||||
|
while ((RNG_SR & RNG_SR_SDN_MASK) == 0) {}
|
||||||
|
|
||||||
|
for (i = 0; i < sz; i++) {
|
||||||
|
|
||||||
|
/* wait for a word to be available from FIFO */
|
||||||
|
while((RNG_SR & RNG_SR_FIFO_LVL_MASK) == 0) {}
|
||||||
|
|
||||||
|
/* get value */
|
||||||
|
output[i] = RNG_OUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#warning "write a real random seed!!!!, just for testing now"
|
#warning "write a real random seed!!!!, just for testing now"
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
#ifdef FREESCALE_MQX
|
#ifdef FREESCALE_MQX
|
||||||
#include <mqx.h>
|
#include <mqx.h>
|
||||||
#include <fio.h>
|
#include <fio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
@ -2376,30 +2377,32 @@ byte GetEntropy(ENTROPY_CMD cmd, byte* out)
|
|||||||
|
|
||||||
#ifndef NO_RSA
|
#ifndef NO_RSA
|
||||||
|
|
||||||
#ifdef FREESCALE_MQX
|
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||||
static const char* clientKey = "a:\\certs\\client-key.der";
|
#ifdef FREESCALE_MQX
|
||||||
static const char* clientCert = "a:\\certs\\client-cert.der";
|
static const char* clientKey = "a:\\certs\\client-key.der";
|
||||||
#ifdef CYASSL_CERT_GEN
|
static const char* clientCert = "a:\\certs\\client-cert.der";
|
||||||
static const char* caKeyFile = "a:\\certs\\ca-key.der";
|
#ifdef CYASSL_CERT_GEN
|
||||||
static const char* caCertFile = "a:\\certs\\ca-cert.pem";
|
static const char* caKeyFile = "a:\\certs\\ca-key.der";
|
||||||
#endif
|
static const char* caCertFile = "a:\\certs\\ca-cert.pem";
|
||||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && defined(CYASSL_MKD_SHELL)
|
#endif
|
||||||
static char* clientKey = "certs/client-key.der";
|
#elif defined(CYASSL_MKD_SHELL)
|
||||||
static char* clientCert = "certs/client-cert.der";
|
static char* clientKey = "certs/client-key.der";
|
||||||
void set_clientKey(char *key) { clientKey = key ; } /* set by shell command */
|
static char* clientCert = "certs/client-cert.der";
|
||||||
void set_clientCert(char *cert) { clientCert = cert ; } /* set by shell command */
|
void set_clientKey(char *key) { clientKey = key ; } /* set by shell command */
|
||||||
#ifdef CYASSL_CERT_GEN
|
void set_clientCert(char *cert) { clientCert = cert ; } /* set by shell command */
|
||||||
static char* caKeyFile = "certs/ca-key.der";
|
#ifdef CYASSL_CERT_GEN
|
||||||
static char* caCertFile = "certs/ca-cert.pem";
|
static char* caKeyFile = "certs/ca-key.der";
|
||||||
void set_caKeyFile (char * key) { caKeyFile = key ; } /* set by shell command */
|
static char* caCertFile = "certs/ca-cert.pem";
|
||||||
void set_caCertFile(char * cert) { caCertFile = cert ; } /* set by shell command */
|
void set_caKeyFile (char * key) { caKeyFile = key ; } /* set by shell command */
|
||||||
#endif
|
void set_caCertFile(char * cert) { caCertFile = cert ; } /* set by shell command */
|
||||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
#endif
|
||||||
static const char* clientKey = "./certs/client-key.der";
|
#else
|
||||||
static const char* clientCert = "./certs/client-cert.der";
|
static const char* clientKey = "./certs/client-key.der";
|
||||||
#ifdef CYASSL_CERT_GEN
|
static const char* clientCert = "./certs/client-cert.der";
|
||||||
static const char* caKeyFile = "./certs/ca-key.der";
|
#ifdef CYASSL_CERT_GEN
|
||||||
static const char* caCertFile = "./certs/ca-cert.pem";
|
static const char* caKeyFile = "./certs/ca-key.der";
|
||||||
|
static const char* caCertFile = "./certs/ca-cert.pem";
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2848,10 +2851,12 @@ int rsa_test(void)
|
|||||||
|
|
||||||
#ifndef NO_DH
|
#ifndef NO_DH
|
||||||
|
|
||||||
#ifdef FREESCALE_MQX
|
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||||
static const char* dhKey = "a:\certs\\dh2048.der";
|
#ifdef FREESCALE_MQX
|
||||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
static const char* dhKey = "a:\certs\\dh2048.der";
|
||||||
static const char* dhKey = "./certs/dh2048.der";
|
#else
|
||||||
|
static const char* dhKey = "./certs/dh2048.der";
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int dh_test(void)
|
int dh_test(void)
|
||||||
@ -2926,10 +2931,12 @@ int dh_test(void)
|
|||||||
|
|
||||||
#ifndef NO_DSA
|
#ifndef NO_DSA
|
||||||
|
|
||||||
#ifdef FREESCALE_MQX
|
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||||
static const char* dsaKey = "a:\\certs\\dsa2048.der";
|
#ifdef FREESCALE_MQX
|
||||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
static const char* dsaKey = "a:\\certs\\dsa2048.der";
|
||||||
static const char* dsaKey = "./certs/dsa2048.der";
|
#else
|
||||||
|
static const char* dsaKey = "./certs/dsa2048.der";
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int dsa_test(void)
|
int dsa_test(void)
|
||||||
|
@ -60,7 +60,7 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
/* DES encryption and decryption */
|
/* DES encryption and decryption */
|
||||||
typedef struct Des {;
|
typedef struct Des {
|
||||||
word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
|
word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
|
||||||
word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */
|
word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */
|
||||||
byte keylen ; /* for Coldfire SEC */
|
byte keylen ; /* for Coldfire SEC */
|
||||||
|
@ -299,6 +299,8 @@
|
|||||||
#define USE_FAST_MATH
|
#define USE_FAST_MATH
|
||||||
#define TFM_TIMING_RESISTANT
|
#define TFM_TIMING_RESISTANT
|
||||||
#define FREESCALE_K70_RNGA
|
#define FREESCALE_K70_RNGA
|
||||||
|
/* #define FREESCALE_K53_RNGB */
|
||||||
|
#include "mqx.h"
|
||||||
#ifndef NO_FILESYSTEM
|
#ifndef NO_FILESYSTEM
|
||||||
#include "mfs.h"
|
#include "mfs.h"
|
||||||
#include "fio.h"
|
#include "fio.h"
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
# and this notice are preserved. This file is offered as-is, without any
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# warranty.
|
# warranty.
|
||||||
|
|
||||||
#serial 7
|
#serial 8
|
||||||
|
|
||||||
AC_DEFUN([AX_APPEND_TO_FILE],[
|
AC_DEFUN([AX_APPEND_TO_FILE],[
|
||||||
AC_REQUIRE([AX_FILE_ESCAPES])
|
AC_REQUIRE([AX_FILE_ESCAPES])
|
||||||
printf "$2" >> "$1"
|
printf "$2\n" >> "$1"
|
||||||
])
|
])
|
||||||
|
95
m4/ax_check_library.m4
Normal file
95
m4/ax_check_library.m4
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_check_library.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CHECK_LIBRARY(VARIABLE-PREFIX, HEADER-FILE, LIBRARY-FILE,
|
||||||
|
# [ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Provides a generic test for a given library, similar in concept to the
|
||||||
|
# PKG_CHECK_MODULES macro used by pkg-config.
|
||||||
|
#
|
||||||
|
# Most simplest libraries can be checked against simply through the
|
||||||
|
# presence of a header file and a library to link to. This macro allows to
|
||||||
|
# wrap around the test so that it doesn't have to be recreated each time.
|
||||||
|
#
|
||||||
|
# Rather than define --with-$LIBRARY arguments, it uses variables in the
|
||||||
|
# same way that PKG_CHECK_MODULES does. It doesn't, though, use the same
|
||||||
|
# names, since you shouldn't provide a value for LIBS or CFLAGS but rather
|
||||||
|
# for LDFLAGS and CPPFLAGS, to tell the linker and compiler where to find
|
||||||
|
# libraries and headers respectively.
|
||||||
|
#
|
||||||
|
# If the library is find, HAVE_PREFIX is defined, and in all cases
|
||||||
|
# PREFIX_LDFLAGS and PREFIX_CPPFLAGS are substituted.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# AX_CHECK_LIBRARY([LIBEVENT], [event.h], [event], [],
|
||||||
|
# [AC_MSG_ERROR([Unable to find libevent])])
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012 Brian Aker <brian@tangent.org>
|
||||||
|
# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the
|
||||||
|
# Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
# option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
# Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||||||
|
# need not follow the terms of the GNU General Public License when using
|
||||||
|
# or distributing such scripts, even though portions of the text of the
|
||||||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||||||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||||
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
|
#serial 7
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CHECK_LIBRARY],
|
||||||
|
[AC_ARG_VAR($1[_CPPFLAGS],[C preprocessor flags for ]$1[ headers])
|
||||||
|
AC_ARG_VAR($1[_LDFLAGS],[linker flags for ]$1[ libraries])
|
||||||
|
|
||||||
|
AC_CACHE_VAL(AS_TR_SH([ax_cv_have_]$1),
|
||||||
|
[AX_SAVE_FLAGS
|
||||||
|
|
||||||
|
AS_IF([test "x$]$1[_CPPFLAGS" != "x"],
|
||||||
|
[CPPFLAGS="$CPPFLAGS $]$1[_CPPFLAGS"])
|
||||||
|
|
||||||
|
AS_IF([test "x$]$1[_LDFLAGS" != "x"],
|
||||||
|
[LDFLAGS="$LDFLAGS $]$1[_LDFLAGS"])
|
||||||
|
|
||||||
|
AC_CHECK_HEADER($2, [
|
||||||
|
AC_CHECK_LIB($3, [main],
|
||||||
|
[AS_TR_SH([ax_cv_have_]$1)=yes],
|
||||||
|
[AS_TR_SH([ax_cv_have_]$1)=no])
|
||||||
|
], [AS_TR_SH([ax_cv_have_]$1)=no])
|
||||||
|
|
||||||
|
AX_RESTORE_FLAGS
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"],
|
||||||
|
[AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found])
|
||||||
|
AC_SUBST($1[_CPPFLAGS])
|
||||||
|
AC_SUBST($1[_LDFLAGS])
|
||||||
|
AC_SUBST($1[_LIB],[-l]$3)
|
||||||
|
ifelse([$4], , :, [$4])],
|
||||||
|
[ifelse([$5], , :, [$5])])
|
||||||
|
])
|
@ -1,36 +1,100 @@
|
|||||||
AC_DEFUN([AX_C_COMPILER_VERSION],[
|
# ===========================================================================
|
||||||
|
# https://github.com/BrianAker/ddm4/
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_COMPILER_VERSION()
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Capture version of C/C++ compiler
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Brian Aker
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are
|
||||||
|
# met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above
|
||||||
|
# copyright notice, this list of conditions and the following disclaimer
|
||||||
|
# in the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
#
|
||||||
|
# * The names of its contributors may not be used to endorse or
|
||||||
|
# promote products derived from this software without specific prior
|
||||||
|
# written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
dnl Print version of C compiler
|
#serial 5
|
||||||
AC_MSG_CHECKING("C Compiler version--$GCC")
|
AC_DEFUN([_C_COMPILER_VERSION],
|
||||||
AS_IF([test "$GCC" = "yes"],[
|
[AC_MSG_CHECKING([C Compiler version])
|
||||||
CC_VERSION=`$CC --version | sed 1q` ],[
|
|
||||||
test "$SUNCC" = "yes"],[
|
|
||||||
CC_VERSION=`$CC -V 2>&1 | sed 1q` ],[
|
|
||||||
test "$CLANG" = "yes"],[
|
|
||||||
CC_VERSION=`$CC --version 2>&1 | sed 1q` ],[
|
|
||||||
CC_VERSION=""
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT("$CC_VERSION")
|
|
||||||
AC_SUBST(CC_VERSION)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
AS_CASE(["$ax_cv_c_compiler_vendor"],
|
||||||
|
[sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`],
|
||||||
|
[intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],
|
||||||
|
[clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],
|
||||||
|
[gnu],[ax_c_compiler_version=`$CC --version | sed 1q`],
|
||||||
|
[mingw],[ax_c_compiler_version=`$CC --version | sed 1q`],
|
||||||
|
[ax_c_compiler_version="unknown: $ax_cv_c_compiler_vendor"])
|
||||||
|
|
||||||
AC_DEFUN([AX_CXX_COMPILER_VERSION], [
|
AC_MSG_RESULT(["$ax_c_compiler_version"])
|
||||||
|
AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"])
|
||||||
dnl Check C version while at it
|
AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
|
||||||
AC_REQUIRE([AX_C_COMPILER_VERSION])
|
|
||||||
|
|
||||||
dnl Print version of CXX compiler
|
|
||||||
AC_MSG_CHECKING("C++ Compiler version")
|
|
||||||
AS_IF([test "$GCC" = "yes"],[
|
|
||||||
CXX_VERSION=`$CXX --version | sed 1q` ],[
|
|
||||||
test "$SUNCC" = "yes"],[
|
|
||||||
CXX_VERSION=`$CXX -V 2>&1 | sed 1q` ],[
|
|
||||||
test "$CLANG" = "yes"],[
|
|
||||||
CXX_VERSION=`$CXX --version 2>&1 | sed 1q` ],[
|
|
||||||
CXX_VERSION=""
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT("$CXX_VERSION")
|
|
||||||
AC_SUBST(CXX_VERSION)
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([_CXX_COMPILER_VERSION],
|
||||||
|
[AC_MSG_CHECKING([C++ Compiler version])
|
||||||
|
|
||||||
|
AS_CASE(["$ax_cv_c_compiler_vendor"],
|
||||||
|
[sun],[ax_cxx_compiler_version=`$CXX -V 2>&1 | sed 1q`],
|
||||||
|
[intel],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`],
|
||||||
|
[clang],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`],
|
||||||
|
[gnu],[ax_cxx_compiler_version=`$CXX --version | sed 1q`],
|
||||||
|
[mingw],[ax_cxx_compiler_version=`$CXX --version | sed 1q`],
|
||||||
|
[ax_cxx_compiler_version="unknown: $ax_cv_c_compiler_vendor"])
|
||||||
|
|
||||||
|
AC_MSG_RESULT(["$ax_cxx_compiler_version"])
|
||||||
|
AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"])
|
||||||
|
AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_COMPILER_VERSION],
|
||||||
|
[AC_REQUIRE([AX_COMPILER_VENDOR])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([MINGW])
|
||||||
|
AC_CHECK_DECL([__MINGW32__],
|
||||||
|
[MINGW=yes
|
||||||
|
ax_c_compiler_version_vendor=mingw],
|
||||||
|
[MINGW=no])
|
||||||
|
AC_MSG_RESULT([$MINGW])
|
||||||
|
|
||||||
|
AC_REQUIRE([_C_COMPILER_VERSION])
|
||||||
|
AC_REQUIRE([_CXX_COMPILER_VERSION])
|
||||||
|
AS_IF([test "x$GCC" = xyes],
|
||||||
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 7))
|
||||||
|
# error GCC is Too Old!
|
||||||
|
#endif
|
||||||
|
]])],
|
||||||
|
[ac_c_gcc_recent=yes],
|
||||||
|
[ac_c_gcc_recent=no])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
@ -43,19 +43,22 @@
|
|||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#serial 2
|
#serial 6
|
||||||
|
|
||||||
AC_DEFUN([AX_DEBUG],[
|
AC_DEFUN([AX_DEBUG],
|
||||||
|
[AC_PREREQ([2.63])dnl
|
||||||
AC_ARG_ENABLE([debug],
|
AC_ARG_ENABLE([debug],
|
||||||
[AS_HELP_STRING([--enable-debug],
|
[AS_HELP_STRING([--enable-debug],
|
||||||
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],[
|
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
|
||||||
ax_enable_debug=$enableval
|
[ax_enable_debug=yes
|
||||||
AC_DEFINE(DEBUG, [ 1 ], [Define to 1 to enable debugging code.])
|
AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])
|
||||||
],[
|
AX_CHECK_LIBRARY([MCHECK],[mcheck.h],[mcheck],[AX_APPEND_LINK_FLAGS([-lmcheck])])
|
||||||
ax_enable_debug=no
|
AX_ADD_AM_MACRO([--debug],[AM_YFLAGS])
|
||||||
AC_DEFINE(DEBUG, [ 0 ], [Define to 1 to enable debugging code.])
|
AX_ADD_AM_MACRO([-D_GLIBCXX_DEBUG],[AM_CPPFLAGS])],
|
||||||
])
|
[ax_enable_debug=no
|
||||||
|
AC_SUBST([MCHECK])
|
||||||
|
AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])])
|
||||||
|
|
||||||
AC_MSG_CHECKING([for debug])
|
AC_MSG_CHECKING([for debug])
|
||||||
AC_MSG_RESULT([$ax_enable_debug])
|
AC_MSG_RESULT([$ax_enable_debug])
|
||||||
])
|
AM_CONDITIONAL([DEBUG],[test "x${ax_enable_debug}" = "xyes"])])
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
AC_REQUIRE([AX_CHECK_LINK_FLAG])
|
AC_REQUIRE([AX_CHECK_LINK_FLAG])
|
||||||
AC_REQUIRE([AX_VCS_CHECKOUT])
|
AC_REQUIRE([AX_VCS_CHECKOUT])
|
||||||
AC_REQUIRE([AX_DEBUG])
|
AC_REQUIRE([AX_DEBUG])
|
||||||
AC_REQUIRE([AX_CXX_COMPILER_VERSION])
|
|
||||||
|
|
||||||
dnl If we are inside of VCS we append -Werror, otherwise we just use it to test other flags
|
dnl If we are inside of VCS we append -Werror, otherwise we just use it to test other flags
|
||||||
AX_HARDEN_LIB=
|
AX_HARDEN_LIB=
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
# modified version of the Autoconf Macro, you may extend this special
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
# exception to the GPL to apply to your modified version as well.
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
#serial 19
|
#serial 20
|
||||||
|
|
||||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||||
AC_DEFUN([AX_PTHREAD], [
|
AC_DEFUN([AX_PTHREAD], [
|
||||||
@ -159,12 +159,12 @@ case ${host_os} in
|
|||||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
darwin12* | darwin11.4*)
|
|
||||||
ax_pthread_flags="$ax_pthread_flags"
|
|
||||||
;;
|
|
||||||
|
|
||||||
darwin*)
|
darwin*)
|
||||||
ax_pthread_flags="-pthreads $ax_pthread_flags"
|
if test "$CC" = "clang"; then
|
||||||
|
ax_pthread_flags="$ax_pthread_flags"
|
||||||
|
else
|
||||||
|
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -287,16 +287,24 @@ if test "x$ax_pthread_ok" = xyes; then
|
|||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
# More AIX lossage: must compile with xlc_r or cc_r
|
# More AIX lossage: compile with *_r variant
|
||||||
if test x"$GCC" != xyes; then
|
if test "x$GCC" != xyes; then
|
||||||
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
case $host_os in
|
||||||
else
|
aix*)
|
||||||
PTHREAD_CC=$CC
|
AS_CASE(["x/$CC"],
|
||||||
|
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||||
|
[#handle absolute path differently from PATH based program lookup
|
||||||
|
AS_CASE(["x$CC"],
|
||||||
|
[x/*],
|
||||||
|
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||||
|
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
PTHREAD_CC="$CC"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||||
|
|
||||||
AC_SUBST(PTHREAD_LIBS)
|
AC_SUBST(PTHREAD_LIBS)
|
||||||
AC_SUBST(PTHREAD_CFLAGS)
|
AC_SUBST(PTHREAD_CFLAGS)
|
||||||
AC_SUBST(PTHREAD_CC)
|
AC_SUBST(PTHREAD_CC)
|
||||||
|
@ -45,15 +45,31 @@
|
|||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#serial 1
|
#serial 6
|
||||||
|
|
||||||
AC_DEFUN([AX_VCS_CHECKOUT],[
|
AC_DEFUN([AX_VCS_SYSTEM],
|
||||||
AC_CACHE_CHECK([for vcs checkout], [ac_cv_vcs_checkout], [
|
[AC_PREREQ([2.63])dnl
|
||||||
AS_IF([test -d ".bzr"],[ac_cv_vcs_checkout=yes])
|
AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system],
|
||||||
AS_IF([test -d ".svn"],[ac_cv_vcs_checkout=yes])
|
[ac_cv_vcs_system="none"
|
||||||
AS_IF([test -d ".hg"], [ac_cv_vcs_checkout=yes])
|
AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"])
|
||||||
AS_IF([test -d ".git"],[ac_cv_vcs_checkout=yes])
|
AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"])
|
||||||
|
AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"])
|
||||||
|
AS_IF([test -d ".git"],[ac_cv_vcs_system="git"])
|
||||||
|
])
|
||||||
|
AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_VCS_CHECKOUT],
|
||||||
|
[AC_PREREQ([2.63])dnl
|
||||||
|
AC_REQUIRE([AX_VCS_SYSTEM])
|
||||||
|
AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout],
|
||||||
|
[AS_IF([test "x$ac_cv_vcs_system" != "xnone"],
|
||||||
|
[ac_cv_vcs_checkout=yes],
|
||||||
|
[ac_cv_vcs_checkout=no])
|
||||||
])
|
])
|
||||||
|
|
||||||
AS_IF([test "$ac_cv_vcs_checkout" = yes], [])
|
AM_CONDITIONAL([IS_VCS_CHECKOUT],[test "x$ac_cv_vcs_checkout" = "xyes"])
|
||||||
|
AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],
|
||||||
|
[AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])],
|
||||||
|
[AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])])
|
||||||
])
|
])
|
||||||
|
Reference in New Issue
Block a user