llvm.org GIT mirror llvm / b7a8d40
Fix a compile failure introduced by r82675 on MinGW which doesn't have setenv(). This patch just disables the test rather than getting putenv() to work. Thanks to Sandeep Patel for reporting the problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82797 91177308-0d34-0410-b5e6-96231b3b80d8 Jeffrey Yasskin 10 years ago
6 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
10791079 AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
10801080 AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
10811081 AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup ])
1082 AC_CHECK_FUNCS([strerror strerror_r strerror_s ])
1082 AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ])
10831083 AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
10841084 AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp])
10851085 AC_C_PRINTF_A
7070 check_symbol_exists(strerror string.h HAVE_STRERROR)
7171 check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
7272 check_symbol_exists(strerror_s string.h HAVE_STRERROR_S)
73 check_symbol_exists(setenv stdlib.h HAVE_SETENV)
7374
7475 check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
7576 if( LLVM_USING_GLIBC )
3229032290
3229132291
3229232292
32293 for ac_func in strerror strerror_r strerror_s
32293
32294 for ac_func in strerror strerror_r strerror_s setenv
3229432295 do
3229532296 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
3229632297 { echo "$as_me:$LINENO: checking for $ac_func" >&5
289289
290290 /* Define to 1 if you have the `sbrk' function. */
291291 #undef HAVE_SBRK
292
293 /* Define to 1 if you have the `setenv' function. */
294 #cmakedefine HAVE_SETENV ${HAVE_SETENV}
292295
293296 /* Define to 1 if you have the `setjmp' function. */
294297 #undef HAVE_SETJMP
319319
320320 /* Define to 1 if you have the `sbrk' function. */
321321 #undef HAVE_SBRK
322
323 /* Define to 1 if you have the `setenv' function. */
324 #undef HAVE_SETENV
322325
323326 /* Define to 1 if you have the `setjmp' function. */
324327 #undef HAVE_SETJMP
77 //===----------------------------------------------------------------------===//
88
99 #include "llvm/Support/CommandLine.h"
10 #include "llvm/Config/config.h"
1011
1112 #include "gtest/gtest.h"
1213
2324 : name(name) {
2425 const char *old_value = getenv(name);
2526 EXPECT_EQ(NULL, old_value) << old_value;
27 #if HAVE_SETENV
2628 setenv(name, value, true);
29 #else
30 # define SKIP_ENVIRONMENT_TESTS
31 #endif
2732 }
2833
2934 ~TempEnvVar() {
35 #if HAVE_SETENV
36 // Assume setenv and unsetenv come together.
3037 unsetenv(name);
38 #endif
3139 }
3240
3341 private:
3442 const char *const name;
3543 };
44
45 #ifndef SKIP_ENVIRONMENT_TESTS
3646
3747 const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS";
3848
4454 EXPECT_EQ("hello", EnvironmentTestOption);
4555 }
4656
57 #endif // SKIP_ENVIRONMENT_TESTS
58
4759 } // anonymous namespace