diff --git a/.gitignore b/.gitignore index 6880ec503..3f73f167e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ config* build-aux/ rpm/spec stamp-h +cyassl/options.h libtool.m4 aclocal.m4 aminclude.am diff --git a/configure.ac b/configure.ac index 3aeedd6c6..be7de0567 100644 --- a/configure.ac +++ b/configure.ac @@ -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 "" diff --git a/cyassl/include.am b/cyassl/include.am index 688479545..0cd892a37 100644 --- a/cyassl/include.am +++ b/cyassl/include.am @@ -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 diff --git a/cyassl/options.h.in b/cyassl/options.h.in new file mode 100644 index 000000000..835a90bfb --- /dev/null +++ b/cyassl/options.h.in @@ -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 +