autotools builds: Enable Windows builds
We now check for whether the build is done on Windows, so that: -We link to -lws2_32, which is necessary for the networking functions on Windows. -We default to using libicu on Windows for the runtime and builtins, as the code using libidn and libidn2 use stuff from langinfo.h, which is not available on Windows. -We do not build and run the tests under fuzz/ as Windows does not have fmemopen(). This enables the code to be built on Windows via MinGW.
This commit is contained in:
parent
a2243d7d3c
commit
d9095bbe03
67
configure.ac
67
configure.ac
|
@ -122,25 +122,48 @@ AC_ARG_ENABLE([asan],
|
|||
AC_SUBST([LIBPSL_SO_VERSION], [8:0:3])
|
||||
AC_SUBST([LIBPSL_VERSION], $VERSION)
|
||||
|
||||
#
|
||||
# Check for Win32
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([for Win32])
|
||||
case "$host" in
|
||||
*-*-mingw*)
|
||||
os_win32=yes
|
||||
;;
|
||||
*)
|
||||
os_win32=no
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$os_win32])
|
||||
AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
|
||||
|
||||
# Windows does not have langinfo.h, which the libidn/libidn2
|
||||
# builtin and runtime need, so default to ICU
|
||||
if test "x$os_win32" = "xyes" ; then
|
||||
default_runtime=libicu
|
||||
default_builtin=libicu
|
||||
else
|
||||
default_runtime=libidn2
|
||||
default_builtin=libidn2
|
||||
fi
|
||||
|
||||
# Check for enable/disable builtin PSL data
|
||||
AC_ARG_ENABLE(runtime,
|
||||
[
|
||||
--enable-runtime[[=IDNA library]]
|
||||
Specify the IDNA library used for libpsl run-time conversions:
|
||||
libidn2 [[default]]: IDNA2008 library (also needs libunistring)
|
||||
libicu: IDNA2008 UTS#46 library
|
||||
libidn: IDNA2003 library (also needs libunistring)
|
||||
libidn2 [[default on non-Windows]]: IDNA2008 library (also needs libunistring)
|
||||
libicu [[default on Windows]]: IDNA2008 UTS#46 library
|
||||
libidn: IDNA2003 library (also needs libunistring)
|
||||
--disable-runtime Do not link runtime IDNA functionality
|
||||
], [
|
||||
if test "$enableval" = "libidn2" -o "$enableval" = "yes"; then
|
||||
enable_runtime=libidn2
|
||||
AC_DEFINE([WITH_LIBIDN2], [1], [generate PSL data using libidn2])
|
||||
elif test "$enableval" = "libicu"; then
|
||||
enable_runtime=libicu
|
||||
AC_DEFINE([WITH_LIBICU], [1], [generate PSL data using libicu])
|
||||
elif test "$enableval" = "libidn"; then
|
||||
enable_runtime=libidn
|
||||
AC_DEFINE([WITH_LIBIDN], [1], [generate PSL data using libidn])
|
||||
elif test "$enableval" = "no"; then
|
||||
enable_runtime=no
|
||||
else
|
||||
|
@ -148,8 +171,7 @@ AC_ARG_ENABLE(runtime,
|
|||
fi
|
||||
], [
|
||||
# this is the default if neither --enable-runtime nor --disable-runtime were specified
|
||||
enable_runtime=libidn2
|
||||
AC_DEFINE([WITH_LIBIDN2], [1], [generate PSL data using libidn2])
|
||||
enable_runtime=$default_runtime
|
||||
])
|
||||
|
||||
# Check for enable/disable builtin PSL data
|
||||
|
@ -157,20 +179,17 @@ AC_ARG_ENABLE(builtin,
|
|||
[
|
||||
--enable-builtin[[=IDNA library]]
|
||||
Specify the IDNA library used for built-in data generation:
|
||||
libidn2 [[default]]: IDNA2008 library (also needs libunistring)
|
||||
libicu: IDNA2008 UTS#46 library
|
||||
libidn: IDNA2003 library (also needs libunistring)
|
||||
libidn2 [[default on non-Windows]]: IDNA2008 library (also needs libunistring)
|
||||
libicu: [[default on Windows]]: IDNA2008 UTS#46 library
|
||||
libidn: IDNA2003 library (also needs libunistring)
|
||||
--disable-builtin Do not generate built-in PSL data
|
||||
], [
|
||||
if test "$enableval" = "libidn2" -o "$enableval" = "yes"; then
|
||||
enable_builtin=libidn2
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN2], [1], [generate PSL data using libidn2])
|
||||
elif test "$enableval" = "libicu"; then
|
||||
enable_builtin=libicu
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBICU], [1], [generate PSL data using libicu])
|
||||
elif test "$enableval" = "libidn"; then
|
||||
enable_builtin=libidn
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN], [1], [generate PSL data using libidn])
|
||||
elif test "$enableval" = "no"; then
|
||||
enable_builtin=no
|
||||
else
|
||||
|
@ -178,8 +197,7 @@ AC_ARG_ENABLE(builtin,
|
|||
fi
|
||||
], [
|
||||
# this is the default if neither --enable-builtin nor --disable-builtin were specified
|
||||
enable_builtin=libidn2
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN2], [1], [generate PSL data using libidn2])
|
||||
enable_builtin=$default_builtin
|
||||
])
|
||||
|
||||
if test "$enable_runtime" = "libicu" -o "$enable_builtin" = "libicu"; then
|
||||
|
@ -203,6 +221,10 @@ if test "$enable_runtime" = "libicu" -o "$enable_builtin" = "libicu"; then
|
|||
[AC_MSG_RESULT([no]); AC_MSG_ERROR(You requested libicu but it is not installed.)])
|
||||
LIBS=$OLDLIBS
|
||||
])
|
||||
if test "x$HAVE_LIBICU" = "xyes" ; then
|
||||
AC_DEFINE([WITH_LIBICU], [1], [generate PSL data using libicu])
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBICU], [1], [generate PSL data using libicu])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$enable_runtime" = "libidn2" -o "$enable_builtin" = "libidn2"; then
|
||||
|
@ -217,6 +239,10 @@ if test "$enable_runtime" = "libidn2" -o "$enable_builtin" = "libidn2"; then
|
|||
AC_SEARCH_LIBS(idn2_lookup_u8, idn2, HAVE_LIBIDN2=yes, AC_MSG_ERROR(You requested libidn2 but it is not installed.), -lunistring)
|
||||
LIBS=$OLDLIBS
|
||||
])
|
||||
if test "x$HAVE_LIBIDN2" = "xyes" ; then
|
||||
AC_DEFINE([WITH_LIBIDN2], [1], [generate PSL data using libidn2])
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN2], [1], [generate PSL data using libidn2])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$enable_runtime" = "libidn" -o "$enable_builtin" = "libidn"; then
|
||||
|
@ -231,6 +257,10 @@ if test "$enable_runtime" = "libidn" -o "$enable_builtin" = "libidn"; then
|
|||
AC_SEARCH_LIBS(idna_to_ascii_8z, idn, HAVE_LIBIDN=yes, AC_MSG_ERROR(You requested libidn but it is not installed.))
|
||||
LIBS=$OLDLIBS
|
||||
])
|
||||
if test "x$HAVE_LIBIDN2" = "xyes" ; then
|
||||
AC_DEFINE([WITH_LIBIDN], [1], [generate PSL data using libidn])
|
||||
AC_DEFINE([BUILTIN_GENERATOR_LIBIDN], [1], [generate PSL data using libidn])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$HAVE_LIBIDN2" = "xyes" -o "x$HAVE_LIBIDN" = "xyes"; then
|
||||
|
@ -265,6 +295,11 @@ elif test -n "$NEEDS_NSL" ; then
|
|||
LIBS="$LIBS -lnsl"
|
||||
fi
|
||||
|
||||
# Windows has the networking functions in -lws2_32
|
||||
if test "x$os_win32" = "xyes" ; then
|
||||
LIBS="$LIBS -lws2_32"
|
||||
fi
|
||||
|
||||
# Check for clock_gettime() used for performance measurement
|
||||
AC_SEARCH_LIBS(clock_gettime, rt)
|
||||
|
||||
|
|
|
@ -50,7 +50,15 @@ endif
|
|||
endif
|
||||
endif
|
||||
|
||||
check_PROGRAMS = $(PSL_TESTS)
|
||||
# We don't have fmemopen() on Windows, so we can't run these tests
|
||||
# on Windows, at least for now
|
||||
|
||||
check_PROGRAMS =
|
||||
TESTS =
|
||||
|
||||
if !OS_WIN32
|
||||
check_PROGRAMS += $(PSL_TESTS)
|
||||
endif
|
||||
|
||||
dist-hook:
|
||||
find . -name '*.options' -exec cp -v '{}' $(distdir) ';'
|
||||
|
@ -59,7 +67,10 @@ dist-hook:
|
|||
find . -name '*.repro' -exec cp -vr '{}' $(distdir) ';'
|
||||
|
||||
TESTS_ENVIRONMENT = TESTS_VALGRIND="@VALGRIND_ENVIRONMENT@"
|
||||
TESTS = $(PSL_TESTS)
|
||||
|
||||
if !OS_WIN32
|
||||
TESTS += $(PSL_TESTS)
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
rm -rf *.gc?? *.log lcov coverage.info *_fuzzer *.o
|
||||
|
|
|
@ -24,6 +24,10 @@ if WITH_LIBIDN
|
|||
libpsl_la_LDFLAGS += -lidn -lunistring
|
||||
endif
|
||||
|
||||
if OS_WIN32
|
||||
libpsl_la_LDFLAGS += -no-undefined
|
||||
endif
|
||||
|
||||
# Build rule for suffix_dafsa.c
|
||||
# PSL_FILE can be set by ./configure --with-psl-file=[PATH]
|
||||
suffixes_dafsa.c: $(PSL_FILE) $(srcdir)/psl-make-dafsa
|
||||
|
|
Loading…
Reference in New Issue