summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqltest.cc17
-rw-r--r--config.h.cmake2
-rw-r--r--configure.cmake10
-rw-r--r--mysys/typelib.c2
4 files changed, 25 insertions, 6 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index b99541b7907..7d5e35befbb 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -73,7 +73,7 @@
#define QUERY_REAP_FLAG 2
#ifndef HAVE_SETENV
-#error implement our portable setenv replacement in mysys
+static int setenv(const char *name, const char *value, int overwrite)
#endif
enum {
@@ -9672,3 +9672,18 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
delete_dynamic(&lines);
DBUG_VOID_RETURN;
}
+
+#ifndef HAVE_SETENV
+static int setenv(const char *name, const char *value, int overwrite)
+{
+ size_t buflen= strlen(name) + strlen(value) + 2;
+ char *envvar= malloc(buflen);
+ if(!envvar)
+ return ENOMEM;
+ strcpy(envvar, name);
+ strcat(envvar, "=");
+ strcat(envvar, value);
+ putenv(envvar);
+ return 0;
+}
+#endif
diff --git a/config.h.cmake b/config.h.cmake
index 4d6b28e2de3..8c0c8ae3094 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -534,7 +534,7 @@
#cmakedefine strtok_r @strtok_r@
#cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@
-#ifdef _WIN32
+#if (_MSC_VER > 1310)
#define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif
diff --git a/configure.cmake b/configure.cmake
index e155b661259..25cc6f5cb52 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -284,9 +284,13 @@ IF(UNIX)
IF(NOT LIBM)
MY_SEARCH_LIBS(__infinity m LIBM)
ENDIF()
- IF(NOT LIBM)
- MY_SEARCH_LIBS(rint m LIBM)
- ENDIF()
+
+ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ # On Solaris, use of intrinsics will screw the lib search logic
+ # Force using -lm, so rint etc are found.
+ SET(LIBM m)
+ ENDIF()
+
MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL)
MY_SEARCH_LIBS(bind "bind;socket" LIBBIND)
MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
diff --git a/mysys/typelib.c b/mysys/typelib.c
index 73dab610bed..c332c82d17a 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -326,7 +326,7 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
my_ulonglong flags_to_set= 0, flags_to_clear= 0, res;
my_bool set_defaults= 0;
- *err_pos= 0; // No error yet
+ *err_pos= 0; /* No error yet */
if (str != end)
{
const char *start= str;