revise iconv detection:

- check libiconv with a linkage test with iconv.h included
- check libc iconv with a linkage test with iconv.h included
  and LIBICONV_PLUG defined (in case libiconv header is in
  include path)
- add new configuration option to prefer iconv from libiconv,
  if available, over the libc version, defaults to disabled:
  SDL_LIBICONV for cmake, --enable-libiconv for autotools.
- change FreeBSD specific LIBICONV_PLUG define in SDL_iconv.c
  to configuration result.
This commit is contained in:
Ozkan Sezer
2023-11-22 23:29:00 +03:00
parent 4940b5dbc2
commit 17e62abb6d
6 changed files with 152 additions and 41 deletions

View File

@@ -31,7 +31,7 @@
#include "SDL_endian.h"
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
#ifdef __FreeBSD__
#ifndef SDL_USE_LIBICONV
/* Define LIBICONV_PLUG to use iconv from the base instead of ports and avoid linker errors. */
#define LIBICONV_PLUG 1
#endif