Miscelaneous tweaks for Visual C in Cygwin compatibility

pull/119/head
Dan Kegel 2017-06-05 17:41:13 -07:00
parent ededaa6415
commit 0ba391bc6f
2 changed files with 40 additions and 4 deletions

14
main.c
View File

@ -17,6 +17,10 @@
#include <libpkgconf/libpkgconf.h>
#include "config.h"
#include "getopt_long.h"
#ifdef _WIN32
#include <io.h> /* for _setmode() */
#include <fcntl.h>
#endif
#define PKG_CFLAGS_ONLY_I (((uint64_t) 1) << 2)
#define PKG_CFLAGS_ONLY_OTHER (((uint64_t) 1) << 3)
@ -652,6 +656,16 @@ main(int argc, char *argv[])
want_flags = 0;
#ifdef _WIN32
/* When running regression tests in cygwin, and building native
* executable, tests fail unless native executable outputs unix
* line endings. Come to think of it, this will probably help
* real people who use cygwin build environments but native pkgconf, too.
*/
_setmode(fileno(stdout), O_BINARY);
_setmode(fileno(stderr), O_BINARY);
#endif
struct pkg_option options[] = {
{ "version", no_argument, &want_flags, PKG_VERSION|PKG_PRINT_ERRORS, },
{ "about", no_argument, &want_flags, PKG_ABOUT|PKG_PRINT_ERRORS, },

View File

@ -1,10 +1,32 @@
export PATH="$(atf_get_srcdir)/../:${PATH}"
srcdir="$(atf_get_srcdir)"
export PATH="$srcdir/..:${PATH}"
#--- begin windows kludge ---
# When building with Visual Studio, binaries are in a subdirectory named after the configration...
# and the configuration is not known unless you're in the IDE, or something.
# So just guess. This won't work well if you build more than one configuration.
the_configuration=""
for configuration in Debug Release RelWithDebInfo
do
if test -d "$srcdir/../$configuration"
then
if test "$the_configuration" != ""
then
echo "test_env.sh: FAIL: more than one configuration found"
exit 1
fi
the_configuration=$configuration
export PATH="$srcdir/../${configuration}:${PATH}"
fi
done
#--- end kludge ---
selfdir="@abs_top_srcdir@/tests"
PATH_SEP=":"
SYSROOT_DIR="${selfdir}/test"
if [ "$(uname -s)" = "Msys" ]; then
PATH_SEP=";"
fi
case "$(uname -s)" in
Msys|CYGWIN*) PATH_SEP=";";;
esac
prefix="@prefix@"
exec_prefix="@exec_prefix@"