Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ fi

CFLAGS="$CACHED_CFLAGS"

# check if libirecovery has irecv_init (older API)
CACHED_CFLAGS2="$CFLAGS"
CFLAGS+=" $libirecovery_CFLAGS"
AC_CACHE_CHECK([for irecv_init in libirecovery], [ac_cv_have_irecv_init],
AC_TRY_COMPILE([
#include <libirecovery.h>
], [
irecv_init();
return 0;
], ac_cv_have_irecv_init=yes, ac_cv_have_irecv_init=no))
if test "$ac_cv_have_irecv_init" = "yes"; then
AC_DEFINE([HAVE_IRECV_INIT], [1], [Define if libirecovery provides irecv_init])
fi
CFLAGS="$CACHED_CFLAGS2"

AC_ARG_WITH([openssl],
[AS_HELP_STRING([--without-openssl],
[Do not use OpenSSL])],
Expand Down
7 changes: 7 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ extern "C" {
#include <plist/plist.h>
#include <libirecovery.h>

/* Backward compatibility for libirecovery API changes */
#ifdef HAVE_IRECV_INIT
#define IRECV_MAYBE_INIT() irecv_init()
#else
#define IRECV_MAYBE_INIT() ((void)0)
#endif

#include "idevicerestore.h"
#include "thread.h"

Expand Down
4 changes: 2 additions & 2 deletions src/dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int dfu_check_mode(struct idevicerestore_client_t* client, int* mode) {
return -1;
}

irecv_init();
IRECV_MAYBE_INIT();
if (irecv_open_with_ecid(&dfu, client->ecid) != IRECV_E_SUCCESS) {
return -1;
}
Expand All @@ -119,7 +119,7 @@ irecv_device_t dfu_get_irecv_device(struct idevicerestore_client_t* client) {
irecv_error_t dfu_error = IRECV_E_SUCCESS;
irecv_device_t device = NULL;

irecv_init();
IRECV_MAYBE_INIT();
if (irecv_open_with_ecid(&dfu, client->ecid) != IRECV_E_SUCCESS) {
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int recovery_check_mode(struct idevicerestore_client_t* client) {
return -1;
}

irecv_init();
IRECV_MAYBE_INIT();
recovery_error=irecv_open_with_ecid(&recovery, client->ecid);

if (recovery_error != IRECV_E_SUCCESS) {
Expand Down