mirror of https://github.com/wolfSSL/wolfTPM.git
wolfTPM v1.0 TPM 2.0 support:
* Support for all TPM2 API's using TIS and SPI IO callback. * Helper for getting TPM return code string `TPM2_GetRCString`. * TPM 2.0 demo code in `examples/tpm/tpm2_demo.c` with support for STM32 CubeMX SPI as reference. Requires wolfSSL (https://github.com/wolfSSL/wolfssl/pull/1344)pull/2/head
parent
d222d710f0
commit
8bf8ae340f
|
@ -0,0 +1,23 @@
|
||||||
|
.metadata
|
||||||
|
language.settings.xml
|
||||||
|
src/config.h.in
|
||||||
|
autom4te.cache
|
||||||
|
build-aux
|
||||||
|
aclocal.m4
|
||||||
|
configure
|
||||||
|
Makefile.in
|
||||||
|
m4
|
||||||
|
aminclude.am
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
libtool
|
||||||
|
Makefile
|
||||||
|
wolftpm-config
|
||||||
|
.dirstamp
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
config.h
|
||||||
|
stamp-h1
|
||||||
|
test-suite.log
|
||||||
|
src/.deps
|
||||||
|
src/.libs
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactExtension="elf" artifactName="wolfSTM32" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668" name="Debug" parent="fr.ac6.managedbuild.config.gnu.cross.exe.debug" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin" && arm-none-eabi-size "${BuildArtifactFileName}"">
|
||||||
|
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668." name="/" resourcePath="">
|
||||||
|
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.226036042" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug">
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.prefix.2047016998" name="Prefix" superClass="fr.ac6.managedbuild.option.gnu.cross.prefix" useByScannerDiscovery="false" value="arm-none-eabi-" valueType="string"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.1283068435" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" useByScannerDiscovery="false" value="STM32F437IIHx" valueType="string"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.board.5714349" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" useByScannerDiscovery="false" value="STM32F437I-EVAL" valueType="string"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.instructionSet.930999276" name="Instruction Set" superClass="fr.ac6.managedbuild.option.gnu.cross.instructionSet" useByScannerDiscovery="false" value="fr.ac6.managedbuild.option.gnu.cross.instructionSet.thumbII" valueType="enumerated"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1751557462" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu" useByScannerDiscovery="false" value="fr.ac6.managedbuild.option.gnu.cross.fpu.fpv4-sp-d16" valueType="enumerated"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.792440355" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" useByScannerDiscovery="false" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.hard" valueType="enumerated"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.1069430525" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
|
||||||
|
<builder buildPath="${workspace_loc:/wolfSTM32}/Debug" id="fr.ac6.managedbuild.builder.gnu.cross.1280969041" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross">
|
||||||
|
<outputEntries>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Debug"/>
|
||||||
|
</outputEntries>
|
||||||
|
</builder>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.394079005" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
|
||||||
|
<option defaultValue="gnu.c.optimization.level.none" id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.2057150202" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.none" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.option.debugging.level.5592723" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.default" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.option.include.paths.468315258" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/STM32F4xx_HAL_Driver/Inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/CMSIS/Include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/CMSIS/Device/ST/STM32F4xx/Include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/FreeRTOS/Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/wolfSSL}""/>
|
||||||
|
</option>
|
||||||
|
<option id="gnu.c.compiler.option.preprocessor.def.symbols.440286125" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="__weak="__attribute__((weak))""/>
|
||||||
|
<listOptionValue builtIn="false" value="__packed="__attribute__((__packed__))""/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="STM32F437xx"/>
|
||||||
|
<listOptionValue builtIn="false" value="WOLFSSL_USER_SETTINGS"/>
|
||||||
|
</option>
|
||||||
|
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.misc.other.1827037366" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-fmessage-length=0" valueType="string"/>
|
||||||
|
<option id="gnu.c.compiler.option.dialect.std.621777790" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
|
||||||
|
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata.1859252267" name="Place the data in their own section (-fdata-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
<option id="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other.1549268976" name="Other flags" superClass="fr.ac6.managedbuid.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-fmessage-length=0" valueType="string"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.2064145507" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1145657513" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1188277793" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||||
|
<option id="gnu.cpp.compiler.option.optimization.level.1032925602" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||||
|
<option id="gnu.cpp.compiler.option.debugging.level.847199790" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1655358960" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker">
|
||||||
|
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.756563115" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="../STM32F437IIHx_FLASH.ld" valueType="string"/>
|
||||||
|
<option id="gnu.c.link.option.libs.463708451" name="Libraries (-l)" superClass="gnu.c.link.option.libs" useByScannerDiscovery="false" valueType="libs">
|
||||||
|
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="wolfssl"/>
|
||||||
|
</option>
|
||||||
|
<option id="gnu.c.link.option.paths.1810792623" name="Library search path (-L)" superClass="gnu.c.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
|
||||||
|
<listOptionValue builtIn="false" value="../../../../wolfssl"/>
|
||||||
|
</option>
|
||||||
|
<option id="gnu.c.link.option.ldflags.1972099648" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-specs=nosys.specs -specs=nano.specs -u _printf_float" valueType="string"/>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1992020074" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.131938104" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.1204074507" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.17061128" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
|
||||||
|
<option id="gnu.both.asm.option.include.paths.674794239" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/STM32F4xx_HAL_Driver/Inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/CMSIS/Include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Drivers/CMSIS/Device/ST/STM32F4xx/Include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/FreeRTOS/Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/wolfSTM32_CubeMX/Middlewares/Third_Party/wolfSSL}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2007353444" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1312743267" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668.1108777808" name="/" resourcePath="Middlewares/Third_Party/wolfSSL/examples/tpm">
|
||||||
|
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.1723313935" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug" unusedChildren="">
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.prefix.2047016998.1500281729" name="Prefix" superClass="fr.ac6.managedbuild.option.gnu.cross.prefix.2047016998"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.1283068435.1967838963" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu.1283068435"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.board.5714349.570776417" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board.5714349"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.instructionSet.930999276.910649936" name="Instruction Set" superClass="fr.ac6.managedbuild.option.gnu.cross.instructionSet.930999276"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1751557462.1334040427" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu.1751557462"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.792440355.2130494343" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi.792440355"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.1960690838" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.394079005">
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.404885961" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1167117093" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1395184602" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1188277793"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1366084504" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1655358960"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.80166520" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.131938104"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.377590478" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver.1204074507"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.1528844791" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.17061128">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.341974716" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.573390845" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668.733712790" name="/" resourcePath="Middlewares/Third_Party/wolfssl/wolfcrypt/src/port">
|
||||||
|
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug.2021852716" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.debug" unusedChildren="">
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.prefix.2047016998.1166192420" name="Prefix" superClass="fr.ac6.managedbuild.option.gnu.cross.prefix.2047016998"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.1283068435.1211244914" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu.1283068435"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.board.5714349.158166733" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board.5714349"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.instructionSet.930999276.1436948046" name="Instruction Set" superClass="fr.ac6.managedbuild.option.gnu.cross.instructionSet.930999276"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.fpu.1751557462.1391021569" name="Floating point hardware" superClass="fr.ac6.managedbuild.option.gnu.cross.fpu.1751557462"/>
|
||||||
|
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.792440355.696575466" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi.792440355"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.340471097" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.394079005">
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.161521245" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1909107086" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1563819916" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1188277793"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.140554620" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1655358960"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.1005722001" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.131938104"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.474443967" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver.1204074507"/>
|
||||||
|
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.1686595670" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.17061128">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.768594452" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1224776276" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry excluding="CMSIS/Device/ST/STM32F7xx|STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_timebase_tim_template.c|STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_timebase_rtc_alarm_template.c|STM32F7xx_HAL_Driver|STM32F4xx_StdPeriph_Driver|STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_timebase_rtc_wakeup_template.c|STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_msp_template.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Inc"/>
|
||||||
|
<entry excluding="Third_Party/wolfssl/x64|Third_Party/wolfssl/wrapper|Third_Party/wolfssl/tst.dSYM|Third_Party/wolfssl/tests|Third_Party/wolfssl/swig|Third_Party/wolfssl/support|Third_Party/wolfssl/sslSniffer|Third_Party/wolfssl/sign.dSYM|Third_Party/wolfssl/scripts|Third_Party/wolfssl/rpm|Third_Party/wolfssl/mqx|Third_Party/wolfssl/mplabx|Third_Party/wolfssl/mcapi|Third_Party/wolfssl/makecsr.dSYM|Third_Party/wolfssl/m4|Third_Party/wolfssl/lib|Third_Party/wolfssl/IPP|Third_Party/wolfssl/IDE|Third_Party/wolfssl/examples|Third_Party/wolfssl/doc|Third_Party/wolfssl/DLL Release|Third_Party/wolfssl/DLL Debug|Third_Party/wolfssl/Debug|Third_Party/wolfssl/cyassl|Third_Party/wolfssl/ctaocrypt|Third_Party/wolfssl/client.dSYM|Third_Party/wolfssl/certs|Third_Party/wolfssl/build-aux|Third_Party/wolfssl/autom4te.cache|Third_Party/wolfssl/testsuite|Third_Party/wolfssl/tirtos|Third_Party/wolfssl/wolfcrypt/src/aes_asm.s|Third_Party/wolfssl/wolfcrypt/src/aes_asm.asm|Third_Party/wolfssl/wolfcrypt/user-crypto|Third_Party/wolfMQTT/examples/aws|Third_Party/wolfMQTT|Third_Party/wolfSSL/mplabx|Third_Party/wolfSSL/IDE|Third_Party/wolfSSL/testsuite|Third_Party/wolfSSL/tests|Third_Party/wolfMQTT/examples/azure|Third_Party/wolfMQTT/examples/firmware|Third_Party/wolfSSL/wolfcrypt/src/aes_asm.s|Third_Party/wolfSSL/wolfcrypt/user-crypto|Third_Party/wolfSSL/sslSniffer|Third_Party/wolfMQTT/IDE|Third_Party/wolfSSL/mqx|Third_Party/wolfSSL/wolfcrypt/src/aes_asm.asm|Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7|Third_Party/wolfSSL/serialTest.c|Third_Party/wolfSSL/examples|Third_Party/wolfSSL/swig|Third_Party/wolfSSL/tirtos|Third_Party/wolfSSL/wolfcrypt/src/port|Third_Party/wolfSSL/mcapi" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares/Third_Party/wolfSSL/examples/tpm"/>
|
||||||
|
<entry excluding="stm32f7xx_it.c|main_f7.c|lwip.c|stm32f7xx_hal_msp.c|ethernetif.c|stm32f7xx_hal_timebase_TIM.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
<storageModule moduleId="ilg.gnumcueclipse.managedbuild.packs"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="wolfSTM32.fr.ac6.managedbuild.target.gnu.cross.exe.1782078835" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668;fr.ac6.managedbuild.config.gnu.cross.exe.debug.1337151668.;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.394079005;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.2064145507">
|
||||||
|
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<!--scannerConfigBuildInfo instanceId="fr.ac6.managedbuild.config.gnu.cross.exe.release.$(RELEASE_CONFIG_UID);fr.ac6.managedbuild.config.gnu.cross.exe.release.$(RELEASE_CONFIG_UID).;fr.ac6.managedbuild.tool.gnu.cross.c.compiler.$(RELEASE_TOOL_COMPILER_UID);cdt.managedbuild.tool.gnu.c.compiler.input.$(RELEASE_TOOL_COMPILER_INPUT_UID)">
|
||||||
|
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo-->
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
|
<configuration configurationName="Debug">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/wolfSTM32"/>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||||
|
</cproject>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>wolfSTM32_CubeMX</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
<nature>fr.ac6.mcu.ide.core.MCUProjectNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* wolftpm_example.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2017 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||||
|
*
|
||||||
|
* wolfTPM 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.
|
||||||
|
*
|
||||||
|
* wolfTPM 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WOLFTPM_EXAMPLE_H_
|
||||||
|
#define WOLFTPM_EXAMPLE_H_
|
||||||
|
|
||||||
|
#include <stm32f4xx_hal.h>
|
||||||
|
#include <stm32f4xx.h>
|
||||||
|
#include <cmsis_os.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_USER_SETTINGS
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
#include <wolfssl/ssl.h>
|
||||||
|
#include <wolfcrypt/test/test.h>
|
||||||
|
#include <wolfcrypt/benchmark/benchmark.h>
|
||||||
|
|
||||||
|
#include <wolftpm/tpm2.h>
|
||||||
|
|
||||||
|
void wolfTPMDemo(void const * argument);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* WOLFTPM_EXAMPLE_H_ */
|
|
@ -0,0 +1,27 @@
|
||||||
|
# wolfSSL STM32F2/F4 Example for Open STM32 Tools System Workbench
|
||||||
|
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* STM32CubeMX: STM32 CubeMX HAL code generation tool - [http://www.st.com/en/development-tools/stm32cubemx.html](http://www.st.com/en/development-tools/stm32cubemx.html)
|
||||||
|
* SystemWorkbench for STM32 - [http://www.st.com/en/development-tools/sw4stm32.html](http://www.st.com/en/development-tools/sw4stm32.html)
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
1. Using the STM32CubeMX tool, load the `<wolfssl-root>/IDE/OPENSTM32/wolfSTM32.ino` file.
|
||||||
|
2. Adjust the HAL options based on your specific micro-controller.
|
||||||
|
3. Generate source code.
|
||||||
|
4. Run `SystemWorkbench` and choose a new workspace location for this project.
|
||||||
|
5. Import `wolfSTM32' project from `<wolfssl-root>/IDE/OPENSTM32/`.
|
||||||
|
6. Adjust the micro-controller define in `Project Settings -> C/C++ General -> Paths and Symbols -> Symbols -> GNU C`. Example uses `STM32F437xx`, but should be changed to reflect your micro-controller type.
|
||||||
|
7. Build and Run
|
||||||
|
|
||||||
|
Note: You may need to manually copy over the CubeMX HAL files for `stm32f4xx_hal_cryp.c`, `stm32f4xx_hal_cryp_ex.c`, `stm32f4xx_hal_cryp.h`, `stm32f4xx_hal_cryp_ex.h`. Also uncomment the `#define HAL_CRYP_MODULE_ENABLED` line in `stm32f4xx_hal_conf.h`.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The settings for the wolfSTM32 project are located in `<wolfssl-root>/IDE/OPENSTM32/Inc/user_settings.h`.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
For questions please email [support@wolfssl.com](mailto:support@wolfssl.com)
|
|
@ -0,0 +1,361 @@
|
||||||
|
/* main.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2017 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||||
|
*
|
||||||
|
* wolfTPM 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.
|
||||||
|
*
|
||||||
|
* wolfTPM 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wolfssl_example.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
RNG_HandleTypeDef hrng;
|
||||||
|
RTC_HandleTypeDef hrtc;
|
||||||
|
SPI_HandleTypeDef hspi1;
|
||||||
|
UART_HandleTypeDef huart4;
|
||||||
|
CRYP_HandleTypeDef CrypHandle;
|
||||||
|
HASH_HandleTypeDef HashHandle;
|
||||||
|
|
||||||
|
osThreadId defaultTaskHandle;
|
||||||
|
|
||||||
|
int __errno;
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
static void SystemClock_Config(void);
|
||||||
|
static void Error_Handler(void);
|
||||||
|
|
||||||
|
static void MX_GPIO_Init(void);
|
||||||
|
|
||||||
|
static void MX_RNG_Init(void);
|
||||||
|
static void MX_RTC_Init(void);
|
||||||
|
static void MX_SPI1_Init(void);
|
||||||
|
static void MX_UART4_Init(void);
|
||||||
|
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
|
HAL_Init();
|
||||||
|
|
||||||
|
/* Configure the system clock */
|
||||||
|
SystemClock_Config();
|
||||||
|
|
||||||
|
/* Initialize all configured peripherals */
|
||||||
|
MX_GPIO_Init();
|
||||||
|
|
||||||
|
MX_RNG_Init();
|
||||||
|
MX_RTC_Init();
|
||||||
|
MX_SPI1_Init();
|
||||||
|
MX_UART4_Init();
|
||||||
|
|
||||||
|
#ifndef FREERTOS
|
||||||
|
wolfTPMDemo(NULL);
|
||||||
|
#else
|
||||||
|
/* Create the thread(s) */
|
||||||
|
/* definition and creation of defaultTask */
|
||||||
|
osThreadDef(defaultTask, wolfTPMDemo, osPriorityNormal, 0, 24000);
|
||||||
|
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
|
||||||
|
|
||||||
|
|
||||||
|
/* Start scheduler */
|
||||||
|
osKernelStart();
|
||||||
|
|
||||||
|
/* We should never get here as control is now taken by the scheduler */
|
||||||
|
|
||||||
|
/* Infinite loop */
|
||||||
|
while (1) {}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/** System Clock Configuration
|
||||||
|
*/
|
||||||
|
static void SystemClock_Config(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
|
||||||
|
|
||||||
|
__HAL_RCC_PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
|
||||||
|
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSE;
|
||||||
|
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||||
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
RCC_OscInitStruct.HSICalibrationValue = 16;
|
||||||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
||||||
|
RCC_OscInitStruct.PLL.PLLM = 8;
|
||||||
|
RCC_OscInitStruct.PLL.PLLN = 120;
|
||||||
|
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLQ = 5;
|
||||||
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||||
|
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||||
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||||
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||||
|
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
|
||||||
|
|
||||||
|
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
||||||
|
|
||||||
|
/* SysTick_IRQn interrupt configuration */
|
||||||
|
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RNG init function */
|
||||||
|
static void MX_RNG_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
hrng.Instance = RNG;
|
||||||
|
if (HAL_RNG_Init(&hrng) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RTC init function */
|
||||||
|
static void MX_RTC_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
RTC_TimeTypeDef sTime;
|
||||||
|
RTC_DateTypeDef sDate;
|
||||||
|
|
||||||
|
/**Initialize RTC and set the Time and Date
|
||||||
|
*/
|
||||||
|
hrtc.Instance = RTC;
|
||||||
|
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
|
||||||
|
hrtc.Init.AsynchPrediv = 127;
|
||||||
|
hrtc.Init.SynchPrediv = 255;
|
||||||
|
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
|
||||||
|
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
|
||||||
|
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
|
||||||
|
if (HAL_RTC_Init(&hrtc) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
sTime.Hours = 0x0;
|
||||||
|
sTime.Minutes = 0x0;
|
||||||
|
sTime.Seconds = 0x0;
|
||||||
|
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
|
||||||
|
sTime.StoreOperation = RTC_STOREOPERATION_RESET;
|
||||||
|
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
|
||||||
|
sDate.Month = RTC_MONTH_JANUARY;
|
||||||
|
sDate.Date = 0x1;
|
||||||
|
sDate.Year = 0x0;
|
||||||
|
|
||||||
|
/**Enable the reference Clock input
|
||||||
|
*/
|
||||||
|
if (HAL_RTCEx_SetRefClock(&hrtc) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**Enable the TimeStamp
|
||||||
|
*/
|
||||||
|
if (HAL_RTCEx_SetTimeStamp(&hrtc, RTC_TIMESTAMPEDGE_RISING, RTC_TIMESTAMPPIN_POS1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SPI1 init function */
|
||||||
|
static void MX_SPI1_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
hspi1.Instance = SPI1;
|
||||||
|
hspi1.Init.Mode = SPI_MODE_MASTER;
|
||||||
|
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
|
||||||
|
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
|
||||||
|
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||||
|
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||||
|
hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;
|
||||||
|
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64;
|
||||||
|
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
||||||
|
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
|
||||||
|
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||||
|
hspi1.Init.CRCPolynomial = 10;
|
||||||
|
if (HAL_SPI_Init(&hspi1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* UART4 init function */
|
||||||
|
static void MX_UART4_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
huart4.Instance = UART4;
|
||||||
|
huart4.Init.BaudRate = 115200;
|
||||||
|
huart4.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
|
huart4.Init.StopBits = UART_STOPBITS_1;
|
||||||
|
huart4.Init.Parity = UART_PARITY_NONE;
|
||||||
|
huart4.Init.Mode = UART_MODE_TX_RX;
|
||||||
|
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
|
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||||
|
if (HAL_UART_Init(&huart4) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn off buffers, so I/O occurs immediately
|
||||||
|
setvbuf(stdin, NULL, _IONBF, 0);
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
setvbuf(stderr, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _write (int fd, char *ptr, int len)
|
||||||
|
{
|
||||||
|
(void)fd;
|
||||||
|
|
||||||
|
/* Write "len" of char from "ptr" to file id "fd"
|
||||||
|
* Return number of char written.
|
||||||
|
* Need implementing with UART here. */
|
||||||
|
HAL_UART_Transmit(&huart4, (uint8_t *)ptr, len, 0xFFFF);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _read (int fd, char *ptr, int len)
|
||||||
|
{
|
||||||
|
/* Read "len" of char to "ptr" from file id "fd"
|
||||||
|
* Return number of char read.
|
||||||
|
* Need implementing with UART here. */
|
||||||
|
(void)fd;
|
||||||
|
|
||||||
|
return HAL_UART_Receive(&huart4, (uint8_t*)ptr, len, 0xFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _ttywrch(int ch) {
|
||||||
|
/* Write one char "ch" to the default console
|
||||||
|
* Need implementing with UART here. */
|
||||||
|
_write(0, (char*)&ch, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Configure pins as
|
||||||
|
* Analog
|
||||||
|
* Input
|
||||||
|
* Output
|
||||||
|
* EVENT_OUT
|
||||||
|
* EXTI
|
||||||
|
*/
|
||||||
|
static void MX_GPIO_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* GPIO Ports Clock Enable */
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Period elapsed callback in non blocking mode
|
||||||
|
* @note This function is called when TIM1 interrupt took place, inside
|
||||||
|
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
||||||
|
* a global variable "uwTick" used as application time base.
|
||||||
|
* @param htim : TIM handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||||
|
{
|
||||||
|
if (htim->Instance == TIM1) {
|
||||||
|
HAL_IncTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function is executed in case of error occurrence.
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void Error_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN Error_Handler */
|
||||||
|
/* User can add his own implementation to report the HAL error return state */
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE END Error_Handler */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reports the name of the source file and the source line number
|
||||||
|
* where the assert_param error has occurred.
|
||||||
|
* @param file: pointer to the source file name
|
||||||
|
* @param line: assert_param error line source number
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void assert_failed(uint8_t* file, uint32_t line)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN 6 */
|
||||||
|
/* User can add his own implementation to report the file name and line number,
|
||||||
|
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||||
|
/* USER CODE END 6 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,123 @@
|
||||||
|
/* wolftpm_example.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2017 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||||
|
*
|
||||||
|
* wolfTPM 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.
|
||||||
|
*
|
||||||
|
* wolfTPM 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "wolfssl_example.h"
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Private types/enumerations/variables
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* UART definitions */
|
||||||
|
extern UART_HandleTypeDef huart4;
|
||||||
|
extern SPI_HandleTypeDef hspi1;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WOLF_TPM2
|
||||||
|
extern int TPM2_Demo(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Public types/enumerations/variables
|
||||||
|
****************************************************************************/
|
||||||
|
typedef struct func_args {
|
||||||
|
int argc;
|
||||||
|
char** argv;
|
||||||
|
int return_code;
|
||||||
|
} func_args;
|
||||||
|
|
||||||
|
const char menu1[] = "\r\n"
|
||||||
|
"\tt. WolfCrypt Test\r\n"
|
||||||
|
"\tb. WolfCrypt Benchmark\r\n"
|
||||||
|
"\tm. WolfCrypt TPM 2.0 Test\r\n";
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Private functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Public functions
|
||||||
|
****************************************************************************/
|
||||||
|
void wolfCryptDemo(void const * argument)
|
||||||
|
{
|
||||||
|
uint8_t buffer[2];
|
||||||
|
func_args args;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
printf("\r\n\t\t\t\tMENU\r\n");
|
||||||
|
printf(menu1);
|
||||||
|
printf("Please select one of the above options: ");
|
||||||
|
|
||||||
|
HAL_UART_Receive(&huart4, buffer, sizeof(buffer), 5000);
|
||||||
|
|
||||||
|
switch (buffer[0]) {
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
memset(&args, 0, sizeof(args));
|
||||||
|
printf("\nCrypt Test\n");
|
||||||
|
wolfcrypt_test(&args);
|
||||||
|
printf("Crypt Test: Return code %d\n", args.return_code);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
memset(&args, 0, sizeof(args));
|
||||||
|
printf("\nBenchmark Test\n");
|
||||||
|
benchmark_test(&args);
|
||||||
|
printf("Benchmark Test: Return code %d\n", args.return_code);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
printf("\nTPM 2.0 Test\n");
|
||||||
|
#ifdef WOLF_TPM2
|
||||||
|
args.return_code = TPM2_Demo();
|
||||||
|
#endif
|
||||||
|
printf("TPM 2.0 Test: Return code %d\n", args.return_code);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// All other cases go here
|
||||||
|
default: printf("\r\nSelection out of range\r\n"); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern RTC_HandleTypeDef hrtc;
|
||||||
|
double current_time()
|
||||||
|
{
|
||||||
|
RTC_TimeTypeDef time;
|
||||||
|
RTC_DateTypeDef date;
|
||||||
|
uint32_t subsec;
|
||||||
|
|
||||||
|
/* must get time and date here due to STM32 HW bug */
|
||||||
|
HAL_RTC_GetTime(&hrtc, &time, FORMAT_BIN);
|
||||||
|
HAL_RTC_GetDate(&hrtc, &date, FORMAT_BIN);
|
||||||
|
subsec = (255 - time.SubSeconds) * 1000 / 255;
|
||||||
|
|
||||||
|
(void)date;
|
||||||
|
|
||||||
|
/* return seconds.milliseconds */
|
||||||
|
return ((double)time.Hours * 24) +
|
||||||
|
((double)time.Minutes * 60) +
|
||||||
|
(double)time.Seconds +
|
||||||
|
((double)subsec/1000);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# included from Top Level Makefile.am
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/README.md
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/.cproject
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/.project
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/wolfSTM32.cfg
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/wolfSTM32.ioc
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/wolfSTM32.xml
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/Src/main.c
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/Src/wolftpm_example.c
|
||||||
|
EXTRA_DIST+= IDE/OPENSTM32/Inc/wolftpm_example.h
|
|
@ -0,0 +1,13 @@
|
||||||
|
# This is an wolfSTM32 board with a single STM32F437IIHx chip.
|
||||||
|
# Generated by System Workbench for STM32
|
||||||
|
|
||||||
|
source [find interface/stlink-v2-1.cfg]
|
||||||
|
|
||||||
|
set WORKAREASIZE 0x30000
|
||||||
|
transport select "hla_jtag"
|
||||||
|
set CPUTAPID 0x4ba00477
|
||||||
|
|
||||||
|
source [find target/stm32f4x_stlink.cfg]
|
||||||
|
|
||||||
|
# use hardware reset, connect under reset
|
||||||
|
reset_config srst_only srst_nogate
|
|
@ -0,0 +1,213 @@
|
||||||
|
#MicroXplorer Configuration settings - do not modify
|
||||||
|
FREERTOS.IPParameters=Tasks01
|
||||||
|
FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default
|
||||||
|
File.Version=6
|
||||||
|
KeepUserPlacement=false
|
||||||
|
LWIP.Version=v1.5.0_RC0_20160211_Cube
|
||||||
|
Mcu.Family=STM32F4
|
||||||
|
Mcu.IP0=CRC
|
||||||
|
Mcu.IP1=ETH
|
||||||
|
Mcu.IP2=FREERTOS
|
||||||
|
Mcu.IP3=LWIP
|
||||||
|
Mcu.IP4=NVIC
|
||||||
|
Mcu.IP5=RCC
|
||||||
|
Mcu.IP6=RNG
|
||||||
|
Mcu.IP7=RTC
|
||||||
|
Mcu.IP8=SYS
|
||||||
|
Mcu.IP9=UART4
|
||||||
|
Mcu.IPNb=10
|
||||||
|
Mcu.Name=STM32F437I(G-I)Hx
|
||||||
|
Mcu.Package=UFBGA176
|
||||||
|
Mcu.Pin0=PE2
|
||||||
|
Mcu.Pin1=PG14
|
||||||
|
Mcu.Pin10=PC10
|
||||||
|
Mcu.Pin11=PC13
|
||||||
|
Mcu.Pin12=PC14/OSC32_IN
|
||||||
|
Mcu.Pin13=PC15/OSC32_OUT
|
||||||
|
Mcu.Pin14=PH2
|
||||||
|
Mcu.Pin15=PH0/OSC_IN
|
||||||
|
Mcu.Pin16=PH3
|
||||||
|
Mcu.Pin17=PH1/OSC_OUT
|
||||||
|
Mcu.Pin18=PC1
|
||||||
|
Mcu.Pin19=PC2
|
||||||
|
Mcu.Pin2=PG13
|
||||||
|
Mcu.Pin20=PC3
|
||||||
|
Mcu.Pin21=PH6
|
||||||
|
Mcu.Pin22=PA1
|
||||||
|
Mcu.Pin23=PC4
|
||||||
|
Mcu.Pin24=PH7
|
||||||
|
Mcu.Pin25=PA2
|
||||||
|
Mcu.Pin26=PC5
|
||||||
|
Mcu.Pin27=PA7
|
||||||
|
Mcu.Pin28=PB15
|
||||||
|
Mcu.Pin29=VP_CRC_VS_CRC
|
||||||
|
Mcu.Pin3=PB4
|
||||||
|
Mcu.Pin30=VP_FREERTOS_VS_ENABLE
|
||||||
|
Mcu.Pin31=VP_LWIP_VS_Enabled
|
||||||
|
Mcu.Pin32=VP_RNG_VS_RNG
|
||||||
|
Mcu.Pin33=VP_SYS_VS_tim1
|
||||||
|
Mcu.Pin4=PB3
|
||||||
|
Mcu.Pin5=PA15
|
||||||
|
Mcu.Pin6=PA14
|
||||||
|
Mcu.Pin7=PA13
|
||||||
|
Mcu.Pin8=PG11
|
||||||
|
Mcu.Pin9=PC11
|
||||||
|
Mcu.PinsNb=34
|
||||||
|
Mcu.UserConstants=
|
||||||
|
Mcu.UserName=STM32F437IIHx
|
||||||
|
MxCube.Version=4.16.1
|
||||||
|
MxDb.Version=DB.4.0.161
|
||||||
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.ETH_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true
|
||||||
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||||
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false
|
||||||
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true
|
||||||
|
NVIC.TIM1_UP_TIM10_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
NVIC.TimeBase=TIM1_UP_TIM10_IRQn
|
||||||
|
NVIC.TimeBaseIP=TIM1
|
||||||
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false
|
||||||
|
PA1.Mode=MII
|
||||||
|
PA1.Signal=ETH_RX_CLK
|
||||||
|
PA13.Mode=JTAG_5_pins
|
||||||
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
|
PA14.Mode=JTAG_5_pins
|
||||||
|
PA14.Signal=SYS_JTCK-SWCLK
|
||||||
|
PA15.Mode=JTAG_5_pins
|
||||||
|
PA15.Signal=SYS_JTDI
|
||||||
|
PA2.Mode=MII
|
||||||
|
PA2.Signal=ETH_MDIO
|
||||||
|
PA7.Mode=MII
|
||||||
|
PA7.Signal=ETH_RX_DV
|
||||||
|
PB15.Mode=Reference_Clock_Detection_Activate
|
||||||
|
PB15.Signal=RTC_REFIN
|
||||||
|
PB3.Mode=JTAG_5_pins
|
||||||
|
PB3.Signal=SYS_JTDO-SWO
|
||||||
|
PB4.Mode=JTAG_5_pins
|
||||||
|
PB4.Signal=SYS_JTRST
|
||||||
|
PC1.Mode=MII
|
||||||
|
PC1.Signal=ETH_MDC
|
||||||
|
PC10.Mode=Asynchronous
|
||||||
|
PC10.Signal=UART4_TX
|
||||||
|
PC11.Mode=Asynchronous
|
||||||
|
PC11.Signal=UART4_RX
|
||||||
|
PC13.Mode=Timestamp enabled - Input Enabled to AF1
|
||||||
|
PC13.Signal=RTC_AF1
|
||||||
|
PC14/OSC32_IN.Mode=LSE-External-Oscillator
|
||||||
|
PC14/OSC32_IN.Signal=RCC_OSC32_IN
|
||||||
|
PC15/OSC32_OUT.Mode=LSE-External-Oscillator
|
||||||
|
PC15/OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||||
|
PC2.Mode=MII
|
||||||
|
PC2.Signal=ETH_TXD2
|
||||||
|
PC3.Mode=MII
|
||||||
|
PC3.Signal=ETH_TX_CLK
|
||||||
|
PC4.Mode=MII
|
||||||
|
PC4.Signal=ETH_RXD0
|
||||||
|
PC5.Mode=MII
|
||||||
|
PC5.Signal=ETH_RXD1
|
||||||
|
PCC.Checker=false
|
||||||
|
PCC.Line=STM32F427/437
|
||||||
|
PCC.MCU=STM32F437I(G-I)Hx
|
||||||
|
PCC.MXVersion=4.16.1
|
||||||
|
PCC.PartNumber=STM32F437IIHx
|
||||||
|
PCC.Seq0=0
|
||||||
|
PCC.Series=STM32F4
|
||||||
|
PCC.Temperature=25
|
||||||
|
PCC.Vdd=null
|
||||||
|
PE2.Mode=MII
|
||||||
|
PE2.Signal=ETH_TXD3
|
||||||
|
PG11.Mode=MII
|
||||||
|
PG11.Signal=ETH_TX_EN
|
||||||
|
PG13.Mode=MII
|
||||||
|
PG13.Signal=ETH_TXD0
|
||||||
|
PG14.Mode=MII
|
||||||
|
PG14.Signal=ETH_TXD1
|
||||||
|
PH0/OSC_IN.Mode=HSE-External-Oscillator
|
||||||
|
PH0/OSC_IN.Signal=RCC_OSC_IN
|
||||||
|
PH1/OSC_OUT.Mode=HSE-External-Oscillator
|
||||||
|
PH1/OSC_OUT.Signal=RCC_OSC_OUT
|
||||||
|
PH2.Mode=MII
|
||||||
|
PH2.Signal=ETH_CRS
|
||||||
|
PH3.Mode=MII
|
||||||
|
PH3.Signal=ETH_COL
|
||||||
|
PH6.Mode=MII
|
||||||
|
PH6.Signal=ETH_RXD2
|
||||||
|
PH7.Mode=MII
|
||||||
|
PH7.Signal=ETH_RXD3
|
||||||
|
ProjectManager.AskForMigrate=true
|
||||||
|
ProjectManager.BackupPrevious=false
|
||||||
|
ProjectManager.CompilerOptimize=2
|
||||||
|
ProjectManager.ComputerToolchain=false
|
||||||
|
ProjectManager.CoupleFile=false
|
||||||
|
ProjectManager.DeletePrevious=true
|
||||||
|
ProjectManager.DeviceId=STM32F437IIHx
|
||||||
|
ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.13.0
|
||||||
|
ProjectManager.FreePins=false
|
||||||
|
ProjectManager.HalAssertFull=false
|
||||||
|
ProjectManager.HeapSize=0x10000
|
||||||
|
ProjectManager.KeepUserCode=true
|
||||||
|
ProjectManager.LastFirmware=true
|
||||||
|
ProjectManager.LibraryCopy=1
|
||||||
|
ProjectManager.PreviousToolchain=SW4STM32
|
||||||
|
ProjectManager.ProjectBuild=false
|
||||||
|
ProjectManager.ProjectFileName=wolfSTM32.ioc
|
||||||
|
ProjectManager.ProjectName=wolfSTM32
|
||||||
|
ProjectManager.StackSize=0x4000
|
||||||
|
ProjectManager.TargetToolchain=SW4STM32
|
||||||
|
ProjectManager.ToolChainLocation=
|
||||||
|
ProjectManager.UnderRoot=true
|
||||||
|
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false,2-MX_CRC_Init-CRC-false,3-MX_RNG_Init-RNG-false,4-MX_UART4_Init-UART4-false,5-MX_LWIP_Init-LWIP-false,6-MX_RTC_Init-RTC-false
|
||||||
|
RCC.48MHZClocksFreq_Value=48000000
|
||||||
|
RCC.AHBFreq_Value=120000000
|
||||||
|
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||||
|
RCC.APB1Freq_Value=30000000
|
||||||
|
RCC.APB1TimFreq_Value=60000000
|
||||||
|
RCC.APB2CLKDivider=RCC_HCLK_DIV2
|
||||||
|
RCC.APB2Freq_Value=60000000
|
||||||
|
RCC.APB2TimFreq_Value=120000000
|
||||||
|
RCC.CortexFreq_Value=120000000
|
||||||
|
RCC.EthernetFreq_Value=120000000
|
||||||
|
RCC.FCLKCortexFreq_Value=120000000
|
||||||
|
RCC.FamilyName=M
|
||||||
|
RCC.HCLKFreq_Value=120000000
|
||||||
|
RCC.HSE_VALUE=25000000
|
||||||
|
RCC.HSI_VALUE=16000000
|
||||||
|
RCC.I2SClocksFreq_Value=160000000
|
||||||
|
RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,PLLSourceVirtual,RCC_RTC_Clock_Source,RTCFreq_Value,RTCHSEDivFreq_Value,SAI_AClocksFreq_Value,SAI_BClocksFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAIOutputFreq_Value,VCOSAIOutputFreq_ValueQ,VcooutputI2S,VcooutputI2SQ
|
||||||
|
RCC.LSI_VALUE=32000
|
||||||
|
RCC.MCO2PinFreq_Value=120000000
|
||||||
|
RCC.PLLCLKFreq_Value=120000000
|
||||||
|
RCC.PLLM=15
|
||||||
|
RCC.PLLN=144
|
||||||
|
RCC.PLLQ=5
|
||||||
|
RCC.PLLQCLKFreq_Value=48000000
|
||||||
|
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||||
|
RCC.RCC_RTC_Clock_Source=RCC_RTCCLKSOURCE_LSE
|
||||||
|
RCC.RTCFreq_Value=32768
|
||||||
|
RCC.RTCHSEDivFreq_Value=12500000
|
||||||
|
RCC.SAI_AClocksFreq_Value=20416666.666666668
|
||||||
|
RCC.SAI_BClocksFreq_Value=20416666.666666668
|
||||||
|
RCC.SYSCLKFreq_VALUE=120000000
|
||||||
|
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||||
|
RCC.VCOI2SOutputFreq_Value=320000000
|
||||||
|
RCC.VCOInputFreq_Value=1666666.6666666667
|
||||||
|
RCC.VCOOutputFreq_Value=240000000
|
||||||
|
RCC.VCOSAIOutputFreq_Value=81666666.66666667
|
||||||
|
RCC.VCOSAIOutputFreq_ValueQ=20416666.666666668
|
||||||
|
RCC.VcooutputI2S=160000000
|
||||||
|
RCC.VcooutputI2SQ=160000000
|
||||||
|
VP_CRC_VS_CRC.Mode=CRC_Activate
|
||||||
|
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
||||||
|
VP_FREERTOS_VS_ENABLE.Mode=Enabled
|
||||||
|
VP_FREERTOS_VS_ENABLE.Signal=FREERTOS_VS_ENABLE
|
||||||
|
VP_LWIP_VS_Enabled.Mode=Enabled
|
||||||
|
VP_LWIP_VS_Enabled.Signal=LWIP_VS_Enabled
|
||||||
|
VP_RNG_VS_RNG.Mode=RNG_Activate
|
||||||
|
VP_RNG_VS_RNG.Signal=RNG_VS_RNG
|
||||||
|
VP_SYS_VS_tim1.Mode=TIM1
|
||||||
|
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
|
||||||
|
board=wolfSTM32
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<targetDefinitions xmlns="http://openstm32.org/stm32TargetDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openstm32.org/stm32TargetDefinitions stm32TargetDefinitions.xsd">
|
||||||
|
<board id="wolfstm32">
|
||||||
|
<name>wolfSTM32</name>
|
||||||
|
<mcuId>stm32f437iihx</mcuId>
|
||||||
|
<dbgIF>JTAG</dbgIF>
|
||||||
|
<dbgDEV>ST-LinkV2-1</dbgDEV>
|
||||||
|
</board>
|
||||||
|
</targetDefinitions>
|
|
@ -0,0 +1,5 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# included from Top Level Makefile.am
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
include IDE/OPENSTM32/include.am
|
|
@ -0,0 +1,102 @@
|
||||||
|
# includes append to these:
|
||||||
|
SUFFIXES =
|
||||||
|
TESTS =
|
||||||
|
CLEANFILES =
|
||||||
|
DISTCLEANFILES =
|
||||||
|
bin_PROGRAMS =
|
||||||
|
noinst_HEADERS =
|
||||||
|
lib_LTLIBRARIES =
|
||||||
|
man_MANS =
|
||||||
|
noinst_LTLIBRARIES =
|
||||||
|
noinst_PROGRAMS =
|
||||||
|
include_HEADERS =
|
||||||
|
nobase_include_HEADERS =
|
||||||
|
check_PROGRAMS =
|
||||||
|
EXTRA_HEADERS =
|
||||||
|
BUILT_SOURCES =
|
||||||
|
EXTRA_DIST =
|
||||||
|
noinst_SCRIPTS =
|
||||||
|
check_SCRIPTS =
|
||||||
|
dist_noinst_SCRIPTS =
|
||||||
|
dist_doc_DATA =
|
||||||
|
|
||||||
|
|
||||||
|
#includes additional rules from aminclude.am
|
||||||
|
@INC_AMINCLUDE@
|
||||||
|
DISTCLEANFILES+= aminclude.am
|
||||||
|
|
||||||
|
exampledir = $(docdir)/example
|
||||||
|
dist_example_DATA=
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS= -I m4
|
||||||
|
|
||||||
|
|
||||||
|
include src/include.am
|
||||||
|
include wolftpm/include.am
|
||||||
|
include examples/include.am
|
||||||
|
include IDE/include.am
|
||||||
|
|
||||||
|
EXTRA_DIST+= README.md
|
||||||
|
EXTRA_DIST+= LICENSE
|
||||||
|
EXTRA_DIST+= autogen.sh
|
||||||
|
|
||||||
|
TEST_EXTENSIONS=.test
|
||||||
|
TESTS += $(check_PROGRAMS)
|
||||||
|
|
||||||
|
check_SCRIPTS+= $(dist_noinst_SCRIPTS)
|
||||||
|
TESTS += $(check_SCRIPTS)
|
||||||
|
|
||||||
|
test: check
|
||||||
|
|
||||||
|
DISTCLEANFILES+= wolftpm-config
|
||||||
|
|
||||||
|
|
||||||
|
maintainer-clean-local:
|
||||||
|
-rm Makefile.in
|
||||||
|
-rm aclocal.m4
|
||||||
|
-rm build-aux/compile
|
||||||
|
-rm build-aux/config.guess
|
||||||
|
-rm build-aux/config.sub
|
||||||
|
-rm build-aux/depcomp
|
||||||
|
-rm build-aux/install-sh
|
||||||
|
-rm build-aux/ltmain.sh
|
||||||
|
-rm build-aux/missing
|
||||||
|
-rm wolftpm-config
|
||||||
|
-rmdir build-aux
|
||||||
|
-rm configure
|
||||||
|
-rm config.log
|
||||||
|
-rm config.status
|
||||||
|
-rm config.in
|
||||||
|
-rm m4/libtool.m4
|
||||||
|
-rm m4/ltoptions.m4
|
||||||
|
-rm m4/ltsugar.m4
|
||||||
|
-rm m4/ltversion.m4
|
||||||
|
-rm m4/lt~obsolete.m4
|
||||||
|
find . -type f -name '*~' -exec rm -f '{}' \;
|
||||||
|
-rm -f @PACKAGE@-*.tar.gz
|
||||||
|
-rm -f @PACKAGE@-*.rpm
|
||||||
|
|
||||||
|
# !!!! first line of rule has to start with a hard (real) tab, not spaces
|
||||||
|
egs:
|
||||||
|
$(MAKE) examples/mqttclient/mqttclient;
|
||||||
|
|
||||||
|
install-exec-local: install-generic-config
|
||||||
|
|
||||||
|
install-generic-config:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
$(INSTALL_SCRIPT) @GENERIC_CONFIG@ $(DESTDIR)$(bindir)
|
||||||
|
|
||||||
|
uninstall-local:
|
||||||
|
-rm -f $(DESTDIR)$(bindir)/@GENERIC_CONFIG@
|
||||||
|
|
||||||
|
merge-clean:
|
||||||
|
@find ./ | $(GREP) \.gcda | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.gcno | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.gz | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.orig | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.rej | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.rpm | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.THIS | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.OTHER | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \.BASE | xargs rm -f
|
||||||
|
@find ./ | $(GREP) \~$$ | xargs rm -f
|
162
README.md
162
README.md
|
@ -1,2 +1,160 @@
|
||||||
# wolfTPM
|
# wolfTPM (TPM 2.0)
|
||||||
wolfSSL TPM 2.0
|
|
||||||
|
This example demonstrates calling the various TPM 2.0 API's.
|
||||||
|
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
`./configure && make`
|
||||||
|
|
||||||
|
|
||||||
|
## Platform
|
||||||
|
|
||||||
|
This example was written for the STM32 with the CubeMX HAL. To add additional SPI hardware support insert your own interface call in `tpm2_demo.c` for the `TPM2_IoCb` function.
|
||||||
|
|
||||||
|
|
||||||
|
## Sample Output
|
||||||
|
|
||||||
|
```
|
||||||
|
MENU
|
||||||
|
t. WolfCrypt Test
|
||||||
|
b. WolfCrypt Benchmark
|
||||||
|
m. WolfCrypt TPM 2.0 Test
|
||||||
|
Please select one of the above options: m
|
||||||
|
|
||||||
|
TPM 2.0 Test
|
||||||
|
TPM2: Caps 0x30000697, Did 0x001b, Vid 0x15d1, Rid 0x10
|
||||||
|
TPM2_Startup pass
|
||||||
|
TPM2_SelfTest pass
|
||||||
|
TPM2_GetTestResult: Size 10, Rc 0x0
|
||||||
|
TPM2_IncrementalSelfTest: Rc 0x0, Alg 0x1 (Todo 0)
|
||||||
|
TPM2_GetCapability: Property FamilyIndicator 0x322e3000
|
||||||
|
TPM2_GetCapability: Property PCR Count 24
|
||||||
|
TPM2_GetRandom: Got 32 bytes
|
||||||
|
TPM2_PCR_Read: Index 0, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 1, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 2, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 3, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 4, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 5, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 6, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 7, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 8, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 9, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 10, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 11, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 12, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 13, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 14, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 15, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 16, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 17, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 18, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 19, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 20, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 21, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 22, Digest Sz 32, Update Counter 20
|
||||||
|
TPM2_PCR_Read: Index 23, Digest Sz 32, Update Counter 20
|
||||||
|
TPM 2.0 Test: Return code 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### With Debug Enabled:
|
||||||
|
|
||||||
|
```
|
||||||
|
MENU
|
||||||
|
t. WolfCrypt Test
|
||||||
|
b. WolfCrypt Benchmark
|
||||||
|
m. WolfCrypt TPM 2.0 Test
|
||||||
|
Please select one of the above options: m
|
||||||
|
|
||||||
|
Please select one of the above options:
|
||||||
|
TPM 2.0 Test
|
||||||
|
TPM2: Caps 0x30000697, Did 0x001b, Vid 0x15d1, Rid 0x10
|
||||||
|
TPM2_Startup pass
|
||||||
|
TPM2_SelfTest pass
|
||||||
|
TPM2_GetTestResult: Size 10, Rc 0x0
|
||||||
|
00 01 f9 db 00 00 00 00 00 00 | ..........
|
||||||
|
TPM2_IncrementalSelfTest: Rc 0x0, Alg 0x1 (Todo 0)
|
||||||
|
TPM2_GetCapability: Property FamilyIndicator 0x322e3000
|
||||||
|
TPM2_GetCapability: Property PCR Count 24
|
||||||
|
TPM2_GetRandom: Got 32 bytes
|
||||||
|
ab 37 21 9f 63 7b 16 3a 5f 99 c2 d3 3a 64 16 ea | .7!.c{.:_...:d..
|
||||||
|
b4 e8 5f 9e 93 f6 63 3b af da c6 a7 8a df 78 b2 | .._...c;......x.
|
||||||
|
TPM2_PCR_Read: Index 0, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 1, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 2, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 3, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 4, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 5, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 6, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 7, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 8, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 9, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 10, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 11, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 12, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 13, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 14, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 15, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 16, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 17, Digest Sz 32, Update Counter 20
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
TPM2_PCR_Read: Index 18, Digest Sz 32, Update Counter 20
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
TPM2_PCR_Read: Index 19, Digest Sz 32, Update Counter 20
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
TPM2_PCR_Read: Index 20, Digest Sz 32, Update Counter 20
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
TPM2_PCR_Read: Index 21, Digest Sz 32, Update Counter 20
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
TPM2_PCR_Read: Index 22, Digest Sz 32, Update Counter 20
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................
|
||||||
|
TPM2_PCR_Read: Index 23, Digest Sz 32, Update Counter 20
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
|
||||||
|
TPM2_PCR_Read: Index 0, Digest Sz 32, Update Counter 21
|
||||||
|
bb 22 75 c4 9f 28 ad 52 ca e6 d5 5e 34 a9 74 a5 | ."u..(.R...^4.t.
|
||||||
|
8c 7a 3b a2 6f 97 6e 8e cb be 7a 53 69 18 dc 73 | .z;.o.n...zSi..s
|
||||||
|
TPM 2.0 Test: Return code 0
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Create configure and makefile stuff...
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 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 get an error about libtool not setup
|
||||||
|
# " error: Libtool library used but 'LIBTOOL' is undefined
|
||||||
|
# The usual way to define 'LIBTOOL' is to add 'LT_INIT' "
|
||||||
|
# manually call libtoolize or glibtoolize before running this again
|
||||||
|
# (g)libtoolize
|
||||||
|
|
||||||
|
# if you get an error about config.rpath missing, some buggy automake versions
|
||||||
|
# then touch the missing file (may need to make config/ first).
|
||||||
|
# touch config/config.rpath
|
||||||
|
# touch config.rpath
|
||||||
|
|
||||||
|
if test ! -d build-aux; then
|
||||||
|
echo "Making missing build-aux directory."
|
||||||
|
mkdir -p build-aux
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test ! -f build-aux/config.rpath; then
|
||||||
|
echo "Touching missing build-aux/config.rpath file."
|
||||||
|
touch build-aux/config.rpath
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# If this is a source checkout then call autoreconf with error as well
|
||||||
|
if test -d .git; then
|
||||||
|
WARNINGS="all,error"
|
||||||
|
else
|
||||||
|
WARNINGS="all"
|
||||||
|
fi
|
||||||
|
|
||||||
|
autoreconf --install --force --verbose
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#commit-tests.sh
|
||||||
|
|
||||||
|
|
||||||
|
# make sure current config is ok
|
||||||
|
echo -e "\n\nTesting current config...\n\n"
|
||||||
|
make clean; make -j 8 test;
|
||||||
|
RESULT=$?
|
||||||
|
[ $RESULT -ne 0 ] && echo -e "\n\nCurrent config make test failed" && exit 1
|
||||||
|
|
||||||
|
|
||||||
|
# make sure basic config is ok
|
||||||
|
echo -e "\n\nTesting no TLS config too...\n\n"
|
||||||
|
./configure;
|
||||||
|
RESULT=$?
|
||||||
|
[ $RESULT -ne 0 ] && echo -e "\n\nTest './configure' failed" && exit 1
|
||||||
|
|
||||||
|
make -j 8 test;
|
||||||
|
RESULT=$?
|
||||||
|
[ $RESULT -ne 0 ] && echo -e "\n\nTest './configure' make test failed " && exit 1
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,143 @@
|
||||||
|
# wolftpm
|
||||||
|
# Copyright (C) 2016 wolfSSL Inc.
|
||||||
|
# All right reserved.
|
||||||
|
|
||||||
|
AC_INIT([wolftpm],[0.1.0],[https://github.com/wolfssl/wolfTPM/issues],[wolftpm],[http://www.wolfssl.com])
|
||||||
|
|
||||||
|
AC_PREREQ([2.63])
|
||||||
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
|
||||||
|
: ${CFLAGS=""}
|
||||||
|
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
AC_CANONICAL_BUILD
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
|
||||||
|
|
||||||
|
AC_ARG_PROGRAM
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
AC_CONFIG_HEADERS([src/config.h])
|
||||||
|
|
||||||
|
WOLFMQTT_LIBRARY_VERSION=1:0:0
|
||||||
|
# | | |
|
||||||
|
# +------+ | +---+
|
||||||
|
# | | |
|
||||||
|
# current:revision:age
|
||||||
|
# | | |
|
||||||
|
# | | +- increment if interfaces have been added
|
||||||
|
# | | set to zero if interfaces have been removed
|
||||||
|
# | | or changed
|
||||||
|
# | +- increment if source code has changed
|
||||||
|
# | set to zero if current is incremented
|
||||||
|
# +- increment if interfaces have been added, removed or changed
|
||||||
|
AC_SUBST([WOLFMQTT_LIBRARY_VERSION])
|
||||||
|
|
||||||
|
LT_PREREQ([2.2])
|
||||||
|
LT_INIT([disable-static], [win32-dll])
|
||||||
|
LT_LANG([C])
|
||||||
|
|
||||||
|
gl_VISIBILITY
|
||||||
|
AS_IF([test -n "$CFLAG_VISIBILITY"],
|
||||||
|
[AM_CPPFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
|
||||||
|
CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"])
|
||||||
|
|
||||||
|
# silent
|
||||||
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
AM_PROG_CC_C_O
|
||||||
|
AC_PROG_CC_C_O
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
# Checks for header files.
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_CHECK_SIZEOF([long long], 8)
|
||||||
|
AC_CHECK_SIZEOF([long], 4)
|
||||||
|
|
||||||
|
# Check headers/libs
|
||||||
|
AC_CHECK_FUNCS([gethostbyname])
|
||||||
|
AC_CHECK_FUNCS([getaddrinfo])
|
||||||
|
AC_CHECK_FUNCS([gettimeofday])
|
||||||
|
AC_CHECK_FUNCS([inet_ntoa])
|
||||||
|
AC_CHECK_FUNCS([memset])
|
||||||
|
AC_CHECK_FUNCS([socket])
|
||||||
|
AC_CHECK_FUNCS([signal])
|
||||||
|
AC_CHECK_LIB(network,socket)
|
||||||
|
|
||||||
|
# DEBUG
|
||||||
|
DEBUG_CFLAGS="-g -O0"
|
||||||
|
DEBUG_CPPFLAGS="-DDEBUG -DDEBUG_WOLFMQTT"
|
||||||
|
|
||||||
|
AX_DEBUG
|
||||||
|
AS_IF([test "x$ax_enable_debug" = "xyes"],
|
||||||
|
[AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"
|
||||||
|
AM_CPPFLAGS="$DEBUG_CPPFLAGS $AM_CPPFLAGS"],
|
||||||
|
[AM_CFLAGS="$AM_CFLAGS -O2"
|
||||||
|
AM_CPPFLAGS="-DNDEBUG $AM_CFLAGS"])
|
||||||
|
|
||||||
|
AX_PTHREAD([AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"])
|
||||||
|
|
||||||
|
|
||||||
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
if test "$ac_cv_sizeof_long" = "8"; then
|
||||||
|
AM_CPPFLAGS="$AM_CPPFLAGS -DSIZEOF_LONG=8"
|
||||||
|
else
|
||||||
|
if test "$ac_cv_sizeof_long_long" = "8"; then
|
||||||
|
AM_CPPFLAGS="$AM_CPPFLAGS -DSIZEOF_LONG_LONG=8"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
TAO_REQUIRE_LIBWOLFSSL
|
||||||
|
AM_CPPFLAGS="$AM_CPPFLAGS -DDHAVE_WOLFSSL_OPTIONS -DHAVE_CYASSL_OPTIONS"
|
||||||
|
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
AC_ARG_ENABLE([examples],
|
||||||
|
[ --enable-examples Enable Examples (default: enabled)],
|
||||||
|
[ ENABLED_EXAMPLES=$enableval ],
|
||||||
|
[ ENABLED_EXAMPLES=yes ]
|
||||||
|
)
|
||||||
|
|
||||||
|
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
|
||||||
|
|
||||||
|
|
||||||
|
# HARDEN FLAGS
|
||||||
|
AX_HARDEN_CC_COMPILER_FLAGS
|
||||||
|
|
||||||
|
CREATE_HEX_VERSION
|
||||||
|
AC_SUBST([AM_CPPFLAGS])
|
||||||
|
AC_SUBST([AM_CFLAGS])
|
||||||
|
AC_SUBST([AM_LDFLAGS])
|
||||||
|
|
||||||
|
# FINAL
|
||||||
|
AC_CONFIG_FILES([Makefile])
|
||||||
|
AC_CONFIG_FILES([wolftpm/version.h])
|
||||||
|
|
||||||
|
AX_CREATE_GENERIC_CONFIG
|
||||||
|
AX_AM_JOBSERVER([yes])
|
||||||
|
|
||||||
|
AC_OUTPUT
|
||||||
|
|
||||||
|
# force make clean
|
||||||
|
echo "---"
|
||||||
|
echo "Running make clean..."
|
||||||
|
make clean >/dev/null 2>&1
|
||||||
|
echo
|
||||||
|
|
||||||
|
# output config summary
|
||||||
|
echo "---"
|
||||||
|
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
|
||||||
|
echo ""
|
||||||
|
echo " * Installation prefix: $prefix"
|
||||||
|
echo " * System type: $host_vendor-$host_os"
|
||||||
|
echo " * Host CPU: $host_cpu"
|
||||||
|
echo " * C Compiler: $CC"
|
||||||
|
echo " * C Flags: $CFLAGS"
|
||||||
|
echo " * CPP Flags: $CPPFLAGS"
|
||||||
|
echo " * Linker Flags: $LDFLAGS"
|
||||||
|
echo " * LIB Flags: $LIB"
|
||||||
|
|
||||||
|
echo " * Examples: $ENABLED_EXAMPLES"
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
include examples/tpm/include.am
|
|
@ -0,0 +1,4 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
EXTRA_DIST+= examples/tpm/tpm2_demo.c
|
|
@ -0,0 +1,264 @@
|
||||||
|
/* tpm2_demo.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2017 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||||
|
*
|
||||||
|
* wolfTPM 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.
|
||||||
|
*
|
||||||
|
* wolfTPM 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_USER_SETTINGS
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
#include <wolfssl/wolfcrypt/tpm2.h>
|
||||||
|
#include <wolfssl/wolfcrypt/logging.h>
|
||||||
|
|
||||||
|
/* Local variables */
|
||||||
|
static TPM2_CTX gTpm2Ctx;
|
||||||
|
#ifdef WOLFSSL_STM32_CUBEMX
|
||||||
|
extern SPI_HandleTypeDef hspi1;
|
||||||
|
#define TPM2_USER_CTX &hspi1
|
||||||
|
#else
|
||||||
|
#define TPM2_USER_CTX NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* IO Callback */
|
||||||
|
static TPM_RC TPM2_IoCb(TPM2_CTX* ctx, const byte* txBuf, byte* rxBuf,
|
||||||
|
word16 xferSz, void* userCtx)
|
||||||
|
{
|
||||||
|
#ifdef WOLFSSL_STM32_CUBEMX
|
||||||
|
SPI_HandleTypeDef* hspi = (SPI_HandleTypeDef*)userCtx;
|
||||||
|
HAL_StatusTypeDef status;
|
||||||
|
|
||||||
|
__HAL_SPI_ENABLE(hspi);
|
||||||
|
status = HAL_SPI_TransmitReceive(hspi, (byte*)txBuf, rxBuf, xferSz, 5000);
|
||||||
|
__HAL_SPI_DISABLE(hspi);
|
||||||
|
if (status == HAL_OK)
|
||||||
|
return TPM_RC_SUCCESS;
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* TODO: Add your platform here for HW interface */
|
||||||
|
(void)ctx;
|
||||||
|
(void)txBuf;
|
||||||
|
(void)rxBuf;
|
||||||
|
(void)xferSz;
|
||||||
|
(void)userCtx;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
return TPM_RC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RAND_GET_SZ 32
|
||||||
|
|
||||||
|
int TPM2_Demo(void)
|
||||||
|
{
|
||||||
|
TPM_RC rc;
|
||||||
|
union {
|
||||||
|
Startup_In startup;
|
||||||
|
Shutdown_In shutdown;
|
||||||
|
SelfTest_In selfTest;
|
||||||
|
GetRandom_In getRand;
|
||||||
|
GetCapability_In cap;
|
||||||
|
IncrementalSelfTest_In incSelfTest;
|
||||||
|
PCR_Read_In pcrRead;
|
||||||
|
PCR_Extend_In pcrExtend;
|
||||||
|
CreatePrimary_In create;
|
||||||
|
EvictControl_In evict;
|
||||||
|
ReadPublic_In readPub;
|
||||||
|
StartAuthSession_In authSes;
|
||||||
|
Load_In load;
|
||||||
|
FlushContext_In flushCtx;
|
||||||
|
Unseal_In unseal;
|
||||||
|
byte maxInput[MAX_COMMAND_SIZE];
|
||||||
|
} cmdIn;
|
||||||
|
union {
|
||||||
|
GetCapability_Out cap;
|
||||||
|
GetRandom_Out getRand;
|
||||||
|
GetTestResult_Out tr;
|
||||||
|
IncrementalSelfTest_Out incSelfTest;
|
||||||
|
PCR_Read_Out pcrRead;
|
||||||
|
CreatePrimary_Out create;
|
||||||
|
ReadPublic_Out readPub;
|
||||||
|
StartAuthSession_Out authSes;
|
||||||
|
Load_Out load;
|
||||||
|
Unseal_Out unseal;
|
||||||
|
byte maxOutput[MAX_RESPONSE_SIZE];
|
||||||
|
} cmdOut;
|
||||||
|
int pcrCount, pcrIndex, i;
|
||||||
|
TPML_TAGGED_TPM_PROPERTY* tpmProp;
|
||||||
|
TPM_HANDLE ek;
|
||||||
|
|
||||||
|
#ifdef DEBUG_WOLFSSL
|
||||||
|
wolfSSL_Debugging_ON();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
rc = TPM2_Init(&gTpm2Ctx, TPM2_IoCb, TPM2_USER_CTX);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_Init failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cmdIn.startup.startupType = TPM_SU_CLEAR;
|
||||||
|
rc = TPM2_Startup(&cmdIn.startup);
|
||||||
|
if (rc != TPM_RC_SUCCESS &&
|
||||||
|
rc != TPM_RC_INITIALIZE /* TPM_RC_INITIALIZE = Already started */ ) {
|
||||||
|
printf("TPM2_Startup failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
printf("TPM2_Startup pass\n");
|
||||||
|
|
||||||
|
|
||||||
|
/* Full self test */
|
||||||
|
cmdIn.selfTest.fullTest = YES;
|
||||||
|
rc = TPM2_SelfTest(&cmdIn.selfTest);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_SelfTest failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
printf("TPM2_SelfTest pass\n");
|
||||||
|
|
||||||
|
/* Get Test Result */
|
||||||
|
rc = TPM2_GetTestResult(&cmdOut.tr);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_GetTestResult failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
printf("TPM2_GetTestResult: Size %d, Rc 0x%x\n", cmdOut.tr.outData.size,
|
||||||
|
cmdOut.tr.testResult);
|
||||||
|
WOLFSSL_BUFFER(cmdOut.tr.outData.buffer, cmdOut.tr.outData.size);
|
||||||
|
|
||||||
|
/* Incremental Test */
|
||||||
|
cmdIn.incSelfTest.toTest.count = 1;
|
||||||
|
cmdIn.incSelfTest.toTest.algorithms[0] = TPM_ALG_RSA;
|
||||||
|
rc = TPM2_IncrementalSelfTest(&cmdIn.incSelfTest, &cmdOut.incSelfTest);
|
||||||
|
printf("TPM2_IncrementalSelfTest: Rc 0x%x, Alg 0x%x (Todo %d)\n",
|
||||||
|
rc, cmdIn.incSelfTest.toTest.algorithms[0],
|
||||||
|
(int)cmdOut.incSelfTest.toDoList.count);
|
||||||
|
|
||||||
|
|
||||||
|
/* Get Capability for Property */
|
||||||
|
cmdIn.cap.capability = TPM_CAP_TPM_PROPERTIES;
|
||||||
|
cmdIn.cap.property = TPM_PT_FAMILY_INDICATOR;
|
||||||
|
cmdIn.cap.propertyCount = 1;
|
||||||
|
rc = TPM2_GetCapability(&cmdIn.cap, &cmdOut.cap);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_GetCapability failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
tpmProp = &cmdOut.cap.capabilityData.data.tpmProperties;
|
||||||
|
printf("TPM2_GetCapability: Property FamilyIndicator 0x%08x\n",
|
||||||
|
(unsigned int)tpmProp->tpmProperty[0].value);
|
||||||
|
|
||||||
|
cmdIn.cap.capability = TPM_CAP_TPM_PROPERTIES;
|
||||||
|
cmdIn.cap.property = TPM_PT_PCR_COUNT;
|
||||||
|
cmdIn.cap.propertyCount = 1;
|
||||||
|
rc = TPM2_GetCapability(&cmdIn.cap, &cmdOut.cap);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_GetCapability failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
tpmProp = &cmdOut.cap.capabilityData.data.tpmProperties;
|
||||||
|
pcrCount = tpmProp->tpmProperty[0].value;
|
||||||
|
printf("TPM2_GetCapability: Property PCR Count %d\n", pcrCount);
|
||||||
|
|
||||||
|
|
||||||
|
/* Random */
|
||||||
|
cmdIn.getRand.bytesRequested = RAND_GET_SZ;
|
||||||
|
rc = TPM2_GetRandom(&cmdIn.getRand, &cmdOut.getRand);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_GetRandom failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
if (cmdOut.getRand.randomBytes.size != RAND_GET_SZ) {
|
||||||
|
printf("TPM2_GetRandom length mismatch %d != %d\n",
|
||||||
|
cmdOut.getRand.randomBytes.size, RAND_GET_SZ);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
printf("TPM2_GetRandom: Got %d bytes\n", cmdOut.getRand.randomBytes.size);
|
||||||
|
WOLFSSL_BUFFER(cmdOut.getRand.randomBytes.buffer,
|
||||||
|
cmdOut.getRand.randomBytes.size);
|
||||||
|
|
||||||
|
|
||||||
|
/* PCR Read */
|
||||||
|
for (i=0; i<pcrCount; i++) {
|
||||||
|
pcrIndex = i;
|
||||||
|
TPM2_SetupPCRSel(&cmdIn.pcrRead.pcrSelectionIn, TPM_ALG_SHA256, pcrIndex);
|
||||||
|
rc = TPM2_PCR_Read(&cmdIn.pcrRead, &cmdOut.pcrRead);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_PCR_Read failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
printf("TPM2_PCR_Read: Index %d, Digest Sz %d, Update Counter %d\n",
|
||||||
|
pcrIndex,
|
||||||
|
(int)cmdOut.pcrRead.pcrValues.digests[0].size,
|
||||||
|
(int)cmdOut.pcrRead.pcrUpdateCounter);
|
||||||
|
WOLFSSL_BUFFER(cmdOut.pcrRead.pcrValues.digests[0].buffer,
|
||||||
|
cmdOut.pcrRead.pcrValues.digests[0].size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PCR Extend and Verify */
|
||||||
|
pcrIndex = 0;
|
||||||
|
XMEMSET(&cmdIn.pcrExtend, 0, sizeof(cmdIn.pcrExtend));
|
||||||
|
cmdIn.pcrExtend.pcrHandle = pcrIndex;
|
||||||
|
cmdIn.pcrExtend.auth.sessionHandle = TPM_RS_PW;
|
||||||
|
cmdIn.pcrExtend.digests.count = 1;
|
||||||
|
cmdIn.pcrExtend.digests.digests[0].hashAlg = TPM_ALG_SHA256;
|
||||||
|
for (i=0; i<WC_SHA256_DIGEST_SIZE; i++) {
|
||||||
|
cmdIn.pcrExtend.digests.digests[0].digest.H[i] = i;
|
||||||
|
}
|
||||||
|
rc = TPM2_PCR_Extend(&cmdIn.pcrExtend);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_PCR_Extend failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
TPM2_SetupPCRSel(&cmdIn.pcrRead.pcrSelectionIn, TPM_ALG_SHA256, pcrIndex);
|
||||||
|
rc = TPM2_PCR_Read(&cmdIn.pcrRead, &cmdOut.pcrRead);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_PCR_Read failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
printf("TPM2_PCR_Read: Index %d, Digest Sz %d, Update Counter %d\n",
|
||||||
|
pcrIndex,
|
||||||
|
(int)cmdOut.pcrRead.pcrValues.digests[0].size,
|
||||||
|
(int)cmdOut.pcrRead.pcrUpdateCounter);
|
||||||
|
WOLFSSL_BUFFER(cmdOut.pcrRead.pcrValues.digests[0].buffer,
|
||||||
|
cmdOut.pcrRead.pcrValues.digests[0].size);
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO: Add tests for API's */
|
||||||
|
//rc = TPM2_StartAuthSession(&cmdIn.authSes, &cmdOut.authSes);
|
||||||
|
//rc = TPM2_CreatePrimary(&cmdIn.create, &cmdOut.create);
|
||||||
|
//rc = TPM2_ReadPublic(&cmdIn.readPub, &cmdOut.readPub);
|
||||||
|
//TPM_RC TPM2_Load(Load_In* in, Load_Out* out);
|
||||||
|
//TPM_RC TPM2_FlushContext(FlushContext_In* in);
|
||||||
|
//TPM_RC TPM2_Unseal(Unseal_In* in, Unseal_Out* out);
|
||||||
|
|
||||||
|
|
||||||
|
/* Shutdown */
|
||||||
|
cmdIn.shutdown.shutdownType = TPM_SU_CLEAR;
|
||||||
|
rc = TPM2_Shutdown(&cmdIn.shutdown);
|
||||||
|
if (rc != TPM_RC_SUCCESS) {
|
||||||
|
printf("TPM2_Shutdown failed %d: %s\n", rc, TPM2_GetRCString(rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_add_am_macro.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_ADD_AM_MACRO([RULE])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Adds the specified rule to $AMINCLUDE. This macro will only work
|
||||||
|
# properly with implementations of Make which allow include statements.
|
||||||
|
# See also AX_ADD_AM_MACRO_STATIC.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Tom Howard <tomhoward@users.sf.net>
|
||||||
|
#
|
||||||
|
# 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 9
|
||||||
|
|
||||||
|
AC_DEFUN([AX_ADD_AM_MACRO],[
|
||||||
|
AC_REQUIRE([AX_AM_MACROS])
|
||||||
|
AX_APPEND_TO_FILE([$AMINCLUDE],[$1])
|
||||||
|
])
|
|
@ -0,0 +1,55 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_am_jobserver.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_AM_JOBSERVER([default_value])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Enables the use of make's jobserver for the purpose of parallel building
|
||||||
|
# by passing the -j option to make.
|
||||||
|
#
|
||||||
|
# The option --enable-jobserver is added to configure which can accept a
|
||||||
|
# yes, no, or an integer. The integer is the number of separate jobs to
|
||||||
|
# allow. If 'yes' is given, then the is assumed to be one more than the
|
||||||
|
# number of CPUs (determined through AX_COUNT_CPUS). If the value of no is
|
||||||
|
# given, then the jobserver is disabled. The default value is given by the
|
||||||
|
# first argument of the macro, or 'yes' if the argument is omitted.
|
||||||
|
#
|
||||||
|
# This macro makes use of AX_AM_MACROS, so you must add the following line
|
||||||
|
#
|
||||||
|
# @INC_AMINCLUDE@
|
||||||
|
#
|
||||||
|
# to your Makefile.am files.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Michael Paul Bailey <jinxidoru@byu.net>
|
||||||
|
#
|
||||||
|
# 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_AM_JOBSERVER], [
|
||||||
|
AC_REQUIRE([AX_COUNT_CPUS])
|
||||||
|
AC_REQUIRE([AX_AM_MACROS])
|
||||||
|
AC_ARG_ENABLE( jobserver,
|
||||||
|
[ --enable-jobserver@<:@=no/yes/@%:@@:>@ default=m4_ifval([$1],[$1],[yes])
|
||||||
|
Enable up to @%:@ make jobs
|
||||||
|
yes: enable one more than CPU count
|
||||||
|
],, [enable_jobserver=m4_ifval([$1],[$1],[yes])])
|
||||||
|
if test "x$enable_jobserver" = "xyes"; then
|
||||||
|
enable_jobserver=$CPU_COUNT
|
||||||
|
((enable_jobserver++))
|
||||||
|
fi
|
||||||
|
m4_pattern_allow(AM_MAKEFLAGS)
|
||||||
|
if test "x$enable_jobserver" != "xno"; then
|
||||||
|
AC_MSG_NOTICE([added jobserver support to make for $enable_jobserver jobs])
|
||||||
|
AX_ADD_AM_MACRO( AM_MAKEFLAGS += -j$enable_jobserver )
|
||||||
|
fi
|
||||||
|
])
|
|
@ -0,0 +1,44 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_am_macros.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_AM_MACROS
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Adds support for macros that create Make rules. You must manually add
|
||||||
|
# the following line
|
||||||
|
#
|
||||||
|
# @INC_AMINCLUDE@
|
||||||
|
#
|
||||||
|
# to your Makefile.in (or Makefile.am if you use Automake) files.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Tom Howard <tomhoward@users.sf.net>
|
||||||
|
#
|
||||||
|
# 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 9
|
||||||
|
|
||||||
|
AC_DEFUN([AX_AM_MACROS],
|
||||||
|
[
|
||||||
|
AC_MSG_NOTICE([adding automake macro support])
|
||||||
|
AMINCLUDE="aminclude.am"
|
||||||
|
AC_SUBST(AMINCLUDE)
|
||||||
|
AC_MSG_NOTICE([creating $AMINCLUDE])
|
||||||
|
AMINCLUDE_TIME=`date`
|
||||||
|
AX_PRINT_TO_FILE([$AMINCLUDE],[[
|
||||||
|
# generated automatically by configure from AX_AUTOMAKE_MACROS
|
||||||
|
# on $AMINCLUDE_TIME
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
INC_AMINCLUDE="include \$(top_builddir)/$AMINCLUDE"
|
||||||
|
AC_SUBST(INC_AMINCLUDE)
|
||||||
|
])
|
|
@ -0,0 +1,65 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
|
||||||
|
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||||
|
#
|
||||||
|
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||||
|
# CFLAGS) is used. During the check the flag is always added to the
|
||||||
|
# current language's flags.
|
||||||
|
#
|
||||||
|
# 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: This macro depends on the AX_APPEND_FLAG and
|
||||||
|
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
|
||||||
|
# AX_APPEND_LINK_FLAGS.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# 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 3
|
||||||
|
|
||||||
|
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
|
||||||
|
[AC_REQUIRE([AX_CHECK_COMPILE_FLAG])
|
||||||
|
AC_REQUIRE([AX_APPEND_FLAG])
|
||||||
|
for flag in $1; do
|
||||||
|
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
|
||||||
|
done
|
||||||
|
])dnl AX_APPEND_COMPILE_FLAGS
|
|
@ -0,0 +1,69 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
|
||||||
|
# added in between.
|
||||||
|
#
|
||||||
|
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||||
|
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
|
||||||
|
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
|
||||||
|
# FLAG.
|
||||||
|
#
|
||||||
|
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
|
||||||
|
#
|
||||||
|
# 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_APPEND_FLAG],
|
||||||
|
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
|
||||||
|
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
|
||||||
|
AS_VAR_SET_IF(FLAGS,
|
||||||
|
[case " AS_VAR_GET(FLAGS) " in
|
||||||
|
*" $1 "*)
|
||||||
|
AC_RUN_LOG([: FLAGS already contains $1])
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_RUN_LOG([: FLAGS="$FLAGS $1"])
|
||||||
|
AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
|
||||||
|
;;
|
||||||
|
esac],
|
||||||
|
[AS_VAR_SET(FLAGS,["$1"])])
|
||||||
|
AS_VAR_POPDEF([FLAGS])dnl
|
||||||
|
])dnl AX_APPEND_FLAG
|
|
@ -0,0 +1,63 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# For every FLAG1, FLAG2 it is checked whether the linker works with the
|
||||||
|
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||||
|
#
|
||||||
|
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
|
||||||
|
# used. During the check the flag is always added to the linker's flags.
|
||||||
|
#
|
||||||
|
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||||
|
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||||
|
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||||
|
# issue an error when a bad flag is given.
|
||||||
|
#
|
||||||
|
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
|
||||||
|
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# 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 3
|
||||||
|
|
||||||
|
AC_DEFUN([AX_APPEND_LINK_FLAGS],
|
||||||
|
[AC_REQUIRE([AX_CHECK_LINK_FLAG])
|
||||||
|
AC_REQUIRE([AX_APPEND_FLAG])
|
||||||
|
for flag in $1; do
|
||||||
|
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3])
|
||||||
|
done
|
||||||
|
])dnl AX_APPEND_LINK_FLAGS
|
|
@ -0,0 +1,27 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_append_to_file.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_APPEND_TO_FILE([FILE],[DATA])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Appends the specified data to the specified file.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Tom Howard <tomhoward@users.sf.net>
|
||||||
|
#
|
||||||
|
# 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 8
|
||||||
|
|
||||||
|
AC_DEFUN([AX_APPEND_TO_FILE],[
|
||||||
|
AC_REQUIRE([AX_FILE_ESCAPES])
|
||||||
|
printf "$2\n" >> "$1"
|
||||||
|
])
|
|
@ -0,0 +1,72 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# 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()],
|
||||||
|
[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
|
|
@ -0,0 +1,71 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Check whether the given FLAG works with the linker 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 linker's default flags
|
||||||
|
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||||
|
# EXTRA-FLAGS FLAG". This can for example be used to force the linker 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,COMPILE}_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_LINK_FLAG],
|
||||||
|
[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
|
||||||
|
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
|
||||||
|
ax_check_save_flags=$LDFLAGS
|
||||||
|
LDFLAGS="$LDFLAGS $4 $1"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
||||||
|
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||||
|
[AS_VAR_SET(CACHEVAR,[no])])
|
||||||
|
LDFLAGS=$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_LINK_FLAGS
|
|
@ -0,0 +1,57 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_count_cpus.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_COUNT_CPUS
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Attempt to count the number of processors present on the machine. If the
|
||||||
|
# detection fails, then a value of 1 is assumed.
|
||||||
|
#
|
||||||
|
# The value is placed in the CPU_COUNT variable.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012 Brian Aker <brian@tangent.org>
|
||||||
|
# Copyright (c) 2008 Michael Paul Bailey <jinxidoru@byu.net>
|
||||||
|
# Copyright (c) 2008 Christophe Tournayre <turn3r@users.sourceforge.net>
|
||||||
|
#
|
||||||
|
# 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 10
|
||||||
|
|
||||||
|
AC_DEFUN([AX_COUNT_CPUS],[
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
|
AC_REQUIRE([AC_PROG_EGREP])
|
||||||
|
AC_MSG_CHECKING([the number of available CPUs])
|
||||||
|
CPU_COUNT="0"
|
||||||
|
|
||||||
|
AS_CASE([$host_os],[
|
||||||
|
*darwin*],[
|
||||||
|
AS_IF([test -x /usr/sbin/sysctl],[
|
||||||
|
sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu`
|
||||||
|
AS_IF([test sysctl_a],[
|
||||||
|
CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu`
|
||||||
|
])
|
||||||
|
])],[
|
||||||
|
*linux*],[
|
||||||
|
AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[
|
||||||
|
AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[
|
||||||
|
CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo`
|
||||||
|
])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_IF([test "x$CPU_COUNT" = "x0"],[
|
||||||
|
CPU_COUNT="1"
|
||||||
|
AC_MSG_RESULT( [unable to detect (assuming 1)] )
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT( $CPU_COUNT )
|
||||||
|
])
|
||||||
|
])
|
|
@ -0,0 +1,195 @@
|
||||||
|
# ============================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_create_generic_config.html
|
||||||
|
# ============================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CREATE_GENERIC_CONFIG [(PACKAGEnlibs [, VERSION])]
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Creates a generic PACKAGE-config file that has all the things that you
|
||||||
|
# want, hmm, well, atleast it has --cflags, --version, --libs. Ahhm, did
|
||||||
|
# you see ax_path_generic in the autoconf-archive? ;-)
|
||||||
|
#
|
||||||
|
# this macros saves you all the typing for a pkg-config.in script, you
|
||||||
|
# don't even need to distribute one along. Place this macro in your
|
||||||
|
# configure.ac, et voila, you got one that you want to install.
|
||||||
|
#
|
||||||
|
# oh, btw, if the first arg looks like "mylib -lwhat' then it will go to
|
||||||
|
# be added to the --libs, and mylib is extracted.
|
||||||
|
#
|
||||||
|
# the defaults: $1 = $PACKAGE $LIBS $2 = $VERSION there is also an
|
||||||
|
# AC_SUBST(GENERIC_CONFIG) that will be set to the name of the file that
|
||||||
|
# we did output in this macro. Use as:
|
||||||
|
#
|
||||||
|
# install-exec-local: install-generic-config
|
||||||
|
#
|
||||||
|
# install-generic-config:
|
||||||
|
# $(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
# $(INSTALL_SCRIPT) @GENERIC_CONFIG@ $(DESTDIR)$(bindir)
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
#
|
||||||
|
# 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 6
|
||||||
|
|
||||||
|
AU_ALIAS([AC_CREATE_GENERIC_CONFIG], [AX_CREATE_GENERIC_CONFIG])
|
||||||
|
AC_DEFUN([AX_CREATE_GENERIC_CONFIG],[# create a generic PACKAGE-config file
|
||||||
|
L=`echo ifelse($1, , $PACKAGE $LIBS, $1)`
|
||||||
|
P=`echo $L | sed -e 's/ -.*//'`
|
||||||
|
P=`echo $P`
|
||||||
|
V=`echo ifelse($2, , $VERSION, $2)`
|
||||||
|
F=`echo $P-config`
|
||||||
|
L=`echo -l$L | sed -e 's/^-llib/-l/'`
|
||||||
|
AC_MSG_RESULT(creating $F - generic $V for $L)
|
||||||
|
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||||
|
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||||
|
echo '#! /bin/sh' >$F
|
||||||
|
echo ' ' >>$F
|
||||||
|
echo 'package="'$P'"' >>$F
|
||||||
|
echo 'version="'$V'"' >>$F
|
||||||
|
echo 'libs="'$L'"' >>$F
|
||||||
|
echo ' ' >>$F
|
||||||
|
# in the order of occurence a standard automake Makefile
|
||||||
|
echo 'prefix="'$prefix'"' >>$F
|
||||||
|
echo 'exec_prefix="'$exec_prefix'"' >>$F
|
||||||
|
echo 'bindir="'$bindir'"' >>$F
|
||||||
|
echo 'sbindir="'$sbindir'"' >>$F
|
||||||
|
echo 'libexecdir="'$libexecdir'"' >>$F
|
||||||
|
echo 'datadir="'$datadir'"' >>$F
|
||||||
|
echo 'sysconfdir="'$sysconfdir'"' >>$F
|
||||||
|
echo 'sharedstatedir="'$sharedstatedir'"' >>$F
|
||||||
|
echo 'localstatedir="'$localstatedir'"' >>$F
|
||||||
|
echo 'libdir="'$libdir'"' >>$F
|
||||||
|
echo 'infodir="'$infodir'"' >>$F
|
||||||
|
echo 'mandir="'$mandir'"' >>$F
|
||||||
|
echo 'includedir="'$includedir'"' >>$F
|
||||||
|
echo 'target="'$target'"' >>$F
|
||||||
|
echo 'host="'$host'"' >>$F
|
||||||
|
echo 'build="'$build'"' >>$F
|
||||||
|
echo ' ' >>$F
|
||||||
|
echo 'if test "'"\$""#"'" -eq 0; then' >>$F
|
||||||
|
echo ' cat <<EOF' >>$F
|
||||||
|
echo 'Usage: $package-config [OPTIONS]' >>$F
|
||||||
|
echo 'Options:' >>$F
|
||||||
|
echo ' --prefix[=DIR]) : \$prefix' >>$F
|
||||||
|
echo ' --package) : \$package' >>$F
|
||||||
|
echo ' --version) : \$version' >>$F
|
||||||
|
echo ' --cflags) : -I\$includedir' >>$F
|
||||||
|
echo ' --libs) : -L\$libdir -l\$package' >>$F
|
||||||
|
echo ' --help) print all the options (not just these)' >>$F
|
||||||
|
echo 'EOF' >>$F
|
||||||
|
echo 'fi' >>$F
|
||||||
|
echo ' ' >>$F
|
||||||
|
echo 'o=""' >>$F
|
||||||
|
echo 'h=""' >>$F
|
||||||
|
echo 'for i in "[$]@"; do' >>$F
|
||||||
|
echo ' case $i in' >>$F
|
||||||
|
echo ' --prefix=*) prefix=`echo $i | sed -e "s/--prefix=//"` ;;' >>$F
|
||||||
|
echo ' --prefix) o="$o $prefix" ;;' >>$F
|
||||||
|
echo ' --package) o="$o $package" ;;' >>$F
|
||||||
|
echo ' --version) o="$o $version" ;;' >>$F
|
||||||
|
echo ' --cflags) if test "_$includedir" != "_/usr/include"' >>$F
|
||||||
|
echo ' then o="$o -I$includedir" ; fi' >>$F
|
||||||
|
echo ' ;;' >>$F
|
||||||
|
echo ' --libs) o="$o -L$libdir $libs" ;;' >>$F
|
||||||
|
echo ' --exec_prefix|--eprefix) o="$o $exec_prefix" ;;' >>$F
|
||||||
|
echo ' --bindir) o="$o $bindir" ;;' >>$F
|
||||||
|
echo ' --sbindir) o="$o $sbindir" ;;' >>$F
|
||||||
|
echo ' --libexecdir) o="$o $libexecdir" ;;' >>$F
|
||||||
|
echo ' --datadir) o="$o $datadir" ;;' >>$F
|
||||||
|
echo ' --datainc) o="$o -I$datadir" ;;' >>$F
|
||||||
|
echo ' --datalib) o="$o -L$datadir" ;;' >>$F
|
||||||
|
echo ' --sysconfdir) o="$o $sysconfdir" ;;' >>$F
|
||||||
|
echo ' --sharedstatedir) o="$o $sharedstatedir" ;;' >>$F
|
||||||
|
echo ' --localstatedir) o="$o $localstatedir" ;;' >>$F
|
||||||
|
echo ' --libdir) o="$o $libdir" ;;' >>$F
|
||||||
|
echo ' --libadd) o="$o -L$libdir" ;;' >>$F
|
||||||
|
echo ' --infodir) o="$o $infodir" ;;' >>$F
|
||||||
|
echo ' --mandir) o="$o $mandir" ;;' >>$F
|
||||||
|
echo ' --target) o="$o $target" ;;' >>$F
|
||||||
|
echo ' --host) o="$o $host" ;;' >>$F
|
||||||
|
echo ' --build) o="$o $build" ;;' >>$F
|
||||||
|
echo ' --data) o="$o -I$datadir/$package" ;;' >>$F
|
||||||
|
echo ' --pkgdatadir) o="$o $datadir/$package" ;;' >>$F
|
||||||
|
echo ' --pkgdatainc) o="$o -I$datadir/$package" ;;' >>$F
|
||||||
|
echo ' --pkgdatalib) o="$o -L$datadir/$package" ;;' >>$F
|
||||||
|
echo ' --pkglibdir) o="$o $libdir/$package" ;;' >>$F
|
||||||
|
echo ' --pkglibinc) o="$o -I$libinc/$package" ;;' >>$F
|
||||||
|
echo ' --pkglibadd) o="$o -L$libadd/$package" ;;' >>$F
|
||||||
|
echo ' --pkgincludedir) o="$o $includedir/$package" ;;' >>$F
|
||||||
|
echo ' --help) h="1" ;;' >>$F
|
||||||
|
echo ' -?//*|-?/*//*|-?./*//*|//*|/*//*|./*//*) ' >>$F
|
||||||
|
echo ' v=`echo $i | sed -e s://:\$:g`' >>$F
|
||||||
|
echo ' v=`eval "echo $v"` ' >>$F
|
||||||
|
echo ' o="$o $v" ;; ' >>$F
|
||||||
|
echo ' esac' >>$F
|
||||||
|
echo 'done' >>$F
|
||||||
|
echo ' ' >>$F
|
||||||
|
echo 'o=`eval "echo $o"`' >>$F
|
||||||
|
echo 'o=`eval "echo $o"`' >>$F
|
||||||
|
echo 'eval "echo $o"' >>$F
|
||||||
|
echo ' ' >>$F
|
||||||
|
echo 'if test ! -z "$h" ; then ' >>$F
|
||||||
|
echo 'cat <<EOF' >>$F
|
||||||
|
echo ' --prefix=xxx) (what is that for anyway?)' >>$F
|
||||||
|
echo ' --prefix) \$prefix $prefix' >>$F
|
||||||
|
echo ' --package) \$package $package' >>$F
|
||||||
|
echo ' --version) \$version $version' >>$F
|
||||||
|
echo ' --cflags) -I\$includedir unless it is /usr/include' >>$F
|
||||||
|
echo ' --libs) -L\$libdir -l\$PACKAGE \$LIBS' >>$F
|
||||||
|
echo ' --exec_prefix) or... ' >>$F
|
||||||
|
echo ' --eprefix) \$exec_prefix $exec_prefix' >>$F
|
||||||
|
echo ' --bindir) \$bindir $bindir' >>$F
|
||||||
|
echo ' --sbindir) \$sbindir $sbindir' >>$F
|
||||||
|
echo ' --libexecdir) \$libexecdir $libexecdir' >>$F
|
||||||
|
echo ' --datadir) \$datadir $datadir' >>$F
|
||||||
|
echo ' --sysconfdir) \$sysconfdir $sysconfdir' >>$F
|
||||||
|
echo ' --sharedstatedir) \$sharedstatedir$sharedstatedir' >>$F
|
||||||
|
echo ' --localstatedir) \$localstatedir $localstatedir' >>$F
|
||||||
|
echo ' --libdir) \$libdir $libdir' >>$F
|
||||||
|
echo ' --infodir) \$infodir $infodir' >>$F
|
||||||
|
echo ' --mandir) \$mandir $mandir' >>$F
|
||||||
|
echo ' --target) \$target $target' >>$F
|
||||||
|
echo ' --host) \$host $host' >>$F
|
||||||
|
echo ' --build) \$build $build' >>$F
|
||||||
|
echo ' --data) -I\$datadir/\$package' >>$F
|
||||||
|
echo ' --pkgdatadir) \$datadir/\$package' >>$F
|
||||||
|
echo ' --pkglibdir) \$libdir/\$package' >>$F
|
||||||
|
echo ' --pkgincludedir) \$includedir/\$package' >>$F
|
||||||
|
echo ' --help) generated by ax_create_generic_config.m4' >>$F
|
||||||
|
echo ' -I//varname and other inc-targets like --pkgdatainc supported' >>$F
|
||||||
|
echo ' -L//varname and other lib-targets, e.g. --pkgdatalib or --libadd' >>$F
|
||||||
|
echo 'EOF' >>$F
|
||||||
|
echo 'fi' >>$F
|
||||||
|
GENERIC_CONFIG="$F"
|
||||||
|
AC_SUBST(GENERIC_CONFIG)
|
||||||
|
])
|
|
@ -0,0 +1,63 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# https://github.com/BrianAker/ddm4/
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_DEBUG()
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# --enable-debug
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
#serial 6.1
|
||||||
|
|
||||||
|
AC_DEFUN([AX_DEBUG],
|
||||||
|
[AC_PREREQ([2.63])dnl
|
||||||
|
AC_ARG_ENABLE([debug],
|
||||||
|
[AS_HELP_STRING([--enable-debug],
|
||||||
|
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
|
||||||
|
[ax_enable_debug=$enableval],
|
||||||
|
[ax_enable_debug=no])
|
||||||
|
|
||||||
|
AS_IF([test "x$ax_enable_debug" = xyes],
|
||||||
|
[AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])],
|
||||||
|
[AC_SUBST([MCHECK])
|
||||||
|
AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for debug])
|
||||||
|
AC_MSG_RESULT([$ax_enable_debug])
|
||||||
|
AM_CONDITIONAL([DEBUG],[test "x${ax_enable_debug}" = xyes])])
|
|
@ -0,0 +1,30 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_file_escapes.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_FILE_ESCAPES
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Writes the specified data to the specified file.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Tom Howard <tomhoward@users.sf.net>
|
||||||
|
#
|
||||||
|
# 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_FILE_ESCAPES],[
|
||||||
|
AX_DOLLAR="\$"
|
||||||
|
AX_SRB="\\135"
|
||||||
|
AX_SLB="\\133"
|
||||||
|
AX_BS="\\\\"
|
||||||
|
AX_DQ="\""
|
||||||
|
])
|
|
@ -0,0 +1,236 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# https://github.com/BrianAker/ddm4/
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_HARDEN_COMPILER_FLAGS()
|
||||||
|
# AX_HARDEN_LINKER_FLAGS()
|
||||||
|
# AX_HARDEN_CC_COMPILER_FLAGS()
|
||||||
|
# AX_HARDEN_CXX_COMPILER_FLAGS()
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Any compiler flag that "hardens" or tests code. C99 is assumed.
|
||||||
|
#
|
||||||
|
# NOTE: Implementation based on AX_APPEND_FLAG.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# The Following flags are not checked for
|
||||||
|
# -Wdeclaration-after-statement is counter to C99
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-std=c++11]) -- Not ready yet
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-pedantic]) -- ?
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-Wstack-protector]) -- Issues on 32bit compile
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-fstack-protector-all]) -- Issues on 32bit compile
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-Wlong-long]) -- Don't turn on for compatibility issues memcached_stat_st
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-Wold-style-definition],,[$ax_append_compile_cflags_extra])
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-std=c99],,[$ax_append_compile_cflags_extra])
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-Wlogical-op],,[$ax_append_compile_cflags_extra])
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-fstack-check],,[$ax_append_compile_cflags_extra]) -- problems with fastmath stack size checks
|
||||||
|
# AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all],,[$ax_append_compile_cflags_extra]) -- causes RSA verify problem on x64
|
||||||
|
|
||||||
|
#serial 4
|
||||||
|
|
||||||
|
AC_DEFUN([AX_HARDEN_LINKER_FLAGS], [
|
||||||
|
AC_REQUIRE([AX_CHECK_LINK_FLAG])
|
||||||
|
AC_REQUIRE([AX_VCS_CHECKOUT])
|
||||||
|
AC_REQUIRE([AX_DEBUG])
|
||||||
|
|
||||||
|
dnl If we are inside of VCS we append -Werror, otherwise we just use it to test other flags
|
||||||
|
AX_HARDEN_LIB=
|
||||||
|
ax_append_compile_link_flags_extra=
|
||||||
|
AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],[
|
||||||
|
AX_CHECK_LINK_FLAG([-Werror],[
|
||||||
|
AX_HARDEN_LIB="-Werror $AX_HARDEN_LIB"
|
||||||
|
])
|
||||||
|
],[
|
||||||
|
AX_CHECK_LINK_FLAG([-Werror],[
|
||||||
|
ax_append_compile_link_flags_extra='-Werror'
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AX_CHECK_LINK_FLAG([-z relro -z now],[
|
||||||
|
AX_HARDEN_LIB="-z relro -z now $AX_HARDEN_LIB"
|
||||||
|
],,[$ax_append_compile_link_flags_extra])
|
||||||
|
|
||||||
|
AX_CHECK_LINK_FLAG([-pie],[
|
||||||
|
AX_HARDEN_LIB="-pie $AX_HARDEN_LIB"
|
||||||
|
],,[$ax_append_compile_link_flags_extra])
|
||||||
|
|
||||||
|
LIB="$LIB $AX_HARDEN_LIB"
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS], [
|
||||||
|
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
|
||||||
|
AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
|
||||||
|
|
||||||
|
AC_LANG_PUSH([C])
|
||||||
|
|
||||||
|
CFLAGS=
|
||||||
|
ac_cv_warnings_as_errors=no
|
||||||
|
ax_append_compile_cflags_extra=
|
||||||
|
AS_IF([test "$ac_cv_vcs_checkout" = "yes"],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Werror])
|
||||||
|
ac_cv_warnings_as_errors=yes
|
||||||
|
],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Werror],[ax_append_compile_cflags_extra])
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_IF([test "$ax_enable_debug" = "yes"], [
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-g])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_cflags_extra])
|
||||||
|
],[])
|
||||||
|
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_cflags_extra])
|
||||||
|
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing],,,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_cflags_extra])
|
||||||
|
dnl Anything below this comment please keep sorted.
|
||||||
|
AS_IF([test "$CC" = "clang"],[],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_cflags_extra])
|
||||||
|
])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast],,[$ax_append_compile_cflags_extra])
|
||||||
|
dnl Not in use -Wc++-compat
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wnested-externs],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Woverride-init],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wpointer-sign],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunused],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_cflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_cflags_extra])
|
||||||
|
AC_LANG_POP
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_HARDEN_CXX_COMPILER_FLAGS], [
|
||||||
|
AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
|
||||||
|
AC_LANG_PUSH([C++])
|
||||||
|
|
||||||
|
ax_append_compile_cxxflags_extra=
|
||||||
|
AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Werror])
|
||||||
|
],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Werror],[ax_append_compile_cxxflags_extra])
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_IF([test "$ax_enable_debug" = "yes" ], [
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-g],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_IF([test "$ac_cv_vcs_checkout" = "yes" ], [
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Werror],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
],[
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
])
|
||||||
|
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing],,,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
dnl Anything below this comment please keep sorted.
|
||||||
|
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wctor-dtor-privacy],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Woverloaded-virtual],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wc++11-compat],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunused],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_cxxflags_extra])
|
||||||
|
AC_LANG_POP
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_HARDEN_COMPILER_FLAGS], [
|
||||||
|
AC_REQUIRE([AX_HARDEN_CXX_COMPILER_FLAGS])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CC_OTHER_FLAGS], [
|
||||||
|
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
|
||||||
|
AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
|
||||||
|
|
||||||
|
AC_LANG_PUSH([C])
|
||||||
|
AX_APPEND_COMPILE_FLAGS([-pipe],,[$ax_append_compile_cflags_extra])
|
||||||
|
AC_LANG_POP
|
||||||
|
])
|
|
@ -0,0 +1,27 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_print_to_file.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_PRINT_TO_FILE([FILE],[DATA])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Writes the specified data to the specified file.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Tom Howard <tomhoward@users.sf.net>
|
||||||
|
#
|
||||||
|
# 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_PRINT_TO_FILE],[
|
||||||
|
AC_REQUIRE([AX_FILE_ESCAPES])
|
||||||
|
printf "$2" > "$1"
|
||||||
|
])
|
|
@ -0,0 +1,320 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# This macro figures out how to build C programs using POSIX threads. It
|
||||||
|
# sets the PTHREAD_LIBS output variable to the threads library and linker
|
||||||
|
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
|
||||||
|
# flags that are needed. (The user can also force certain compiler
|
||||||
|
# flags/libs to be tested by setting these environment variables.)
|
||||||
|
#
|
||||||
|
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||||
|
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||||
|
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||||
|
#
|
||||||
|
# NOTE: You are assumed to not only compile your program with these flags,
|
||||||
|
# but also link it with them as well. e.g. you should link with
|
||||||
|
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||||
|
#
|
||||||
|
# If you are only building threads programs, you may wish to use these
|
||||||
|
# variables in your default LIBS, CFLAGS, and CC:
|
||||||
|
#
|
||||||
|
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
# CC="$PTHREAD_CC"
|
||||||
|
#
|
||||||
|
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||||
|
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
|
||||||
|
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||||
|
#
|
||||||
|
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||||
|
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||||
|
# PTHREAD_CFLAGS.
|
||||||
|
#
|
||||||
|
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
|
||||||
|
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||||
|
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||||
|
# will define HAVE_PTHREAD.
|
||||||
|
#
|
||||||
|
# Please let the authors know if this macro fails on any platform, or if
|
||||||
|
# you have any other suggestions or comments. This macro was based on work
|
||||||
|
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
|
||||||
|
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
|
||||||
|
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
|
||||||
|
# grateful for the helpful feedback of numerous users.
|
||||||
|
#
|
||||||
|
# Updated for Autoconf 2.68 by Daniel Richard G.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||||
|
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||||
|
#
|
||||||
|
# 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 20
|
||||||
|
|
||||||
|
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||||
|
AC_DEFUN([AX_PTHREAD], [
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
|
AC_LANG_PUSH([C])
|
||||||
|
ax_pthread_ok=no
|
||||||
|
|
||||||
|
# We used to check for pthread.h first, but this fails if pthread.h
|
||||||
|
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||||
|
# It gets checked for in the link test anyway.
|
||||||
|
|
||||||
|
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||||
|
# etcetera environment variables, and if threads linking works using
|
||||||
|
# them:
|
||||||
|
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
save_LIBS="$LIBS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||||
|
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
|
||||||
|
AC_MSG_RESULT($ax_pthread_ok)
|
||||||
|
if test x"$ax_pthread_ok" = xno; then
|
||||||
|
PTHREAD_LIBS=""
|
||||||
|
PTHREAD_CFLAGS=""
|
||||||
|
fi
|
||||||
|
LIBS="$save_LIBS"
|
||||||
|
CFLAGS="$save_CFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We must check for the threads library under a number of different
|
||||||
|
# names; the ordering is very important because some systems
|
||||||
|
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||||
|
# libraries is broken (non-POSIX).
|
||||||
|
|
||||||
|
# Create a list of thread flags to try. Items starting with a "-" are
|
||||||
|
# C compiler flags, and other items are library names, except for "none"
|
||||||
|
# which indicates that we try without any flags at all, and "pthread-config"
|
||||||
|
# which is a program returning the flags for the Pth emulation library.
|
||||||
|
|
||||||
|
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||||
|
|
||||||
|
# The ordering *is* (sometimes) important. Some notes on the
|
||||||
|
# individual items follow:
|
||||||
|
|
||||||
|
# pthreads: AIX (must check this before -lpthread)
|
||||||
|
# none: in case threads are in libc; should be tried before -Kthread and
|
||||||
|
# other compiler flags to prevent continual compiler warnings
|
||||||
|
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||||
|
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||||
|
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||||
|
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||||
|
# -pthreads: Solaris/gcc
|
||||||
|
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||||
|
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||||
|
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||||
|
# also defines -D_REENTRANT)
|
||||||
|
# ... -mt is also the pthreads flag for HP/aCC
|
||||||
|
# pthread: Linux, etcetera
|
||||||
|
# --thread-safe: KAI C++
|
||||||
|
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||||
|
|
||||||
|
case ${host_os} in
|
||||||
|
solaris*)
|
||||||
|
|
||||||
|
# On Solaris (at least, for some versions), libc contains stubbed
|
||||||
|
# (non-functional) versions of the pthreads routines, so link-based
|
||||||
|
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||||
|
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||||
|
# a function called by this macro, so we could check for that, but
|
||||||
|
# who knows whether they'll stub that too in a future libc.) So,
|
||||||
|
# we'll just look for -pthreads and -lpthread first:
|
||||||
|
|
||||||
|
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||||
|
;;
|
||||||
|
|
||||||
|
darwin*)
|
||||||
|
AC_REQUIRE([WOLFSSL_DARWIN_USING_CLANG])
|
||||||
|
AS_IF([test x"$wolfssl_darwin_clang" = x"yes"],
|
||||||
|
[ax_pthread_flags="$ax_pthread_flags"],
|
||||||
|
[ax_pthread_flags="-pthread $ax_pthread_flags"])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test x"$ax_pthread_ok" = xno; then
|
||||||
|
for flag in $ax_pthread_flags; do
|
||||||
|
|
||||||
|
case $flag in
|
||||||
|
none)
|
||||||
|
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||||
|
PTHREAD_CFLAGS="$flag"
|
||||||
|
;;
|
||||||
|
|
||||||
|
pthread-config)
|
||||||
|
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
|
||||||
|
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||||
|
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||||
|
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||||
|
PTHREAD_LIBS="-l$flag"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
save_LIBS="$LIBS"
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
|
||||||
|
# Check for various functions. We must include pthread.h,
|
||||||
|
# since some functions may be macros. (On the Sequent, we
|
||||||
|
# need a special flag -Kthread to make this header compile.)
|
||||||
|
# We check for pthread_join because it is in -lpthread on IRIX
|
||||||
|
# while pthread_create is in libc. We check for pthread_attr_init
|
||||||
|
# due to DEC craziness with -lpthreads. We check for
|
||||||
|
# pthread_cleanup_push because it is one of the few pthread
|
||||||
|
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||||
|
# We try pthread_create on general principles.
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||||
|
static void routine(void *a) { a = 0; }
|
||||||
|
static void *start_routine(void *a) { return a; }],
|
||||||
|
[pthread_t th; pthread_attr_t attr;
|
||||||
|
pthread_create(&th, 0, start_routine, 0);
|
||||||
|
pthread_join(th, 0);
|
||||||
|
pthread_attr_init(&attr);
|
||||||
|
pthread_cleanup_push(routine, 0);
|
||||||
|
pthread_cleanup_pop(0) /* ; */])],
|
||||||
|
[ax_pthread_ok=yes],
|
||||||
|
[])
|
||||||
|
|
||||||
|
LIBS="$save_LIBS"
|
||||||
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
|
AC_MSG_RESULT($ax_pthread_ok)
|
||||||
|
if test "x$ax_pthread_ok" = xyes; then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
|
||||||
|
PTHREAD_LIBS=""
|
||||||
|
PTHREAD_CFLAGS=""
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Various other checks:
|
||||||
|
if test "x$ax_pthread_ok" = xyes; then
|
||||||
|
save_LIBS="$LIBS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
|
||||||
|
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||||
|
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||||
|
attr_name=unknown
|
||||||
|
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||||
|
[int attr = $attr; return attr /* ; */])],
|
||||||
|
[attr_name=$attr; break],
|
||||||
|
[])
|
||||||
|
done
|
||||||
|
AC_MSG_RESULT($attr_name)
|
||||||
|
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||||
|
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
||||||
|
[Define to necessary symbol if this constant
|
||||||
|
uses a non-standard name on your system.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||||
|
flag=no
|
||||||
|
case ${host_os} in
|
||||||
|
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||||
|
osf* | hpux*) flag="-D_REENTRANT";;
|
||||||
|
solaris*)
|
||||||
|
if test "$GCC" = "yes"; then
|
||||||
|
flag="-D_REENTRANT"
|
||||||
|
else
|
||||||
|
flag="-mt -D_REENTRANT"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AC_MSG_RESULT(${flag})
|
||||||
|
if test "x$flag" != xno; then
|
||||||
|
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||||
|
ax_cv_PTHREAD_PRIO_INHERIT, [
|
||||||
|
AC_LINK_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||||
|
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||||
|
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||||
|
])
|
||||||
|
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
|
||||||
|
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
|
||||||
|
|
||||||
|
LIBS="$save_LIBS"
|
||||||
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
|
# More AIX lossage: compile with *_r variant
|
||||||
|
if test "x$GCC" != xyes; then
|
||||||
|
case $host_os in
|
||||||
|
aix*)
|
||||||
|
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
|
||||||
|
|
||||||
|
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||||
|
|
||||||
|
AC_SUBST(PTHREAD_LIBS)
|
||||||
|
AC_SUBST(PTHREAD_CFLAGS)
|
||||||
|
AC_SUBST(PTHREAD_CC)
|
||||||
|
|
||||||
|
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||||
|
if test x"$ax_pthread_ok" = xyes; then
|
||||||
|
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ax_pthread_ok=no
|
||||||
|
$2
|
||||||
|
fi
|
||||||
|
AC_LANG_POP
|
||||||
|
])dnl AX_PTHREAD
|
|
@ -0,0 +1,75 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_VCS_CHECKOUT
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Discover whether or not we are operating with a tree which
|
||||||
|
# has been checked out of a version control system.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
#serial 6
|
||||||
|
|
||||||
|
AC_DEFUN([AX_VCS_SYSTEM],
|
||||||
|
[AC_PREREQ([2.63])dnl
|
||||||
|
AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system],
|
||||||
|
[ac_cv_vcs_system="none"
|
||||||
|
AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"])
|
||||||
|
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])
|
||||||
|
])
|
||||||
|
|
||||||
|
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.])])
|
||||||
|
])
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Check for libwolfssl
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
AC_DEFUN([_TAO_SEARCH_LIBWOLFSSL],[
|
||||||
|
AC_REQUIRE([AC_LIB_PREFIX])
|
||||||
|
|
||||||
|
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||||
|
LIBS="$LIBS -lwolfssl"
|
||||||
|
|
||||||
|
AC_LIB_HAVE_LINKFLAGS(wolfssl,,
|
||||||
|
[
|
||||||
|
#include <wolfssl/ssl.h>
|
||||||
|
],[
|
||||||
|
wolfSSL_Init();
|
||||||
|
])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(HAVE_LIBWOLFSSL, [test "x${ac_cv_libwolfssl}" = "xyes"])
|
||||||
|
|
||||||
|
AS_IF([test "x${ac_cv_libwolfssl}" = "xyes"],[
|
||||||
|
save_LIBS="${LIBS}"
|
||||||
|
LIBS="${LIBS} ${LTLIBWOLFSSL}"
|
||||||
|
AC_CHECK_FUNCS(wolfSSL_Cleanup)
|
||||||
|
LIBS="$save_LIBS"
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([_TAO_HAVE_LIBWOLFSSL],[
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([libwolfssl],
|
||||||
|
[AS_HELP_STRING([--disable-libwolfssl],
|
||||||
|
[Build with libwolfssl support @<:@default=on@:>@])],
|
||||||
|
[ac_enable_libwolfssl="$enableval"],
|
||||||
|
[ac_enable_libwolfssl="yes"])
|
||||||
|
|
||||||
|
_TAO_SEARCH_LIBWOLFSSL
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
AC_DEFUN([TAO_HAVE_LIBWOLFSSL],[
|
||||||
|
AC_REQUIRE([_TAO_HAVE_LIBWOLFSSL])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([_TAO_REQUIRE_LIBWOLFSSL],[
|
||||||
|
ac_enable_libwolfssl="yes"
|
||||||
|
_TAO_SEARCH_LIBWOLFSSL
|
||||||
|
|
||||||
|
AS_IF([test x$ac_cv_libwolfssl = xno],[
|
||||||
|
AC_MSG_ERROR([libwolfssl is required for ${PACKAGE}, It can be obtained from http://www.wolfssl.com/download.html/])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([TAO_REQUIRE_LIBWOLFSSL],[
|
||||||
|
AC_REQUIRE([_TAO_REQUIRE_LIBWOLFSSL])
|
||||||
|
])
|
|
@ -0,0 +1,6 @@
|
||||||
|
AC_DEFUN([CREATE_HEX_VERSION],[
|
||||||
|
|
||||||
|
HEX_VERSION=`echo $VERSION | sed 's|[\-a-z0-9]*$||' | \
|
||||||
|
awk -F. '{printf "0x%0.2d%0.3d%0.3d", $[]1, $[]2, $[]3}'`
|
||||||
|
AC_SUBST([HEX_VERSION])
|
||||||
|
])
|
|
@ -0,0 +1,110 @@
|
||||||
|
# lib-ld.m4 serial 3 (gettext-0.13)
|
||||||
|
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl Subroutines of libtool.m4,
|
||||||
|
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
|
||||||
|
dnl with libtool.m4.
|
||||||
|
|
||||||
|
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
|
||||||
|
AC_DEFUN([AC_LIB_PROG_LD_GNU],
|
||||||
|
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
|
||||||
|
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||||
|
case `$LD -v 2>&1 </dev/null` in
|
||||||
|
*GNU* | *'with BFD'*)
|
||||||
|
acl_cv_prog_gnu_ld=yes ;;
|
||||||
|
*)
|
||||||
|
acl_cv_prog_gnu_ld=no ;;
|
||||||
|
esac])
|
||||||
|
with_gnu_ld=$acl_cv_prog_gnu_ld
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl From libtool-1.4. Sets the variable LD.
|
||||||
|
AC_DEFUN([AC_LIB_PROG_LD],
|
||||||
|
[AC_ARG_WITH(gnu-ld,
|
||||||
|
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||||
|
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||||
|
AC_REQUIRE([AC_PROG_CC])dnl
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||||
|
# Prepare PATH_SEPARATOR.
|
||||||
|
# The user is always right.
|
||||||
|
if test "${PATH_SEPARATOR+set}" != set; then
|
||||||
|
echo "#! /bin/sh" >conf$$.sh
|
||||||
|
echo "exit 0" >>conf$$.sh
|
||||||
|
chmod +x conf$$.sh
|
||||||
|
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||||
|
PATH_SEPARATOR=';'
|
||||||
|
else
|
||||||
|
PATH_SEPARATOR=:
|
||||||
|
fi
|
||||||
|
rm -f conf$$.sh
|
||||||
|
fi
|
||||||
|
ac_prog=ld
|
||||||
|
if test "$GCC" = yes; then
|
||||||
|
# Check if gcc -print-prog-name=ld gives a path.
|
||||||
|
AC_MSG_CHECKING([for ld used by GCC])
|
||||||
|
case $host in
|
||||||
|
*-*-mingw*)
|
||||||
|
# gcc leaves a trailing carriage return which upsets mingw
|
||||||
|
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
|
||||||
|
*)
|
||||||
|
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
|
||||||
|
esac
|
||||||
|
case $ac_prog in
|
||||||
|
# Accept absolute paths.
|
||||||
|
[[\\/]* | [A-Za-z]:[\\/]*)]
|
||||||
|
[re_direlt='/[^/][^/]*/\.\./']
|
||||||
|
# Canonicalize the path of ld
|
||||||
|
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||||
|
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||||
|
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||||
|
done
|
||||||
|
test -z "$LD" && LD="$ac_prog"
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
# If it fails, then pretend we aren't using GCC.
|
||||||
|
ac_prog=ld
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# If it is relative, then search for the first ld in PATH.
|
||||||
|
with_gnu_ld=unknown
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
elif test "$with_gnu_ld" = yes; then
|
||||||
|
AC_MSG_CHECKING([for GNU ld])
|
||||||
|
else
|
||||||
|
AC_MSG_CHECKING([for non-GNU ld])
|
||||||
|
fi
|
||||||
|
AC_CACHE_VAL(acl_cv_path_LD,
|
||||||
|
[if test -z "$LD"; then
|
||||||
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||||
|
for ac_dir in $PATH; do
|
||||||
|
test -z "$ac_dir" && ac_dir=.
|
||||||
|
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||||
|
acl_cv_path_LD="$ac_dir/$ac_prog"
|
||||||
|
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||||
|
# but apparently some GNU ld's only accept -v.
|
||||||
|
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||||
|
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
|
||||||
|
*GNU* | *'with BFD'*)
|
||||||
|
test "$with_gnu_ld" != no && break ;;
|
||||||
|
*)
|
||||||
|
test "$with_gnu_ld" != yes && break ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS="$ac_save_ifs"
|
||||||
|
else
|
||||||
|
acl_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||||
|
fi])
|
||||||
|
LD="$acl_cv_path_LD"
|
||||||
|
if test -n "$LD"; then
|
||||||
|
AC_MSG_RESULT($LD)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||||
|
AC_LIB_PROG_LD_GNU
|
||||||
|
])
|
|
@ -0,0 +1,767 @@
|
||||||
|
# lib-link.m4 serial 18 (gettext-0.18)
|
||||||
|
dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl From Bruno Haible.
|
||||||
|
|
||||||
|
AC_PREREQ([2.54])
|
||||||
|
|
||||||
|
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
|
||||||
|
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||||
|
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
|
||||||
|
dnl augments the CPPFLAGS variable.
|
||||||
|
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
|
||||||
|
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||||
|
AC_DEFUN([AC_LIB_LINKFLAGS],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||||
|
AC_REQUIRE([AC_LIB_RPATH])
|
||||||
|
pushdef([Name],[translit([$1],[./-], [___])])
|
||||||
|
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||||
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||||
|
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
|
||||||
|
AC_LIB_LINKFLAGS_BODY([$1], [$2])
|
||||||
|
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
|
||||||
|
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
|
||||||
|
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
|
||||||
|
ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
|
||||||
|
])
|
||||||
|
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
|
||||||
|
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
|
||||||
|
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
|
||||||
|
LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
|
||||||
|
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||||
|
AC_SUBST([LIB]NAME)
|
||||||
|
AC_SUBST([LTLIB]NAME)
|
||||||
|
AC_SUBST([LIB]NAME[_PREFIX])
|
||||||
|
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
|
||||||
|
dnl results of this search when this library appears as a dependency.
|
||||||
|
HAVE_LIB[]NAME=yes
|
||||||
|
popdef([NAME])
|
||||||
|
popdef([Name])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [system])
|
||||||
|
dnl searches for libname and the libraries corresponding to explicit and
|
||||||
|
dnl implicit dependencies, together with the specified include files and
|
||||||
|
dnl the ability to compile and link the specified testcode. If found, it
|
||||||
|
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
|
||||||
|
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
|
||||||
|
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
|
||||||
|
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
|
||||||
|
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
|
||||||
|
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||||
|
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||||
|
AC_REQUIRE([AC_LIB_RPATH])
|
||||||
|
pushdef([Name],[translit([$1],[./-], [___])])
|
||||||
|
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||||
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||||
|
|
||||||
|
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
|
||||||
|
dnl accordingly.
|
||||||
|
AC_LIB_LINKFLAGS_BODY([$1], [$2], [$5])
|
||||||
|
|
||||||
|
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
|
||||||
|
dnl because if the user has installed lib[]Name and not disabled its use
|
||||||
|
dnl via --without-lib[]Name-prefix, he wants to use it.
|
||||||
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||||
|
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
LIBS="$LIBS $LIB[]NAME"
|
||||||
|
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
])
|
||||||
|
if test "$ac_cv_lib[]Name" = yes; then
|
||||||
|
HAVE_LIB[]NAME=yes
|
||||||
|
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
|
||||||
|
AC_MSG_CHECKING([how to link with lib[]$1])
|
||||||
|
AC_MSG_RESULT([$LIB[]NAME])
|
||||||
|
else
|
||||||
|
HAVE_LIB[]NAME=no
|
||||||
|
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
|
||||||
|
dnl $INC[]NAME either.
|
||||||
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||||
|
LIB[]NAME=
|
||||||
|
LTLIB[]NAME=
|
||||||
|
LIB[]NAME[]_PREFIX=
|
||||||
|
fi
|
||||||
|
AC_SUBST([HAVE_LIB]NAME)
|
||||||
|
AC_SUBST([LIB]NAME)
|
||||||
|
AC_SUBST([LTLIB]NAME)
|
||||||
|
AC_SUBST([LIB]NAME[_PREFIX])
|
||||||
|
popdef([NAME])
|
||||||
|
popdef([Name])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Determine the platform dependent parameters needed to use rpath:
|
||||||
|
dnl acl_libext,
|
||||||
|
dnl acl_shlibext,
|
||||||
|
dnl acl_hardcode_libdir_flag_spec,
|
||||||
|
dnl acl_hardcode_libdir_separator,
|
||||||
|
dnl acl_hardcode_direct,
|
||||||
|
dnl acl_hardcode_minus_L.
|
||||||
|
AC_DEFUN([AC_LIB_RPATH],
|
||||||
|
[
|
||||||
|
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
|
||||||
|
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
|
||||||
|
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
|
||||||
|
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
|
||||||
|
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
|
||||||
|
AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
|
||||||
|
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
|
||||||
|
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
|
||||||
|
. ./conftest.sh
|
||||||
|
rm -f ./conftest.sh
|
||||||
|
acl_cv_rpath=done
|
||||||
|
])
|
||||||
|
wl="$acl_cv_wl"
|
||||||
|
acl_libext="$acl_cv_libext"
|
||||||
|
acl_shlibext="$acl_cv_shlibext"
|
||||||
|
acl_libname_spec="$acl_cv_libname_spec"
|
||||||
|
acl_library_names_spec="$acl_cv_library_names_spec"
|
||||||
|
acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
|
||||||
|
acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
|
||||||
|
acl_hardcode_direct="$acl_cv_hardcode_direct"
|
||||||
|
acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
|
||||||
|
dnl Determine whether the user wants rpath handling at all.
|
||||||
|
AC_ARG_ENABLE([rpath],
|
||||||
|
[ --disable-rpath do not hardcode runtime library paths],
|
||||||
|
:, enable_rpath=yes)
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_FROMPACKAGE(name, package)
|
||||||
|
dnl declares that libname comes from the given package. The configure file
|
||||||
|
dnl will then not have a --with-libname-prefix option but a
|
||||||
|
dnl --with-package-prefix option. Several libraries can come from the same
|
||||||
|
dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
|
||||||
|
dnl macro call that searches for libname.
|
||||||
|
AC_DEFUN([AC_LIB_FROMPACKAGE],
|
||||||
|
[
|
||||||
|
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||||
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||||
|
define([acl_frompackage_]NAME, [$2])
|
||||||
|
popdef([NAME])
|
||||||
|
pushdef([PACK],[$2])
|
||||||
|
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
|
||||||
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||||
|
define([acl_libsinpackage_]PACKUP,
|
||||||
|
m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
|
||||||
|
popdef([PACKUP])
|
||||||
|
popdef([PACK])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies, system]) searches for
|
||||||
|
dnl libname and the libraries corresponding to explicit and implicit
|
||||||
|
dnl dependencies.
|
||||||
|
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
|
||||||
|
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
|
||||||
|
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||||
|
dnl If system==system, -isystem is used instead of -I
|
||||||
|
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||||
|
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||||
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||||
|
pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
|
||||||
|
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
|
||||||
|
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||||
|
pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
|
||||||
|
dnl Autoconf >= 2.61 supports dots in --with options.
|
||||||
|
pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
|
||||||
|
dnl By default, look in $includedir and $libdir.
|
||||||
|
use_additional=yes
|
||||||
|
if test "x$GCC" = "xyes" -a "x$3" = "xsystem"
|
||||||
|
then
|
||||||
|
i_system="-isystem "
|
||||||
|
else
|
||||||
|
i_system="-I"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([
|
||||||
|
eval additional_includedir=\"$includedir\"
|
||||||
|
eval additional_libdir=\"$libdir\"
|
||||||
|
])
|
||||||
|
AC_ARG_WITH(P_A_C_K[-prefix],
|
||||||
|
[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
|
||||||
|
--without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
|
||||||
|
[
|
||||||
|
if test "X$withval" = "Xno"; then
|
||||||
|
use_additional=no
|
||||||
|
else
|
||||||
|
if test "X$withval" = "X"; then
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([
|
||||||
|
eval additional_includedir=\"$includedir\"
|
||||||
|
eval additional_libdir=\"$libdir\"
|
||||||
|
])
|
||||||
|
else
|
||||||
|
additional_includedir="$withval/include"
|
||||||
|
additional_libdir="$withval/$acl_libdirstem"
|
||||||
|
if test "$acl_libdirstem2" != "$acl_libdirstem" \
|
||||||
|
&& ! test -d "$withval/$acl_libdirstem"; then
|
||||||
|
additional_libdir="$withval/$acl_libdirstem2"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
dnl Search the library and its dependencies in $additional_libdir and
|
||||||
|
dnl $LDFLAGS. Using breadth-first-seach.
|
||||||
|
LIB[]NAME=
|
||||||
|
LTLIB[]NAME=
|
||||||
|
INC[]NAME=
|
||||||
|
LIB[]NAME[]_PREFIX=
|
||||||
|
rpathdirs=
|
||||||
|
ltrpathdirs=
|
||||||
|
names_already_handled=
|
||||||
|
names_next_round='$1 $2'
|
||||||
|
while test -n "$names_next_round"; do
|
||||||
|
names_this_round="$names_next_round"
|
||||||
|
names_next_round=
|
||||||
|
for name in $names_this_round; do
|
||||||
|
already_handled=
|
||||||
|
for n in $names_already_handled; do
|
||||||
|
if test "$n" = "$name"; then
|
||||||
|
already_handled=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$already_handled"; then
|
||||||
|
names_already_handled="$names_already_handled $name"
|
||||||
|
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
|
||||||
|
dnl or AC_LIB_HAVE_LINKFLAGS call.
|
||||||
|
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
|
||||||
|
eval value=\"\$HAVE_LIB$uppername\"
|
||||||
|
if test -n "$value"; then
|
||||||
|
if test "$value" = yes; then
|
||||||
|
eval value=\"\$LIB$uppername\"
|
||||||
|
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
|
||||||
|
eval value=\"\$LTLIB$uppername\"
|
||||||
|
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
|
||||||
|
else
|
||||||
|
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
|
||||||
|
dnl that this library doesn't exist. So just drop it.
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
|
||||||
|
dnl and the already constructed $LIBNAME/$LTLIBNAME.
|
||||||
|
found_dir=
|
||||||
|
found_la=
|
||||||
|
found_so=
|
||||||
|
found_a=
|
||||||
|
eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
|
||||||
|
if test -n "$acl_shlibext"; then
|
||||||
|
shrext=".$acl_shlibext" # typically: shrext=.so
|
||||||
|
else
|
||||||
|
shrext=
|
||||||
|
fi
|
||||||
|
if test $use_additional = yes; then
|
||||||
|
dir="$additional_libdir"
|
||||||
|
dnl The same code as in the loop below:
|
||||||
|
dnl First look for a shared library.
|
||||||
|
if test -n "$acl_shlibext"; then
|
||||||
|
if test -f "$dir/$libname$shrext"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_so="$dir/$libname$shrext"
|
||||||
|
else
|
||||||
|
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
|
||||||
|
ver=`(cd "$dir" && \
|
||||||
|
for f in "$libname$shrext".*; do echo "$f"; done \
|
||||||
|
| sed -e "s,^$libname$shrext\\\\.,," \
|
||||||
|
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
|
||||||
|
| sed 1q ) 2>/dev/null`
|
||||||
|
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_so="$dir/$libname$shrext.$ver"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
eval library_names=\"$acl_library_names_spec\"
|
||||||
|
for f in $library_names; do
|
||||||
|
if test -f "$dir/$f"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_so="$dir/$f"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
dnl Then look for a static library.
|
||||||
|
if test "X$found_dir" = "X"; then
|
||||||
|
if test -f "$dir/$libname.$acl_libext"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_a="$dir/$libname.$acl_libext"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "X$found_dir" != "X"; then
|
||||||
|
if test -f "$dir/$libname.la"; then
|
||||||
|
found_la="$dir/$libname.la"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "X$found_dir" = "X"; then
|
||||||
|
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
case "$x" in
|
||||||
|
-L*)
|
||||||
|
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||||
|
dnl First look for a shared library.
|
||||||
|
if test -n "$acl_shlibext"; then
|
||||||
|
if test -f "$dir/$libname$shrext"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_so="$dir/$libname$shrext"
|
||||||
|
else
|
||||||
|
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
|
||||||
|
ver=`(cd "$dir" && \
|
||||||
|
for f in "$libname$shrext".*; do echo "$f"; done \
|
||||||
|
| sed -e "s,^$libname$shrext\\\\.,," \
|
||||||
|
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
|
||||||
|
| sed 1q ) 2>/dev/null`
|
||||||
|
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_so="$dir/$libname$shrext.$ver"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
eval library_names=\"$acl_library_names_spec\"
|
||||||
|
for f in $library_names; do
|
||||||
|
if test -f "$dir/$f"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_so="$dir/$f"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
dnl Then look for a static library.
|
||||||
|
if test "X$found_dir" = "X"; then
|
||||||
|
if test -f "$dir/$libname.$acl_libext"; then
|
||||||
|
found_dir="$dir"
|
||||||
|
found_a="$dir/$libname.$acl_libext"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "X$found_dir" != "X"; then
|
||||||
|
if test -f "$dir/$libname.la"; then
|
||||||
|
found_la="$dir/$libname.la"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if test "X$found_dir" != "X"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if test "X$found_dir" != "X"; then
|
||||||
|
dnl Found the library.
|
||||||
|
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
|
||||||
|
if test "X$found_so" != "X"; then
|
||||||
|
dnl Linking with a shared library. We attempt to hardcode its
|
||||||
|
dnl directory into the executable's runpath, unless it's the
|
||||||
|
dnl standard /usr/lib.
|
||||||
|
if test "$enable_rpath" = no \
|
||||||
|
|| test "X$found_dir" = "X/usr/$acl_libdirstem" \
|
||||||
|
|| test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
|
||||||
|
dnl No hardcoding is needed.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||||
|
else
|
||||||
|
dnl Use an explicit option to hardcode DIR into the resulting
|
||||||
|
dnl binary.
|
||||||
|
dnl Potentially add DIR to ltrpathdirs.
|
||||||
|
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
|
||||||
|
haveit=
|
||||||
|
for x in $ltrpathdirs; do
|
||||||
|
if test "X$x" = "X$found_dir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
ltrpathdirs="$ltrpathdirs $found_dir"
|
||||||
|
fi
|
||||||
|
dnl The hardcoding into $LIBNAME is system dependent.
|
||||||
|
if test "$acl_hardcode_direct" = yes; then
|
||||||
|
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
|
||||||
|
dnl resulting binary.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||||
|
else
|
||||||
|
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
|
||||||
|
dnl Use an explicit option to hardcode DIR into the resulting
|
||||||
|
dnl binary.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||||
|
dnl Potentially add DIR to rpathdirs.
|
||||||
|
dnl The rpathdirs will be appended to $LIBNAME at the end.
|
||||||
|
haveit=
|
||||||
|
for x in $rpathdirs; do
|
||||||
|
if test "X$x" = "X$found_dir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
rpathdirs="$rpathdirs $found_dir"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
dnl Rely on "-L$found_dir".
|
||||||
|
dnl But don't add it if it's already contained in the LDFLAGS
|
||||||
|
dnl or the already constructed $LIBNAME
|
||||||
|
haveit=
|
||||||
|
for x in $LDFLAGS $LIB[]NAME; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X-L$found_dir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
|
||||||
|
fi
|
||||||
|
if test "$acl_hardcode_minus_L" != no; then
|
||||||
|
dnl FIXME: Not sure whether we should use
|
||||||
|
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||||
|
dnl here.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||||
|
else
|
||||||
|
dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
|
||||||
|
dnl here, because this doesn't fit in flags passed to the
|
||||||
|
dnl compiler. So give up. No hardcoding. This affects only
|
||||||
|
dnl very old systems.
|
||||||
|
dnl FIXME: Not sure whether we should use
|
||||||
|
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||||
|
dnl here.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if test "X$found_a" != "X"; then
|
||||||
|
dnl Linking with a static library.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
|
||||||
|
else
|
||||||
|
dnl We shouldn't come here, but anyway it's good to have a
|
||||||
|
dnl fallback.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
dnl Assume the include files are nearby.
|
||||||
|
additional_includedir=
|
||||||
|
case "$found_dir" in
|
||||||
|
*/$acl_libdirstem | */$acl_libdirstem/)
|
||||||
|
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
|
||||||
|
if test "$name" = '$1'; then
|
||||||
|
LIB[]NAME[]_PREFIX="$basedir"
|
||||||
|
fi
|
||||||
|
additional_includedir="$basedir/include"
|
||||||
|
;;
|
||||||
|
*/$acl_libdirstem2 | */$acl_libdirstem2/)
|
||||||
|
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
|
||||||
|
if test "$name" = '$1'; then
|
||||||
|
LIB[]NAME[]_PREFIX="$basedir"
|
||||||
|
fi
|
||||||
|
additional_includedir="$basedir/include"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if test "X$additional_includedir" != "X"; then
|
||||||
|
dnl Potentially add $additional_includedir to $INCNAME.
|
||||||
|
dnl But don't add it
|
||||||
|
dnl 1. if it's the standard /usr/include,
|
||||||
|
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
|
||||||
|
dnl 3. if it's already present in $CPPFLAGS or the already
|
||||||
|
dnl constructed $INCNAME,
|
||||||
|
dnl 4. if it doesn't exist as a directory.
|
||||||
|
if test "X$additional_includedir" != "X/usr/include"; then
|
||||||
|
haveit=
|
||||||
|
if test "X$additional_includedir" = "X/usr/local/include"; then
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
case $host_os in
|
||||||
|
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
for x in $CPPFLAGS $INC[]NAME; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X${i_system}$additional_includedir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test -d "$additional_includedir"; then
|
||||||
|
dnl Really add $additional_includedir to $INCNAME.
|
||||||
|
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }${i_system}$additional_includedir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
dnl Look for dependencies.
|
||||||
|
if test -n "$found_la"; then
|
||||||
|
dnl Read the .la file. It defines the variables
|
||||||
|
dnl dlname, library_names, old_library, dependency_libs, current,
|
||||||
|
dnl age, revision, installed, dlopen, dlpreopen, libdir.
|
||||||
|
save_libdir="$libdir"
|
||||||
|
case "$found_la" in
|
||||||
|
*/* | *\\*) . "$found_la" ;;
|
||||||
|
*) . "./$found_la" ;;
|
||||||
|
esac
|
||||||
|
libdir="$save_libdir"
|
||||||
|
dnl We use only dependency_libs.
|
||||||
|
for dep in $dependency_libs; do
|
||||||
|
case "$dep" in
|
||||||
|
-L*)
|
||||||
|
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
|
||||||
|
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
|
||||||
|
dnl But don't add it
|
||||||
|
dnl 1. if it's the standard /usr/lib,
|
||||||
|
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
|
||||||
|
dnl 3. if it's already present in $LDFLAGS or the already
|
||||||
|
dnl constructed $LIBNAME,
|
||||||
|
dnl 4. if it doesn't exist as a directory.
|
||||||
|
if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
|
||||||
|
&& test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
|
||||||
|
haveit=
|
||||||
|
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
|
||||||
|
|| test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
case $host_os in
|
||||||
|
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
haveit=
|
||||||
|
for x in $LDFLAGS $LIB[]NAME; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X-L$additional_libdir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test -d "$additional_libdir"; then
|
||||||
|
dnl Really add $additional_libdir to $LIBNAME.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
haveit=
|
||||||
|
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X-L$additional_libdir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test -d "$additional_libdir"; then
|
||||||
|
dnl Really add $additional_libdir to $LTLIBNAME.
|
||||||
|
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-R*)
|
||||||
|
dir=`echo "X$dep" | sed -e 's/^X-R//'`
|
||||||
|
if test "$enable_rpath" != no; then
|
||||||
|
dnl Potentially add DIR to rpathdirs.
|
||||||
|
dnl The rpathdirs will be appended to $LIBNAME at the end.
|
||||||
|
haveit=
|
||||||
|
for x in $rpathdirs; do
|
||||||
|
if test "X$x" = "X$dir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
rpathdirs="$rpathdirs $dir"
|
||||||
|
fi
|
||||||
|
dnl Potentially add DIR to ltrpathdirs.
|
||||||
|
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
|
||||||
|
haveit=
|
||||||
|
for x in $ltrpathdirs; do
|
||||||
|
if test "X$x" = "X$dir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
ltrpathdirs="$ltrpathdirs $dir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-l*)
|
||||||
|
dnl Handle this in the next round.
|
||||||
|
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
|
||||||
|
;;
|
||||||
|
*.la)
|
||||||
|
dnl Handle this in the next round. Throw away the .la's
|
||||||
|
dnl directory; it is already contained in a preceding -L
|
||||||
|
dnl option.
|
||||||
|
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
dnl Most likely an immediate library name.
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
|
||||||
|
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
dnl Didn't find the library; assume it is in the system directories
|
||||||
|
dnl known to the linker and runtime loader. (All the system
|
||||||
|
dnl directories known to the linker should also be known to the
|
||||||
|
dnl runtime loader, otherwise the system is severely misconfigured.)
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
|
||||||
|
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
if test "X$rpathdirs" != "X"; then
|
||||||
|
if test -n "$acl_hardcode_libdir_separator"; then
|
||||||
|
dnl Weird platform: only the last -rpath option counts, the user must
|
||||||
|
dnl pass all path elements in one option. We can arrange that for a
|
||||||
|
dnl single library, but not when more than one $LIBNAMEs are used.
|
||||||
|
alldirs=
|
||||||
|
for found_dir in $rpathdirs; do
|
||||||
|
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
|
||||||
|
done
|
||||||
|
dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
|
||||||
|
acl_save_libdir="$libdir"
|
||||||
|
libdir="$alldirs"
|
||||||
|
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||||
|
libdir="$acl_save_libdir"
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||||
|
else
|
||||||
|
dnl The -rpath options are cumulative.
|
||||||
|
for found_dir in $rpathdirs; do
|
||||||
|
acl_save_libdir="$libdir"
|
||||||
|
libdir="$found_dir"
|
||||||
|
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||||
|
libdir="$acl_save_libdir"
|
||||||
|
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "X$ltrpathdirs" != "X"; then
|
||||||
|
dnl When using libtool, the option that works for both libraries and
|
||||||
|
dnl executables is -R. The -R options are cumulative.
|
||||||
|
for found_dir in $ltrpathdirs; do
|
||||||
|
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
popdef([P_A_C_K])
|
||||||
|
popdef([PACKLIBS])
|
||||||
|
popdef([PACKUP])
|
||||||
|
popdef([PACK])
|
||||||
|
popdef([NAME])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
|
||||||
|
dnl unless already present in VAR.
|
||||||
|
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
|
||||||
|
dnl contains two or three consecutive elements that belong together.
|
||||||
|
AC_DEFUN([AC_LIB_APPENDTOVAR],
|
||||||
|
[
|
||||||
|
for element in [$2]; do
|
||||||
|
haveit=
|
||||||
|
for x in $[$1]; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X$element"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
[$1]="${[$1]}${[$1]:+ }$element"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl For those cases where a variable contains several -L and -l options
|
||||||
|
dnl referring to unknown libraries and directories, this macro determines the
|
||||||
|
dnl necessary additional linker options for the runtime path.
|
||||||
|
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
|
||||||
|
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
|
||||||
|
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
|
||||||
|
dnl otherwise linking without libtool is assumed.
|
||||||
|
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([AC_LIB_RPATH])
|
||||||
|
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||||
|
$1=
|
||||||
|
if test "$enable_rpath" != no; then
|
||||||
|
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
|
||||||
|
dnl Use an explicit option to hardcode directories into the resulting
|
||||||
|
dnl binary.
|
||||||
|
rpathdirs=
|
||||||
|
next=
|
||||||
|
for opt in $2; do
|
||||||
|
if test -n "$next"; then
|
||||||
|
dir="$next"
|
||||||
|
dnl No need to hardcode the standard /usr/lib.
|
||||||
|
if test "X$dir" != "X/usr/$acl_libdirstem" \
|
||||||
|
&& test "X$dir" != "X/usr/$acl_libdirstem2"; then
|
||||||
|
rpathdirs="$rpathdirs $dir"
|
||||||
|
fi
|
||||||
|
next=
|
||||||
|
else
|
||||||
|
case $opt in
|
||||||
|
-L) next=yes ;;
|
||||||
|
-L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
|
||||||
|
dnl No need to hardcode the standard /usr/lib.
|
||||||
|
if test "X$dir" != "X/usr/$acl_libdirstem" \
|
||||||
|
&& test "X$dir" != "X/usr/$acl_libdirstem2"; then
|
||||||
|
rpathdirs="$rpathdirs $dir"
|
||||||
|
fi
|
||||||
|
next= ;;
|
||||||
|
*) next= ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test "X$rpathdirs" != "X"; then
|
||||||
|
if test -n ""$3""; then
|
||||||
|
dnl libtool is used for linking. Use -R options.
|
||||||
|
for dir in $rpathdirs; do
|
||||||
|
$1="${$1}${$1:+ }-R$dir"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
dnl The linker is used for linking directly.
|
||||||
|
if test -n "$acl_hardcode_libdir_separator"; then
|
||||||
|
dnl Weird platform: only the last -rpath option counts, the user
|
||||||
|
dnl must pass all path elements in one option.
|
||||||
|
alldirs=
|
||||||
|
for dir in $rpathdirs; do
|
||||||
|
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
|
||||||
|
done
|
||||||
|
acl_save_libdir="$libdir"
|
||||||
|
libdir="$alldirs"
|
||||||
|
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||||
|
libdir="$acl_save_libdir"
|
||||||
|
$1="$flag"
|
||||||
|
else
|
||||||
|
dnl The -rpath options are cumulative.
|
||||||
|
for dir in $rpathdirs; do
|
||||||
|
acl_save_libdir="$libdir"
|
||||||
|
libdir="$dir"
|
||||||
|
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||||
|
libdir="$acl_save_libdir"
|
||||||
|
$1="${$1}${$1:+ }$flag"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_SUBST([$1])
|
||||||
|
])
|
|
@ -0,0 +1,221 @@
|
||||||
|
# lib-prefix.m4 serial 6 (gettext-0.18)
|
||||||
|
dnl Copyright (C) 2001-2005, 2008 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl From Bruno Haible.
|
||||||
|
|
||||||
|
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
|
||||||
|
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
|
||||||
|
dnl require excessive bracketing.
|
||||||
|
ifdef([AC_HELP_STRING],
|
||||||
|
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
|
||||||
|
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
|
||||||
|
|
||||||
|
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
|
||||||
|
dnl to access previously installed libraries. The basic assumption is that
|
||||||
|
dnl a user will want packages to use other packages he previously installed
|
||||||
|
dnl with the same --prefix option.
|
||||||
|
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
|
||||||
|
dnl libraries, but is otherwise very convenient.
|
||||||
|
AC_DEFUN([AC_LIB_PREFIX],
|
||||||
|
[
|
||||||
|
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
|
||||||
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
|
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||||
|
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||||
|
dnl By default, look in $includedir and $libdir.
|
||||||
|
use_additional=yes
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([
|
||||||
|
eval additional_includedir=\"$includedir\"
|
||||||
|
eval additional_libdir=\"$libdir\"
|
||||||
|
])
|
||||||
|
AC_LIB_ARG_WITH([lib-prefix],
|
||||||
|
[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
|
||||||
|
--without-lib-prefix don't search for libraries in includedir and libdir],
|
||||||
|
[
|
||||||
|
if test "X$withval" = "Xno"; then
|
||||||
|
use_additional=no
|
||||||
|
else
|
||||||
|
if test "X$withval" = "X"; then
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([
|
||||||
|
eval additional_includedir=\"$includedir\"
|
||||||
|
eval additional_libdir=\"$libdir\"
|
||||||
|
])
|
||||||
|
else
|
||||||
|
additional_includedir="$withval/include"
|
||||||
|
additional_libdir="$withval/$acl_libdirstem"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
if test $use_additional = yes; then
|
||||||
|
dnl Potentially add $additional_includedir to $CPPFLAGS.
|
||||||
|
dnl But don't add it
|
||||||
|
dnl 1. if it's the standard /usr/include,
|
||||||
|
dnl 2. if it's already present in $CPPFLAGS,
|
||||||
|
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
|
||||||
|
dnl 4. if it doesn't exist as a directory.
|
||||||
|
if test "X$additional_includedir" != "X/usr/include"; then
|
||||||
|
haveit=
|
||||||
|
for x in $CPPFLAGS; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X-I$additional_includedir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test "X$additional_includedir" = "X/usr/local/include"; then
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
case $host_os in
|
||||||
|
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test -d "$additional_includedir"; then
|
||||||
|
dnl Really add $additional_includedir to $CPPFLAGS.
|
||||||
|
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
dnl Potentially add $additional_libdir to $LDFLAGS.
|
||||||
|
dnl But don't add it
|
||||||
|
dnl 1. if it's the standard /usr/lib,
|
||||||
|
dnl 2. if it's already present in $LDFLAGS,
|
||||||
|
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
|
||||||
|
dnl 4. if it doesn't exist as a directory.
|
||||||
|
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
|
||||||
|
haveit=
|
||||||
|
for x in $LDFLAGS; do
|
||||||
|
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||||
|
if test "X$x" = "X-L$additional_libdir"; then
|
||||||
|
haveit=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
case $host_os in
|
||||||
|
linux*) haveit=yes;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$haveit"; then
|
||||||
|
if test -d "$additional_libdir"; then
|
||||||
|
dnl Really add $additional_libdir to $LDFLAGS.
|
||||||
|
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
|
||||||
|
dnl acl_final_exec_prefix, containing the values to which $prefix and
|
||||||
|
dnl $exec_prefix will expand at the end of the configure script.
|
||||||
|
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
|
||||||
|
[
|
||||||
|
dnl Unfortunately, prefix and exec_prefix get only finally determined
|
||||||
|
dnl at the end of configure.
|
||||||
|
if test "X$prefix" = "XNONE"; then
|
||||||
|
acl_final_prefix="$ac_default_prefix"
|
||||||
|
else
|
||||||
|
acl_final_prefix="$prefix"
|
||||||
|
fi
|
||||||
|
if test "X$exec_prefix" = "XNONE"; then
|
||||||
|
acl_final_exec_prefix='${prefix}'
|
||||||
|
else
|
||||||
|
acl_final_exec_prefix="$exec_prefix"
|
||||||
|
fi
|
||||||
|
acl_save_prefix="$prefix"
|
||||||
|
prefix="$acl_final_prefix"
|
||||||
|
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
|
||||||
|
prefix="$acl_save_prefix"
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
|
||||||
|
dnl variables prefix and exec_prefix bound to the values they will have
|
||||||
|
dnl at the end of the configure script.
|
||||||
|
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
|
||||||
|
[
|
||||||
|
acl_save_prefix="$prefix"
|
||||||
|
prefix="$acl_final_prefix"
|
||||||
|
acl_save_exec_prefix="$exec_prefix"
|
||||||
|
exec_prefix="$acl_final_exec_prefix"
|
||||||
|
$1
|
||||||
|
exec_prefix="$acl_save_exec_prefix"
|
||||||
|
prefix="$acl_save_prefix"
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl AC_LIB_PREPARE_MULTILIB creates
|
||||||
|
dnl - a variable acl_libdirstem, containing the basename of the libdir, either
|
||||||
|
dnl "lib" or "lib64" or "lib/64",
|
||||||
|
dnl - a variable acl_libdirstem2, as a secondary possible value for
|
||||||
|
dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
|
||||||
|
dnl "lib/amd64".
|
||||||
|
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
|
||||||
|
[
|
||||||
|
dnl There is no formal standard regarding lib and lib64.
|
||||||
|
dnl On glibc systems, the current practice is that on a system supporting
|
||||||
|
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
|
||||||
|
dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
|
||||||
|
dnl the compiler's default mode by looking at the compiler's library search
|
||||||
|
dnl path. If at least one of its elements ends in /lib64 or points to a
|
||||||
|
dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
|
||||||
|
dnl Otherwise we use the default, namely "lib".
|
||||||
|
dnl On Solaris systems, the current practice is that on a system supporting
|
||||||
|
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
|
||||||
|
dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
|
||||||
|
dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
|
acl_libdirstem=lib
|
||||||
|
acl_libdirstem2=
|
||||||
|
case "$host_os" in
|
||||||
|
solaris*)
|
||||||
|
dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
|
||||||
|
dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
|
||||||
|
dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
|
||||||
|
dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
|
||||||
|
dnl symlink is missing, so we set acl_libdirstem2 too.
|
||||||
|
AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
|
||||||
|
[AC_RUN_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([], [[
|
||||||
|
return sizeof(void*) == 8 ? 0 : 1;
|
||||||
|
]])
|
||||||
|
], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
|
||||||
|
])
|
||||||
|
if test $gl_cv_solaris_64bit = yes; then
|
||||||
|
acl_libdirstem=lib/64
|
||||||
|
case "$host_cpu" in
|
||||||
|
sparc*) acl_libdirstem2=lib/sparcv9 ;;
|
||||||
|
i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
|
||||||
|
if test -n "$searchpath"; then
|
||||||
|
acl_save_IFS="${IFS= }"; IFS=":"
|
||||||
|
for searchdir in $searchpath; do
|
||||||
|
if test -d "$searchdir"; then
|
||||||
|
case "$searchdir" in
|
||||||
|
*/lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
|
||||||
|
*) searchdir=`cd "$searchdir" && pwd`
|
||||||
|
case "$searchdir" in
|
||||||
|
*/lib64 ) acl_libdirstem=lib64 ;;
|
||||||
|
esac ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS="$acl_save_IFS"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
|
||||||
|
])
|
|
@ -0,0 +1,77 @@
|
||||||
|
# visibility.m4 serial 4 (gettext-0.18.2)
|
||||||
|
dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl From Bruno Haible.
|
||||||
|
|
||||||
|
dnl Tests whether the compiler supports the command-line option
|
||||||
|
dnl -fvisibility=hidden and the function and variable attributes
|
||||||
|
dnl __attribute__((__visibility__("hidden"))) and
|
||||||
|
dnl __attribute__((__visibility__("default"))).
|
||||||
|
dnl Does *not* test for __visibility__("protected") - which has tricky
|
||||||
|
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
|
||||||
|
dnl MacOS X.
|
||||||
|
dnl Does *not* test for __visibility__("internal") - which has processor
|
||||||
|
dnl dependent semantics.
|
||||||
|
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
|
||||||
|
dnl "really only recommended for legacy code".
|
||||||
|
dnl Set the variable CFLAG_VISIBILITY.
|
||||||
|
dnl Defines and sets the variable HAVE_VISIBILITY.
|
||||||
|
|
||||||
|
AC_DEFUN([gl_VISIBILITY],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
|
CFLAG_VISIBILITY=
|
||||||
|
HAVE_VISIBILITY=0
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
dnl First, check whether -Werror can be added to the command line, or
|
||||||
|
dnl whether it leads to an error because of some other option that the
|
||||||
|
dnl user has put into $CC $CFLAGS $CPPFLAGS.
|
||||||
|
AC_MSG_CHECKING([whether the -Werror option is usable])
|
||||||
|
AC_CACHE_VAL([gl_cv_cc_vis_werror], [
|
||||||
|
gl_save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -Werror"
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[gl_cv_cc_vis_werror=yes],
|
||||||
|
[gl_cv_cc_vis_werror=no])
|
||||||
|
CFLAGS="$gl_save_CFLAGS"])
|
||||||
|
AC_MSG_RESULT([$gl_cv_cc_vis_werror])
|
||||||
|
dnl Now check whether visibility declarations are supported.
|
||||||
|
AC_MSG_CHECKING([for simple visibility declarations])
|
||||||
|
AC_CACHE_VAL([gl_cv_cc_visibility], [
|
||||||
|
gl_save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||||
|
dnl We use the option -Werror and a function dummyfunc, because on some
|
||||||
|
dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
|
||||||
|
dnl "visibility attribute not supported in this configuration; ignored"
|
||||||
|
dnl at the first function definition in every compilation unit, and we
|
||||||
|
dnl don't want to use the option in this case.
|
||||||
|
if test $gl_cv_cc_vis_werror = yes; then
|
||||||
|
CFLAGS="$CFLAGS -Werror"
|
||||||
|
fi
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
|
||||||
|
extern __attribute__((__visibility__("default"))) int exportedvar;
|
||||||
|
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
|
||||||
|
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
|
||||||
|
void dummyfunc (void) {}
|
||||||
|
]],
|
||||||
|
[[]])],
|
||||||
|
[gl_cv_cc_visibility=yes],
|
||||||
|
[gl_cv_cc_visibility=no])
|
||||||
|
CFLAGS="$gl_save_CFLAGS"])
|
||||||
|
AC_MSG_RESULT([$gl_cv_cc_visibility])
|
||||||
|
if test $gl_cv_cc_visibility = yes; then
|
||||||
|
CFLAG_VISIBILITY="-fvisibility=hidden"
|
||||||
|
HAVE_VISIBILITY=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_SUBST([CFLAG_VISIBILITY])
|
||||||
|
AC_SUBST([HAVE_VISIBILITY])
|
||||||
|
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
|
||||||
|
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
|
||||||
|
])
|
|
@ -0,0 +1,37 @@
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# WOLFSSL_DARWIN_USING_CLANG
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# With the advent of Apple Xcode v5.0, the old tool sets are missing from
|
||||||
|
# the distribution. The provided "gcc" executable wrapper accepts the
|
||||||
|
# "-pthread" flag, and passes it to the underlying "clang" which chokes
|
||||||
|
# on it. This script checks the version of the gcc executable to see if
|
||||||
|
# it reports it is really "clang".
|
||||||
|
#
|
||||||
|
# The value is placed in the wolfssl_darwin_clang variable.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 John Safranek <john@wolfssl.com>
|
||||||
|
#
|
||||||
|
# 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 1
|
||||||
|
|
||||||
|
AC_DEFUN([WOLFSSL_DARWIN_USING_CLANG],
|
||||||
|
[
|
||||||
|
if test x"$CC" = xclang; then
|
||||||
|
wolfssl_darwin_clang=yes
|
||||||
|
elif test x"$CC" = x || test x"$CC" = xgcc; then
|
||||||
|
if /usr/bin/gcc -v 2>&1 | grep 'clang' >/dev/null 2>&1; then
|
||||||
|
wolfssl_darwin_clang=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Our "pre-commit" hook.
|
||||||
|
|
||||||
|
# save current config
|
||||||
|
echo "\n\nSaving current config\n\n"
|
||||||
|
cp config.status tmp.status
|
||||||
|
cp wolftpm/options.h tmp.options.h
|
||||||
|
|
||||||
|
# stash modified files not part of this commit, don't test them
|
||||||
|
echo "\n\nStashing any modified files not part of commit\n\n"
|
||||||
|
git stash -q --keep-index
|
||||||
|
|
||||||
|
# do the commit tests
|
||||||
|
echo "\n\nRunning commit tests...\n\n"
|
||||||
|
./commit-tests.sh
|
||||||
|
RESULT=$?
|
||||||
|
|
||||||
|
# restore modified files not part of this commit
|
||||||
|
echo "\n\nPopping any stashed modified files not part of commit\n"
|
||||||
|
git stash pop -q
|
||||||
|
|
||||||
|
# restore current config
|
||||||
|
echo "\nRestoring current config\n"
|
||||||
|
mv tmp.status config.status
|
||||||
|
# don't show output incase error from above
|
||||||
|
./config.status >/dev/null 2>&1
|
||||||
|
mv tmp.options.h wolftpm/options.h
|
||||||
|
make clean >/dev/null 2>&1
|
||||||
|
make -j 8 >/dev/null 2>&1
|
||||||
|
|
||||||
|
[ $RESULT -ne 0 ] && echo "\nOops, your commit failed\n" && exit 1
|
||||||
|
|
||||||
|
echo "\nCommit tests passed!\n"
|
||||||
|
exit 0
|
|
@ -0,0 +1,12 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# included from Top Level Makefile.am
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
|
||||||
|
lib_LTLIBRARIES+= src/libwolftpm.la
|
||||||
|
src_libwolftpm_la_SOURCES = src/tpm2.c
|
||||||
|
src_libwolftpm_la_CFLAGS = -DBUILDING_WOLFTPM $(AM_CFLAGS)
|
||||||
|
src_libwolftpm_la_CPPFLAGS = -DBUILDING_WOLFTPM $(AM_CPPFLAGS)
|
||||||
|
src_libwolftpm_la_LDFLAGS = ${AM_LDFLAGS} -no-undefined -version-info ${WOLFMQTT_LIBRARY_VERSION}
|
||||||
|
src_libwolftpm_la_DEPENDENCIES =
|
||||||
|
EXTRA_DIST +=
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
# vim:ft=automake
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
#
|
||||||
|
|
||||||
|
nobase_include_HEADERS+= \
|
||||||
|
wolftpm/tpm2.h \
|
||||||
|
wolftpm/version.h \
|
||||||
|
wolftpm/visibility.h
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,42 @@
|
||||||
|
/* version.h.in
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2018 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfTPM.
|
||||||
|
*
|
||||||
|
* wolfTPM 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.
|
||||||
|
*
|
||||||
|
* wolfTPM 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The version header provides the current version number to the code
|
||||||
|
* based and is updated automatically by the configure script. A copy
|
||||||
|
* of the last generated copy of version.h is included with the
|
||||||
|
* distribution for environments that do not use configure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LIBWOLFTPM_VERSION_STRING "0.1.0"
|
||||||
|
#define LIBWOLFTPM_VERSION_HEX 0x00001000
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* version.h.in
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2018 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfTPM.
|
||||||
|
*
|
||||||
|
* wolfTPM 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.
|
||||||
|
*
|
||||||
|
* wolfTPM 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The version header provides the current version number to the code
|
||||||
|
* based and is updated automatically by the configure script. A copy
|
||||||
|
* of the last generated copy of version.h is included with the
|
||||||
|
* distribution for environments that do not use configure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LIBWOLFTPM_VERSION_STRING "@VERSION@"
|
||||||
|
#define LIBWOLFTPM_VERSION_HEX @HEX_VERSION@
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,61 @@
|
||||||
|
/* visibility.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2018 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of wolfMQTT.
|
||||||
|
*
|
||||||
|
* wolfMQTT 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.
|
||||||
|
*
|
||||||
|
* wolfMQTT 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Visibility control macros */
|
||||||
|
|
||||||
|
#ifndef WOLFMQTT_VISIBILITY_H
|
||||||
|
#define WOLFMQTT_VISIBILITY_H
|
||||||
|
|
||||||
|
/* WOLFMQTT_API is used for the public API symbols.
|
||||||
|
It either imports or exports (or does nothing for static builds)
|
||||||
|
|
||||||
|
WOLFMQTT_LOCAL is used for non-API symbols (private).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(BUILDING_WOLFMQTT)
|
||||||
|
#if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
|
||||||
|
#define WOLFMQTT_API __attribute__ ((visibility("default")))
|
||||||
|
#define WOLFMQTT_LOCAL __attribute__ ((visibility("hidden")))
|
||||||
|
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||||
|
#define WOLFMQTT_API __global
|
||||||
|
#define WOLFMQTT_LOCAL __hidden
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#ifdef _WINDLL
|
||||||
|
#define WOLFMQTT_API __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define WOLFMQTT_API
|
||||||
|
#endif
|
||||||
|
#define WOLFMQTT_LOCAL
|
||||||
|
#else
|
||||||
|
#define WOLFMQTT_API
|
||||||
|
#define WOLFMQTT_LOCAL
|
||||||
|
#endif /* HAVE_VISIBILITY */
|
||||||
|
#else /* BUILDING_WOLFMQTT */
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define WOLFMQTT_API __declspec(dllimport)
|
||||||
|
#define WOLFMQTT_LOCAL
|
||||||
|
#else
|
||||||
|
#define WOLFMQTT_API
|
||||||
|
#define WOLFMQTT_LOCAL
|
||||||
|
#endif
|
||||||
|
#endif /* BUILDING_WOLFMQTT */
|
||||||
|
|
||||||
|
#endif /* WOLFMQTT_VISIBILITY_H */
|
Loading…
Reference in New Issue