Skip to content

Commit c5c9c33

Browse files
L1L1@gmx.comL1L1@gmx.com
authored andcommitted
Attempting to extend compatibility to FreeBSD
1 parent 39d8d80 commit c5c9c33

File tree

6 files changed

+37
-10
lines changed

6 files changed

+37
-10
lines changed

INSTALL

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ without warranty of any kind.
1212
Basic Installation
1313
==================
1414

15-
Briefly, the shell command `./configure && make && make install'
16-
should configure, build, and install this package. The following
15+
Briefly, the shell commands `./configure; make; make install' should
16+
configure, build, and install this package. The following
1717
more-detailed instructions are generic; see the `README' file for
1818
instructions specific to this package. Some packages provide this
1919
`INSTALL' file but do not implement all of the features documented

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cardpeek_SOURCES = asn1.c asn1.h bytestring.c bytestring.h gui_flexi_cell_render
88

99
doc_DATA=doc/cardpeek_ref.en.pdf
1010

11-
cardpeek_LDADD=cardpeek_resources.$(OBJEXT) @LUA_LIBS@ @PCSC_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @CURL_LIBS@ @LIBICONV@
11+
cardpeek_LDADD=cardpeek_resources.$(OBJEXT) @LUA_LIBS@ @PCSC_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @CURL_LIBS@ @ICONV_LIBS@
1212

1313
cardpeek_LDFLAGS=-g
1414
#cardpeek_LDFLAGS=-O2

config.h.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
/* Define to 1 if you have the `bzero' function. */
44
#undef HAVE_BZERO
55

6+
/* Define to 1 if you have the declaration of `backtrace', and to 0 if you
7+
don't. */
8+
#undef HAVE_DECL_BACKTRACE
9+
610
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
711
*/
812
#undef HAVE_DIRENT_H
@@ -28,6 +32,9 @@
2832
/* Define to 1 if you have the `crypto' library (-lcrypto). */
2933
#undef HAVE_LIBCRYPTO
3034

35+
/* Define to 1 if you have the `execinfo' library (-lexecinfo). */
36+
#undef HAVE_LIBEXECINFO
37+
3138
/* Define to 1 if you have the `ssl' library (-lssl). */
3239
#undef HAVE_LIBSSL
3340

configure.ac

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ PKG_CHECK_MODULES([LUA],[lua-5.2],,[
4747
fi
4848
done
4949
if test $HAVE_LIBLUA != yes; then
50-
AC_MSG_ERROR([Could not find lua 5.2-dev. This program requires the lua 5.2 development library. Please install the lua 5.2 library first.])
50+
AC_MSG_ERROR([Could not find lua 5.2-dev.
51+
52+
This program requires the lua 5.2 development library.
53+
Please install the lua 5.2 library first.])
5154
fi
5255
])
5356
])
@@ -57,7 +60,14 @@ PKG_CHECK_MODULES([CURL],[libcurl],,[
5760
AC_CHECK_LIB([curl],[curl_easy_init],[
5861
AC_SUBST([CURL_CFLAGS],[""])
5962
AC_SUBST([CURL_LIBS],[-lcurl])
60-
])
63+
HAVE_LIBCURL=yes
64+
],[HAVE_LIBCURL=no])
65+
if test $HAVE_LIBCURL != yes; then
66+
AC_MSG_ERROR([Cloud not find libcurl.
67+
68+
This program requires the libcurl development library.
69+
Please install the required library first.])
70+
fi
6171
])
6272

6373
AC_CHECK_LIB([ssl],[SSL_free],,
@@ -69,8 +79,15 @@ AC_CHECK_LIB([crypto],[CRYPTO_free],,
6979
AC_MSG_ERROR([Could not find openssl-dev.
7080
This program requires the openssl dev. library.
7181
Please install it first.]))
72-
82+
83+
AC_CHECK_LIB([execinfo],[backtrace],,)
84+
AC_CHECK_DECLS([backtrace], [], [], [[#include <execinfo.h>]])
85+
86+
AC_ARG_VAR(ICONV_LIBS,[linker flags for ICONV (e.g. -l iconv), overriding the detected value.])
7387
AM_ICONV
88+
if test ! $ICONV_LIBS; then
89+
AC_SUBST([ICONV_LIBS],[$LIBICONV])
90+
fi
7491

7592
AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
7693

lua_iconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int subr_iconv_open(lua_State *L)
5959
static int subr_iconv_iconv(lua_State *L)
6060
{
6161
iconv_t ic = luaL_check_iconv(L,1);
62-
char *src = (char *)luaL_checkstring(L,2);
62+
ICONV_CONST char *src = (ICONV_CONST char *)luaL_checkstring(L,2);
6363
size_t src_len = strlen(src);
6464
char conv_block[16];
6565
size_t conv_len;

main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static gboolean run_command_from_cli(gpointer data)
212212
}
213213

214214

215-
#ifndef _WIN32
215+
#ifdef HAVE_DECL_BACKTRACE
216216
#include <execinfo.h>
217217
static void do_backtrace()
218218
{
@@ -231,6 +231,11 @@ static void do_backtrace()
231231

232232
free(btrace);
233233
}
234+
#else
235+
static void do_backtrace()
236+
{
237+
/* void */
238+
}
234239
#endif
235240

236241
static const char *message =
@@ -262,9 +267,7 @@ static void save_what_can_be_saved(int sig_num)
262267
write(2,buf,strlen(buf));
263268

264269
log_printf(LOG_ERROR,"Received signal %i",sig_num);
265-
#ifndef _WIN32
266270
do_backtrace();
267-
#endif
268271
log_close_file();
269272
exit(-2);
270273
}

0 commit comments

Comments
 (0)