Skip to content

Commit

Permalink
Use bundled MD5 if the global one is not usable
Browse files Browse the repository at this point in the history
Lately, there have been a lot of usability troubles with the MD5
digesting function on the OS X. Since, the solution from the commit
e2ef34f seems not to work properly, we will provide bundled version
of this algorithm - the public domain one.

Fixes #8
  • Loading branch information
arkq committed Jan 6, 2017
1 parent 54ae660 commit 6334d95
Show file tree
Hide file tree
Showing 3 changed files with 342 additions and 34 deletions.
51 changes: 26 additions & 25 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
# cmusfm - configure.ac
# Copyright (c) 2014-2016 Arkadiusz Bokowy
# Copyright (c) 2014-2017 Arkadiusz Bokowy

AC_INIT([cmusfm], [0.3.0], [[email protected]])
AC_CONFIG_HEADERS([config.h])
AC_PREREQ([2.59])
AC_INIT([cmusfm], [0.3.2], [[email protected]])
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])

AC_CONFIG_HEADERS([config.h])

AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_CC_C_O

# support for debugging
AC_ARG_ENABLE(
[debug],
AS_HELP_STRING([--enable-debug], [enable debugging support])
)
AS_IF([test "x$enable_debug" = "xyes"],
[AC_DEFINE([DEBUG], [1], [Define to 1 if the debugging is enabled])]
)

AC_CHECK_HEADERS(
[poll.h],
[], [AC_MSG_ERROR([poll.h header not found])]
)
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [enable debugging support]))
AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
AM_COND_IF([ENABLE_DEBUG], [
AC_DEFINE([DEBUG], [1], [Define to 1 if the debugging is enabled.])
])

AC_CHECK_HEADERS([poll.h],
[], [AC_MSG_ERROR([poll.h header not found])])

# support for configuration reload
AC_CHECK_HEADERS([sys/inotify.h])

# support for system-wide MD5
LIBCRYPTO_CFLAGS=
LIBCRYPTO_LIBS=
AC_CHECK_HEADERS([openssl/md5.h], [
PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
])

PKG_CHECK_MODULES([LIBCURL], [libcurl])
PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])

# support for desktop notifications
AC_ARG_ENABLE(
[libnotify],
AS_HELP_STRING([--enable-libnotify], [enable libnotify support])
)
AC_ARG_ENABLE([libnotify],
AS_HELP_STRING([--enable-libnotify], [enable libnotify support]))
AM_CONDITIONAL([ENABLE_LIBNOTIFY], [test "x$enable_libnotify" = "xyes"])
AS_IF([test "x$enable_libnotify" = "xyes"], [
PKG_CHECK_MODULES(
[LIBNOTIFY], [libnotify >= 0.7],
[AC_DEFINE([ENABLE_LIBNOTIFY], [1], [Define to 1 if the libnotify is enabled])]
)
AM_COND_IF([ENABLE_LIBNOTIFY], [
PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= 0.7])
])

AC_CONFIG_FILES([Makefile src/Makefile test/Makefile])
Expand Down
11 changes: 2 additions & 9 deletions src/libscrobbler2.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* cmusfm - libscrobbler2.c
* Copyright (c) 2011-2016 Arkadiusz Bokowy
* Copyright (c) 2011-2017 Arkadiusz Bokowy
*
* This file is a part of a cmusfm.
*
Expand Down Expand Up @@ -30,15 +30,8 @@
#include <string.h>
#include <curl/curl.h>

#if defined(__APPLE__)
# define COMMON_DIGEST_FOR_OPENSSL
# include <CommonCrypto/CommonDigest.h>
# define MD5 CC_MD5
#else
# include <openssl/md5.h>
#endif

#include "debug.h"
#include "md5.c"


static char *mem2hex(char *dest, const unsigned char *mem, size_t n);
Expand Down
Loading

0 comments on commit 6334d95

Please sign in to comment.