Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
429 changed files
with
18,685 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Public domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
See README.markdown |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /bin/sh | ||
|
||
if [ -x "`which autoreconf 2>/dev/null`" ] ; then | ||
exec autoreconf -ivf | ||
fi | ||
|
||
aclocal && \ | ||
autoheader && \ | ||
automake --add-missing --force-missing --include-deps && \ | ||
autoconf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
AC_PREREQ([2.61]) | ||
AC_INIT([nacl-ref],[0.0.1],[https://github.com/jedisct1/nacl-ref]) | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
AC_CONFIG_SRCDIR([src/libnacl/PROTOTYPES.c]) | ||
AC_CONFIG_HEADER([config.h]) | ||
AC_CANONICAL_HOST | ||
AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar]) | ||
AM_MAINTAINER_MODE | ||
AM_DEP_TRACK | ||
|
||
AC_SUBST(VERSION) | ||
ISODATE=`date +%Y-%m-%d` | ||
AC_SUBST(ISODATE) | ||
|
||
LX_CFLAGS=${CFLAGS-NONE} | ||
AC_PROG_CC_C99 | ||
AC_USE_SYSTEM_EXTENSIONS | ||
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" | ||
|
||
AS_IF([test "$cross_compiling" != no], | ||
AC_DEFINE(CROSS_COMPILING,,[define if you are cross-compiling]) | ||
) | ||
|
||
AX_CHECK_COMPILE_FLAG([-fPIC], [ | ||
AX_CHECK_LINK_FLAG([-fPIC], | ||
[CFLAGS="$CFLAGS -fPIC"] | ||
) | ||
]) | ||
|
||
AS_IF([test "$enable_pie" != "no"],[ | ||
AX_CHECK_COMPILE_FLAG([-fPIE], [ | ||
AX_CHECK_LINK_FLAG([-fPIE], | ||
[AX_CHECK_LINK_FLAG([-pie], | ||
[CFLAGS="$CFLAGS -fPIE" | ||
LDFLAGS="$LDFLAGS -pie"]) | ||
]) | ||
]) | ||
]) | ||
|
||
AX_CHECK_COMPILE_FLAG([-fcatch-undefined-c99-behavior], | ||
[CFLAGS="$CFLAGS -fcatch-undefined-c99-behavior"], | ||
[AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="$CFLAGS -fwrapv"])] | ||
) | ||
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"]) | ||
AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"]) | ||
|
||
case $host_os in | ||
cygwin* | mingw* | pw32* | cegcc*) | ||
AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [LDFLAGS="$LDFLAGS -Wl,--dynamicbase"]) | ||
AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [LDFLAGS="$LDFLAGS -Wl,--nxcompat"]) | ||
AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [ | ||
AX_CHECK_LINK_FLAG([-fstack-protector-all], | ||
[CFLAGS="$CFLAGS -fstack-protector-all"] | ||
) | ||
]) | ||
;; | ||
dragonfly*) | ||
AX_CHECK_COMPILE_FLAG([-fstack-protector], [ | ||
AX_CHECK_LINK_FLAG([-fstack-protector], | ||
[CFLAGS="$CFLAGS -fstack-protector"] | ||
) | ||
]) | ||
;; | ||
*) | ||
AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [ | ||
AX_CHECK_LINK_FLAG([-fstack-protector-all], | ||
[CFLAGS="$CFLAGS -fstack-protector-all"] | ||
) | ||
]) | ||
;; | ||
esac | ||
|
||
AX_CHECK_COMPILE_FLAG([-Wbounded], [CFLAGS="$CFLAGS -Wbounded"]) | ||
AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"]) | ||
AX_CHECK_COMPILE_FLAG([-Wwrite-strings], [CFLAGS="$CFLAGS -Wwrite-strings"]) | ||
AX_CHECK_COMPILE_FLAG([-Wdiv-by-zero], [CFLAGS="$CFLAGS -Wdiv-by-zero"]) | ||
|
||
AC_ARG_VAR([CWFLAGS], [define to compilation flags for generating extra warnings]) | ||
|
||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wall], [CWFLAGS="$CWFLAGS -Wall"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wextra], [CWFLAGS="$CWFLAGS -Wextra"]) | ||
|
||
AC_MSG_CHECKING(for clang) | ||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ | ||
#ifndef __clang__ | ||
be sad | ||
#endif | ||
]])], | ||
[AC_MSG_RESULT(yes) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wno-unknown-warning-option], | ||
[CWFLAGS="$CWFLAGS -Wno-unknown-warning-option"])], | ||
[AC_MSG_RESULT(no) | ||
]) | ||
|
||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wbad-function-cast], [CWFLAGS="$CWFLAGS -Wbad-function-cast"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcast-align], [CWFLAGS="$CWFLAGS -Wcast-align"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcast-qual], [CWFLAGS="$CWFLAGS -Wcast-qual"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wchar-subscripts], [CWFLAGS="$CWFLAGS -Wchar-subscripts"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcomment], [CWFLAGS="$CWFLAGS -Wcomment"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wfloat-equal], [CWFLAGS="$CWFLAGS -Wfloat-equal"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wformat=2], [CWFLAGS="$CWFLAGS -Wformat=2"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wimplicit], [CWFLAGS="$CWFLAGS -Wimplicit"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wmissing-declarations], [CWFLAGS="$CWFLAGS -Wmissing-declarations"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wmissing-prototypes], [CWFLAGS="$CWFLAGS -Wmissing-prototypes"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wnormalized=id], [CWFLAGS="$CWFLAGS -Wnormalized=id"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Woverride-init], [CWFLAGS="$CWFLAGS -Woverride-init"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wparentheses], [CWFLAGS="$CWFLAGS -Wparentheses"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wpointer-arith], [CWFLAGS="$CWFLAGS -Wpointer-arith"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wredundant-decls], [CWFLAGS="$CWFLAGS -Wredundant-decls"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wstrict-prototypes], [CWFLAGS="$CWFLAGS -Wstrict-prototypes"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wswitch-enum], [CWFLAGS="$CWFLAGS -Wswitch-enum"]) | ||
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wvariable-decl], [CWFLAGS="$CWFLAGS -Wvariable-decl"]) | ||
|
||
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"]) | ||
AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"]) | ||
AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"]) | ||
|
||
AC_ARG_VAR([AR], [path to the ar utility]) | ||
AC_CHECK_TOOL([AR], [ar], [ar]) | ||
|
||
AS_IF([test -d /usr/local/include], [ | ||
CPPFLAGS="$CPPFLAGS -I/usr/local/include" | ||
]) | ||
|
||
AS_IF([test -d /usr/local/lib], [ | ||
LDFLAGS="$LDFLAGS -L/usr/local/lib" | ||
]) | ||
|
||
dnl Checks for typedefs, structures, and compiler characteristics. | ||
|
||
AC_C_BIGENDIAN | ||
|
||
dnl Switches. | ||
|
||
AC_ARG_ENABLE(pie, | ||
[AS_HELP_STRING(--enable-pie,Produce position independent executables @<:@default=yes@:>@)], | ||
enable_pie=$enableval, enable_pie="maybe") | ||
|
||
AC_ARG_ENABLE(ssp, | ||
[AS_HELP_STRING(--disable-ssp,Don't compile with -fstack-protector)], | ||
[AS_IF([test "x$enableval" = "xno"], [ | ||
nxflags="" | ||
for flag in `echo $CFLAGS`; do | ||
case "$flag" in | ||
-fstack-protector*) ;; | ||
*) AS_VAR_APPEND([nxflags], [" $flag"]) ;; | ||
esac | ||
done | ||
CFLAGS="$nxflags" | ||
]) | ||
]) | ||
|
||
AC_ARG_ENABLE(debug, | ||
[AS_HELP_STRING(--enable-debug,For maintainers only - please do not use)], | ||
[ | ||
AS_IF([test "x$LX_CFLAGS" = "xNONE"], [ | ||
nxflags="" | ||
for flag in `echo $CFLAGS`; do | ||
case "$flag" in | ||
-O*) ;; | ||
-g*) ;; | ||
*) AS_VAR_APPEND([nxflags], [" $flag"]) ;; | ||
esac | ||
done | ||
CFLAGS="$nxflags -O0 -g3" | ||
]) | ||
CPPFLAGS="$CPPFLAGS -DDEBUG=1" | ||
]) | ||
|
||
AC_ARG_WITH(safecode, | ||
[AS_HELP_STRING(--with-safecode,For maintainers only - please do not use)], | ||
[AS_IF([test "x$withval" = "xyes"], [ | ||
AC_ARG_VAR([SAFECODE_HOME], [set to the safecode base directory]) | ||
: ${SAFECODE_HOME:=/opt/safecode} | ||
LDFLAGS="$LDFLAGS -L${SAFECODE_HOME}/lib" | ||
LIBS="$LIBS -lsc_dbg_rt -lpoolalloc_bitmap -lstdc++" | ||
CFLAGS="$CFLAGS -fmemsafety" | ||
]) | ||
]) | ||
|
||
NACL_HOSTNAME="localhost" | ||
NACL_PATH=libnacl/build/${NACL_HOSTNAME} | ||
|
||
AC_SUBST([MAINT]) | ||
AC_SUBST([NACL_PATH]) | ||
|
||
dnl Output. | ||
|
||
AH_VERBATIM([NDEBUG], [/* Never ever ignore assertions */ | ||
#ifdef NDEBUG | ||
#/**/undef/**/ NDEBUG | ||
#endif]) | ||
|
||
AC_CONFIG_FILES([Makefile | ||
src/Makefile | ||
src/libnacl/Makefile | ||
src/libnacl/tests/Makefile | ||
src/libnacl/okcompilers/c | ||
src/libnacl/okcompilers/do]) | ||
|
||
AC_OUTPUT | ||
|
||
chmod +x src/libnacl/do | ||
chmod +x src/libnacl/okcompilers/do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# =========================================================================== | ||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | ||
# =========================================================================== | ||
# | ||
# SYNOPSIS | ||
# | ||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) | ||
# | ||
# 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. | ||
# | ||
# 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> | ||
# | ||
# 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 2 | ||
|
||
AC_DEFUN([AX_CHECK_COMPILE_FLAG], | ||
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX | ||
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([AC_LANG_PROGRAM([[#include <stdio.h>]], | ||
[[char x[42U], fodder = 0;if (fodder > -1000 && fgets(x,1000,stdin)) puts(x)]])], | ||
[AS_VAR_SET(CACHEVAR,[yes])], | ||
[AS_VAR_SET(CACHEVAR,[no])]) | ||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) | ||
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], | ||
[m4_default([$2], :)], | ||
[m4_default([$3], :)]) | ||
AS_VAR_POPDEF([CACHEVAR])dnl | ||
])dnl AX_CHECK_COMPILE_FLAGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# =========================================================================== | ||
# http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html | ||
# =========================================================================== | ||
# | ||
# SYNOPSIS | ||
# | ||
# AX_CHECK_GNU_MAKE() | ||
# | ||
# DESCRIPTION | ||
# | ||
# This macro searches for a GNU version of make. If a match is found, the | ||
# makefile variable `ifGNUmake' is set to the empty string, otherwise it | ||
# is set to "#". This is useful for including a special features in a | ||
# Makefile, which cannot be handled by other versions of make. The | ||
# variable _cv_gnu_make_command is set to the command to invoke GNU make | ||
# if it exists, the empty string otherwise. | ||
# | ||
# Here is an example of its use: | ||
# | ||
# Makefile.in might contain: | ||
# | ||
# # A failsafe way of putting a dependency rule into a makefile | ||
# $(DEPEND): | ||
# $(CC) -MM $(srcdir)/*.c > $(DEPEND) | ||
# | ||
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) | ||
# @ifGNUmake@ include $(DEPEND) | ||
# @ifGNUmake@ endif | ||
# | ||
# Then configure.in would normally contain: | ||
# | ||
# AX_CHECK_GNU_MAKE() | ||
# AC_OUTPUT(Makefile) | ||
# | ||
# Then perhaps to cause gnu make to override any other make, we could do | ||
# something like this (note that GNU make always looks for GNUmakefile | ||
# first): | ||
# | ||
# if ! test x$_cv_gnu_make_command = x ; then | ||
# mv Makefile GNUmakefile | ||
# echo .DEFAULT: > Makefile ; | ||
# echo \ $_cv_gnu_make_command \$@ >> Makefile; | ||
# fi | ||
# | ||
# Then, if any (well almost any) other make is called, and GNU make also | ||
# exists, then the other make wraps the GNU make. | ||
# | ||
# LICENSE | ||
# | ||
# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au> | ||
# | ||
# 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 7 | ||
|
||
AC_DEFUN([AX_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, | ||
_cv_gnu_make_command='' ; | ||
dnl Search all the common names for GNU make | ||
for a in "$MAKE" make gmake gnumake ; do | ||
if test -z "$a" ; then continue ; fi ; | ||
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then | ||
_cv_gnu_make_command=$a ; | ||
break; | ||
fi | ||
done ; | ||
) ; | ||
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise | ||
if test "x$_cv_gnu_make_command" != "x" ; then | ||
ifGNUmake='' ; | ||
else | ||
ifGNUmake='#' ; | ||
AC_MSG_RESULT("Not found"); | ||
fi | ||
AC_SUBST(ifGNUmake) | ||
] ) |
Oops, something went wrong.