Only compile ssh module if using SSH and another hack to prevent a compiler warning about undefined EXV_USE_SSH.

This commit is contained in:
Andreas Huggel 2015-06-18 02:46:09 +00:00
parent 4e96e2742a
commit ade51daf7f
8 changed files with 36 additions and 26 deletions

View File

@ -111,6 +111,7 @@ CURL_LDFLAGS = @CURL_LDFLAGS@
CURL_LIBS = @CURL_LIBS@
# Libssh need for SshIO if it's selected
USE_SSH = @USE_SSH@
SSH_CPPFLAGS = @SSH_CPPFLAGS@
SSH_LDFLAGS = @SSH_LDFLAGS@
SSH_LIBS = @SSH_LIBS@

View File

@ -234,7 +234,7 @@ if test "$enable_webready" = "yes"; then
SSH_LIBS=
AC_CHECK_HEADERS(libssh/libssh.h,
AC_CHECK_LIB(ssh, ssh_new,[
USE_SSH=yes
USE_SSH=1
AC_DEFINE([USE_SSH], [1], [Use libssh library])
SSH_LIBS="-lssh"
if test "x${SSH_DIR}" != "x"; then
@ -248,6 +248,7 @@ if test "$enable_webready" = "yes"; then
AC_SUBST(SSH_LDFLAGS)
AC_SUBST(SSH_LIBS)
fi
AC_SUBST(USE_SSH,$USE_SSH)
CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}
fi
@ -405,8 +406,8 @@ yes) echo "-- Using Lib Curl................. YES" ;;
echo "" ;;
esac
case "$USE_SSH" in
yes) echo "-- Using Lib SSH.................. YES" ;;
case "x$USE_SSH" in
x1) echo "-- Using Lib SSH.................. YES" ;;
*) echo "-- Using Lib SSH.................. NO"
echo ""
echo "Libssh is required for SshIo in basicIo.cpp. Make sure the libssh header"

View File

@ -29,16 +29,6 @@
#ifndef BASICIO_HPP_
#define BASICIO_HPP_
// The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1,
// it uses MemIo. Otherwises, it uses FileIo.
#ifndef EXV_XPATH_MEMIO
#define EXV_XPATH_MEMIO 0
#endif
#ifndef EXV_USE_CURL
#define EXV_USE_CURL 0
#endif
// *****************************************************************************
// included header files
#include "types.hpp"
@ -52,6 +42,18 @@
#include <ctime> // timestamp for the name of temporary file
#include <cstring> // std::memcpy
// The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1,
// it uses MemIo. Otherwises, it uses FileIo.
#ifndef EXV_XPATH_MEMIO
#define EXV_XPATH_MEMIO 0
#endif
#ifndef EXV_USE_CURL
#define EXV_USE_CURL 0
#endif
#ifndef EXV_USE_SSH
#define EXV_USE_SSH 0
#endif
// *****************************************************************************
// namespace extensions
namespace Exiv2 {

View File

@ -58,7 +58,9 @@
#include "psdimage.hpp"
#include "rafimage.hpp"
#include "rw2image.hpp"
#if EXV_USE_SSH == 1
#include "ssh.hpp"
#endif
#include "tags.hpp"
#include "tgaimage.hpp"
#include "tiffimage.hpp"

View File

@ -107,7 +107,7 @@ LDFLAGS := `pkg-config exiv2 --libs`
BINOBJ = $(BINSRC:.cpp=.o)
BINARY = $(BINSRC:.cpp=)
OTHEROBJ = $(OTHERSRC:.cpp=.o)
OTHEROBJ = $(OTHERSRC:.cpp=.o) Jzon.o
OTHERBIN = $(OTHERSRC:.cpp=)
EXECUTABLE = $(BINSRC:%.cpp=../bin/%$(EXEEXT)) $(OTHERSRC:%.cpp=../bin/%$(EXEEXT))
@ -118,6 +118,11 @@ endif
PREFIX = /usr/local/lib
LINK.cc += -rpath $(PREFIX) -L$(PREFIX)
# TODO: This should really not be here. We should use the installed headers
# to build the samples. Some errors only show up in this scenario, e.g., errors
# due to missing headers which are not installed (depending on compile-time
# settings) but may be wrongly included from other headers.
COMPILE.cc += -I$(top_srcdir)/include/exiv2
# ******************************************************************************
@ -163,7 +168,7 @@ geotag: %: %.cpp
# link applications which require utils.cpp support
metacopy path-test: %: %.cpp ../src/utils.o
$(COMPILE.cc) -I../src -o $@.o $<
$(COMPILE.cc) -I../src -I../include/exiv2 -o $@.o $<
@$(MAKEDEPEND)
@$(POSTDEPEND)
$(LIBTOOL) --mode=link $(LINK.cc) $@.o ../src/utils.o -o ../bin/$@

View File

@ -105,9 +105,11 @@ CCSRC += preview.cpp \
psdimage.cpp \
rafimage.cpp \
rw2image.cpp \
samsungmn.cpp \
ssh.cpp \
sigmamn.cpp \
samsungmn.cpp
ifdef USE_SSH
CCSRC += ssh.cpp
endif
CCSRC += sigmamn.cpp \
sonymn.cpp \
tags.cpp \
tgaimage.cpp \

View File

@ -30,12 +30,7 @@
EXIV2_RCSID("@(#) $Id: rw2image.cpp 3201 2013-12-01 12:13:42Z ahuggel $")
#include "ssh.hpp"
#if EXV_USE_SSH != 1
namespace Exiv2 {
extern int ssh_extern;
int ssh_extern = 1;
}
#else
#if EXV_USE_SSH == 1
// class member definitions
namespace Exiv2 {
@ -157,4 +152,4 @@ namespace Exiv2 {
ssh_free(session_);
}
}
#endif
#endif // EXV_USE_SSH == 1

View File

@ -31,9 +31,11 @@
// *********************************************************************
// included header files
#include "futils.hpp"
// + standard includes
#include <string>
#include <futils.hpp>
// *********************************************************************
// namespace extensions
/*!