[vlc-devel] [PATCH] configure: check if if_nametoindex is available on Windows
Alexandre Janniaux
ajanni at videolabs.io
Thu Apr 30 12:26:51 CEST 2020
Hi,
Other than documentation, the patch LGTM. The documentation
nits are inline.
On Thu, Apr 30, 2020 at 12:15:53PM +0200, Steve Lhomme wrote:
> It may link with iphlpapi but be forbidden in UWP.
>
> This test relies on the fact that -Werror-implicit-function-declaration works
> in the compiler. And that's why it's done after it's enabled.
You might add an additonal comment above the
AX_APPEND_COMPILE_FLAGS to mention this.
> ---
> configure.ac | 18 ++++++++++++++++++
> include/vlc_fixups.h | 4 ++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index d75b2fd9921..e1d535f6f06 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1049,6 +1049,24 @@ AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -W
> AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Werror-implicit-function-declaration -Winit-self -Wlogical-op -Wshadow=local -Wmultistatement-macros], [CFLAGS])
> AX_APPEND_COMPILE_FLAGS([-pipe], [CFLAGS])
>
> +dnl UWP forbidden checks
> +AS_IF([test "${SYS}" = "mingw32"], [
> + AC_MSG_CHECKING(for if_nametoindex availability)
> + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
> + [[#include <windows.h>
> + #include <iphlpapi.h>
> + static void test (void) {
> + if_nametoindex(NULL);
> + }
> + ]],[[;]])
> + ],[
> + AC_MSG_RESULT([present])
> + AC_DEFINE([HAVE_IF_NAMETOINDEX], [1], [Define to 1 if you have if_nametoindex function])
> + ],[
> + AC_MSG_RESULT([not present])
> + ])
> +])
> +
> dnl
> dnl Debugging mode
> dnl
> diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
> index 25c7de473e6..42d5b31661f 100644
> --- a/include/vlc_fixups.h
> +++ b/include/vlc_fixups.h
> @@ -454,6 +454,10 @@ struct msghdr
> size_t msg_controllen;
> int msg_flags;
> };
> +
> +# ifndef HAVE_IF_NAMETOINDEX
> +# define if_nametoindex(name) atoi(name)
What about error handling? Can you clarify in the patch why
atoi is enough here?
> +# endif
> #endif
>
> #ifdef _NEWLIB_VERSION
> --
> 2.17.1
>
Regards,
--
Alexandre Janniaux
Videolabs
More information about the vlc-devel
mailing list