build: enable specific tools and libraries

Instead of enable all or a single specific tool and library allow enable
or disable comma separated libraries.

This somewhat reduces the error checking, but makes code and usage nicer.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
This commit is contained in:
Alon Bar-Lev 2017-11-04 23:02:30 +02:00 committed by Jonathan Yong
parent 5d0cce058c
commit 771d501a20
No known key found for this signature in database
GPG Key ID: 713B5FE29C145D45

View File

@ -53,39 +53,20 @@ AC_MSG_RESULT([$with_crt])
AC_MSG_CHECKING([whether to build the optional libraries]) AC_MSG_CHECKING([whether to build the optional libraries])
AC_ARG_WITH([libraries], AC_ARG_WITH([libraries],
[AS_HELP_STRING([--with-libraries=ARG], [AS_HELP_STRING([--with-libraries=ARG],
[Build the extra mingw-w64 libs, where ARG is one of libmangle, pseh, winpthreads, or all])], [Build the extra mingw-w64 libs, where ARG is comma separated list of libmangle, pseh, winpthreads, or all])],
[], [],
[with_libraries=no]) [with_libraries=no])
AS_CASE([$with_libraries], libraries="winpthreads mangle"
[yes|all],[ AS_CASE([$host_cpu],
with_libraries="libmangle,winpthreads" [i?86], [
with_libraries_winpthreads=yes libraries="$libraries pseh"
with_libraries_mangle=yes ])
AS_CASE([$host_cpu], for l in $libraries; do
[i?86], [ res=`echo "$with_libraries" | grep $l > /dev/null && echo yes || echo no`
with_libraries="$with_libraries,pseh" AS_CASE([$with_libraries],
with_libraries_pseh=yes [all|yes],[res=yes])
])], AS_VAR_COPY([with_libraries_$l], [res])
[libmangle],[ done
with_libraries="libmangle"
with_libraries_winpthreads=no
with_libraries_mangle=yes
with_libraries_pseh=no],
[pseh],[
with_libraries="pseh"
with_libraries_winpthreads=no
with_libraries_mangle=no
with_libraries_pseh=yes],
[winpthreads],[
with_libraries="winpthreads"
with_libraries_winpthreads=yes
with_libraries_mangle=no
with_libraries_pseh=no],
[no],[
with_libraries_winpthreads=no
with_libraries_mangle=no
with_libraries_pseh=no],
[MW64_OPTION_ERROR([with-libraries])])
AM_CONDITIONAL([LIBRARIES_MANGLE],[test "x$with_libraries_mangle" = xyes]) AM_CONDITIONAL([LIBRARIES_MANGLE],[test "x$with_libraries_mangle" = xyes])
AM_CONDITIONAL([LIBRARIES_PSEH],[test "x$with_libraries_pseh" = xyes]) AM_CONDITIONAL([LIBRARIES_PSEH],[test "x$with_libraries_pseh" = xyes])
AM_CONDITIONAL([LIBRARIES_WINPTHREADS],[test "x$with_libraries_winpthreads" = xyes]) AM_CONDITIONAL([LIBRARIES_WINPTHREADS],[test "x$with_libraries_winpthreads" = xyes])
@ -97,26 +78,15 @@ AC_MSG_RESULT([$with_libraries])
AC_MSG_CHECKING([whether to build the optional tools]) AC_MSG_CHECKING([whether to build the optional tools])
AC_ARG_WITH([tools], AC_ARG_WITH([tools],
[AS_HELP_STRING([--with-tools=ARG], [AS_HELP_STRING([--with-tools=ARG],
[Build the extra mingw-w64 tools, where ARG is one of gendef, genidl, or all])], [Build the extra mingw-w64 tools, where ARG is comma separated list of gendef, genidl, or all])],
[], [],
[with_tools=no]) [with_tools=no])
AS_CASE([$with_tools], for t in gendef genidl; do
[yes|all],[ res=`echo "${with_tools}" | grep $t > /dev/null && echo yes || echo no`
with_tools="gendef,genidl" AS_CASE([$with_tools],
with_tools_gendef=yes [all|yes],[res=yes])
with_tools_genidl=yes], AS_VAR_COPY([with_tools_$t], [res])
[gendef],[ done
with_tools="gendef"
with_tools_gendef=yes
with_tools_genidl=no],
[genidl],[
with_tools="genidl"
with_tools_gendef=no
with_tools_genidl=yes],
[no],[
with_tools_gendef=no
with_tools_genidl=no],
[MW64_OPTION_ERROR([with-tools])])
AM_CONDITIONAL([TOOLS_GENDEF],[test "x$with_tools_gendef" = xyes]) AM_CONDITIONAL([TOOLS_GENDEF],[test "x$with_tools_gendef" = xyes])
AM_CONDITIONAL([TOOLS_GENIDL],[test "x$with_tools_genidl" = xyes]) AM_CONDITIONAL([TOOLS_GENIDL],[test "x$with_tools_genidl" = xyes])
AM_COND_IF([TOOLS_GENDEF],[AC_CONFIG_SUBDIRS([mingw-w64-tools/gendef])]) AM_COND_IF([TOOLS_GENDEF],[AC_CONFIG_SUBDIRS([mingw-w64-tools/gendef])])