Skip to content

Commit

Permalink
don't use deprecated header nettle/sha.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Dreik committed Jan 11, 2025
1 parent 4af3a40 commit d10254c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 39 deletions.
3 changes: 2 additions & 1 deletion Checksum.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <cstddef>

#include <nettle/md5.h>
#include <nettle/sha.h>
#include <nettle/sha1.h>
#include <nettle/sha2.h>

/**
* class for checksum calculation
Expand Down
74 changes: 36 additions & 38 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ dnl for assert() support
AC_HEADER_ASSERT

dnl test for nettle
AC_CHECK_HEADER(nettle/sha.h,,[AC_MSG_ERROR([
AC_CHECK_HEADER(nettle/sha1.h,,[AC_MSG_ERROR([
nettle header files missing. Please install nettle
first. If you have already done so and get this error message
anyway, it may be installed somewhere else, maybe because you
don't have root access. Pass CPPFLAGS=-I/your/path/to/nettle to configure
and try again. The path should be so that \#include "nettle/sha.h" works.
and try again. The path should be so that \#include "nettle/sha1.h" works.
On Debian-ish systems, use "apt-get install nettle-dev" to get a system
wide nettle install.
])])
Expand All @@ -62,7 +62,9 @@ AC_SYS_LARGEFILE

dnl make sure we have c++11 or better,
AC_MSG_CHECKING([for C++11 support or better])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int f() { auto a=1;return a;}])],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int f() {
auto a = 1;
return a;}])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([no c++11 support, please set CXXFLAGS properly])])

Expand Down Expand Up @@ -128,21 +130,20 @@ if test "x$set_more_warnings" != xno; then
-Wextra-semi \
-Wbiznafronck"

#these warnings were tried but deemed unuseful for this project:
# -Wunsafe-loop-optimizations \

for option in $warning_options ; do
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $uwoption $option"
AC_MSG_CHECKING([whether compiler understands $option])
dnl Include a system header so we ignore Werror=... flags
dnl that cause trouble.
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <stdio.h>]], [])],
[has_option=yes],
[has_option=no])
CXXFLAGS="$SAVE_CXXFLAGS"
if test $has_option = yes; then
#these warnings were tried but deemed unuseful for this project:
#- Wunsafe - loop - optimizations \

for option in $warning_options ;
do
SAVE_CXXFLAGS = "$CXXFLAGS" CXXFLAGS =
"$CXXFLAGS $uwoption $option" AC_MSG_CHECKING(
[whether compiler understands $option])
dnl Include a system header so we ignore Werror =
... flags dnl that cause trouble.AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include<stdio.h>]], [])],
[has_option = yes],
[has_option = no]) CXXFLAGS = "$SAVE_CXXFLAGS" if test $has_option =
yes; then
CXXFLAGS="$CXXFLAGS $option"
fi
AC_MSG_RESULT(got result $has_option)
Expand All @@ -159,29 +160,26 @@ AC_MSG_CHECKING([check for fallthrough support])
define([str],[[[[fallthrough]]]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
int f() {
switch(1){
case 1:
[[fallthrough]];
case 2:
return 2;
switch (1) {
case 1:
[[fallthrough]];
case 2:
return 2;
};
}
]], [])],
[has_fallthrough=yes],
[has_fallthrough=no])
AC_MSG_RESULT($has_fallthrough)
if test $has_fallthrough = yes; then
AC_DEFINE(FALLTHROUGH, [str], "support for c++17 fallthrough")
else
AC_DEFINE(FALLTHROUGH, [], "support for c++17 fallthrough")
fi

dnl valgrind support
dnl unfortunately it makes checking much slower
dnl even if valgrind is not used, so leave it inactive.
dnl AX_VALGRIND_CHECK
dnl
dnl instead, just use "VALGRIND=valgrind make check" to test with valgrind
dnl read Makefile.in and write Makefile
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
if test $has_fallthrough = yes;
then
AC_DEFINE(FALLTHROUGH, [str], "support for c++17 fallthrough") else AC_DEFINE(
FALLTHROUGH,
[],
"support for c++17 fallthrough") fi

dnl valgrind support dnl unfortunately it makes checking much slower dnl even
if valgrind is not used,
so leave it inactive.dnl AX_VALGRIND_CHECK dnl dnl instead,
just use "VALGRIND=valgrind make check" to test with valgrind dnl read
Makefile.in and write Makefile AC_CONFIG_FILES([Makefile]) AC_OUTPUT

0 comments on commit d10254c

Please sign in to comment.