cmake+autotools: add option to enable/disable iconv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae6d29a..adbf9eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -448,6 +448,7 @@ set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF)
dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF)
set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON)
dep_option(SDL_IBUS "Enable IBus support" ON ${UNIX_SYS} OFF)
+set_option(SDL_ICONV "Support character set conversion through libiconv" ON)
set_option(SDL_OPENGL "Include OpenGL support" ON)
set_option(SDL_OPENGLES "Include OpenGL ES support" ON)
set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
@@ -1023,14 +1024,16 @@ if(SDL_LIBC)
endif()
endif()
- check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
- if(HAVE_LIBICONV)
- list(APPEND EXTRA_LIBS iconv)
- set(HAVE_ICONV 1)
- else()
- check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)
- if(HAVE_BUILTIN_ICONV)
+ if(SDL_ICONV)
+ check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
+ if(HAVE_LIBICONV)
+ list(APPEND EXTRA_LIBS iconv)
set(HAVE_ICONV 1)
+ else()
+ check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)
+ if(HAVE_BUILTIN_ICONV)
+ set(HAVE_ICONV 1)
+ endif()
endif()
endif()
diff --git a/configure b/configure
index c592ce2..3e0cadf 100755
--- a/configure
+++ b/configure
@@ -840,6 +840,7 @@ enable_largefile
enable_assertions
enable_dependency_tracking
enable_libc
+enable_iconv
enable_gcc_atomics
enable_atomic
enable_audio
@@ -1631,6 +1632,8 @@ Optional Features:
--enable-dependency-tracking
Use gcc -MMD -MT dependency tracking [default=yes]
--enable-libc Use the system C library [default=yes]
+ --enable-iconv Enable character set conversion through iconv
+ [default=yes]
--enable-gcc-atomics Use gcc builtin atomics [default=yes]
--enable-atomic Enable the atomic operations subsystem [default=yes]
--enable-audio Enable the audio subsystem [default=yes]
@@ -18676,6 +18679,16 @@ else $as_nop
enable_libc=yes
fi
+
+# Check whether --enable-iconv was given.
+if test ${enable_iconv+y}
+then :
+ enableval=$enable_iconv;
+else $as_nop
+ enable_iconv=yes
+fi
+
+
if test x$enable_libc = xyes; then
printf "%s\n" "#define HAVE_LIBC 1" >>confdefs.h
@@ -19883,7 +19896,8 @@ then :
fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5
+ if test x$enable_iconv = xyes; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5
printf %s "checking for iconv_open in -liconv... " >&6; }
if test ${ac_cv_lib_iconv_iconv_open+y}
then :
@@ -19923,13 +19937,14 @@ then :
LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"
fi
- ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv"
+ ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv"
if test "x$ac_cv_func_iconv" = xyes
then :
printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h
fi
+ fi
ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include <signal.h>
"
@@ -28967,7 +28982,11 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
SUMMARY_video="${SUMMARY_video} uikit"
have_video=yes
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
+ if test x$enable_iconv = xyes; then
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"
+ fi
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
@@ -29263,8 +29282,10 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h
# Set up the core platform files
SOURCES="$SOURCES $srcdir/src/core/os2/*.c"
- if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then
- SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
+ if test x$enable_iconv = xyes; then
+ if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then
+ SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
+ fi
fi
# Use the Unix locale APIs.
if test x$enable_locale = xyes; then
diff --git a/configure.ac b/configure.ac
index b75a9e1..6cd98df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -317,6 +317,12 @@ dnl See whether we are allowed to use the system C library
AC_ARG_ENABLE(libc,
[AS_HELP_STRING([--enable-libc], [Use the system C library [default=yes]])],
, enable_libc=yes)
+
+dnl See whether we are allowed to use libiconv
+AC_ARG_ENABLE(iconv,
+[AS_HELP_STRING([--enable-iconv], [Enable character set conversion through iconv [default=yes]])],
+ , enable_iconv=yes)
+
if test x$enable_libc = xyes; then
AC_DEFINE(HAVE_LIBC, 1, [ ])
@@ -347,8 +353,10 @@ dnl Checks for library functions.
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
- AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
- AC_CHECK_FUNCS(iconv)
+ if test x$enable_iconv = xyes; then
+ AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
+ AC_CHECK_FUNCS(iconv)
+ fi
AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
@@ -4297,7 +4305,11 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
SUMMARY_video="${SUMMARY_video} uikit"
have_video=yes
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
+ if test x$enable_iconv = xyes; then
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"
+ fi
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
@@ -4559,8 +4571,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
# Set up the core platform files
SOURCES="$SOURCES $srcdir/src/core/os2/*.c"
- if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then
- SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
+ if test x$enable_iconv = xyes; then
+ if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then
+ SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
+ fi
fi
# Use the Unix locale APIs.
if test x$enable_locale = xyes; then