generate cyassl/options.h based on ./configure flags/settings for user app use

This commit is contained in:
toddouska 2013-04-12 11:21:38 -07:00
parent f6edc37549
commit 0b7e18040c
4 changed files with 74 additions and 0 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ config*
build-aux/
rpm/spec
stamp-h
cyassl/options.h
libtool.m4
aclocal.m4
aminclude.am

View File

@ -1252,6 +1252,7 @@ AX_HARDEN_CC_COMPILER_FLAGS
# add user C_EXTRA_FLAGS back
CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
OPTION_FLAGS="$USER_C_EXTRA_FLAGS $AM_CFLAGS"
CREATE_HEX_VERSION
AC_SUBST([AM_CPPFLAGS])
@ -1262,6 +1263,7 @@ AC_SUBST([AM_LDFLAGS])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([cyassl/version.h])
AC_CONFIG_FILES([cyassl/options.h])
AC_CONFIG_FILES([support/libcyassl.pc])
AC_CONFIG_FILES([rpm/spec])
@ -1270,11 +1272,48 @@ AX_AM_JOBSERVER([yes])
AC_OUTPUT
# force make clean
echo "---"
echo "Running make clean..."
make clean >/dev/null 2>&1
echo
# generate user options header
echo "---"
echo "Generating user options header..."
OPTION_FILE="cyassl/options.h"
rm -f $OPTION_FILE
echo "/* cyassl options.h */" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "#pragma once" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo "#ifdef __cplusplus" >> $OPTION_FILE
echo "extern \"C\" {" >> $OPTION_FILE
echo "#endif" >> $OPTION_FILE
echo "" >> $OPTION_FILE
for option in $OPTION_FLAGS; do
defonly=`echo $option | sed 's/-D//'`
if test "$defonly" != "$option"
then
echo "#undef $defonly" >> $OPTION_FILE
echo "#define $defonly" >> $OPTION_FILE
echo "" >> $OPTION_FILE
else
echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
fi
done
echo "" >> $OPTION_FILE
echo "#ifdef __cplusplus" >> $OPTION_FILE
echo "}" >> $OPTION_FILE
echo "#endif" >> $OPTION_FILE
echo "" >> $OPTION_FILE
echo
# output config summary
echo "---"
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
echo ""

View File

@ -17,5 +17,6 @@ nobase_include_HEADERS+= \
cyassl/certs_test.h \
cyassl/test.h \
cyassl/version.h \
cyassl/options.h \
cyassl/ocsp.h \
cyassl/crl.h

33
cyassl/options.h.in Normal file
View File

@ -0,0 +1,33 @@
/* options.h.in
*
* Copyright (C) 2006-2013 wolfSSL Inc.
*
* This file is part of CyaSSL.
*
* CyaSSL 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 2 of the License, or
* (at your option) any later version.
*
* CyaSSL 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif