buildsys: Add ACLOCAL_AMFLAGS to specify the m4 directory

This fixes an autoreconf warning, and is documented under
AC_CONFIG_MACRO_DIR (section 4.4) in the autoconf manual.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Move some autoconf files to build-aux/ directory

This eliminates a bit of clutter at the top level.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
tests: Convert to the new parallel test harness

automake 1.11+ allows us to define a custom test runner, so the test
cases can be defined as trivial "*.pipe" and "*.ref" files; a common
runner script "pipe-wrapper.sh" executes each one and checks the output
against a known-good result.

The most immediate need for this change is to fix bug #14
("make -j4 check" fails due to hardcoded temp filenames), but it should
also make it easier to add new tests in the future.

Reported-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
autogen: Create m4/ directory if it doesn't exist

Some versions of aclocal apparently require this:

    autoreconf: running: aclocal --force -I m4
    aclocal: couldn't open directory `m4': No such file or directory
    autoreconf: aclocal failed with exit status: 1

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
autoconf: Correctly set Requires.private when compiled with nettle

fixes #16

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
compat: Add stoken__strcasestr()

Introduce a new src/compat.c to add functions that are unavailable on
non-Linux-glibc platforms.  The first addition is strcasestr(), which
is missing on MinGW.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
autoconf: check for mkstemps

mkstemps is missing on uClibc, and until recently was also missing with
musl-libc. Add an explicit check for this function.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
compat: Add stoken__mkstemps()

mkstemps() is missing on uClibc, so add a local copy (borrowed from
the Bionic / FreeBSD libc).

fixes #18

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Add linker and libtool flags for building Win32 DLLs

This is currently targeted for MinGW only.  References:

http://stackoverflow.com/questions/17487891/libtool-undefined-symbols-not-allowedin-i686-pc-mingw32-shared
http://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
library: Use STOKEN_EXPORT to implement Win32 __declspec requirement

On Windows, DLL imports/exports need to be explicitly declared.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Link with -lgmp if using nettle

stc-nettle.c uses gmp functions like mpz_init(), so we should link with
libgmp explicitly.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
compat: Add stoken__gmtime_r() for Windows

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
compat: Disable _gettemp() features that don't compile on Windows

MinGW seems to dislike our calls to mkdir() and lstat(), so omit them
for now.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
common: Don't #include <sys/mman.h> if we don't use mlockall()

Windows systems do not have this header file, so it will generate
a compile error.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
cli: Split out platform-specific tty code for Windows/Linux

Use common entry point names for the Linux and Win32 implementations;
add Win32 stubs.  Avoid including <termios.h> on Windows, as it breaks
the build.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
cli: Move fork_and_wait() into platform-specific sections

Windows doesn't have a <sys/wait.h>, and subprocess handling is likely
to differ quite a bit from Linux.  So let's move this out of the way
for now, so we can build the CLI for Linux (sans QR encoding support).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
gui: Look for *.ui files in current dir on Windows

We do not yet have a good place to install these files, so just look
for them in the working directory.  This allows stoken-gui to start
up and display tokencodes.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
gui: Look for icon file in current dir on Windows

Similar to the previous change for *.ui.  This makes the app's icon show
up on the taskbar and on the window menu (alt-space).

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
buildsys: Add "make winpkg" target

This creates a zip file with all EXEs and DLLs needed to run stoken and
stoken-gui on Windows.  Experimental.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
README: Change to markdown format; update with GTK+3 and Windows info

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>