Ticket #57551: cmake_bootstrap.log

File cmake_bootstrap.log, 42.6 KB (added by ballapete (Peter "Pete" Dyballa), 6 years ago)

Cmake bootstap

Line 
1Checking whether '/opt/local/bin/gcc-mp-6 -pipe -Os -m32  ' works.
2Try: /opt/local/bin/gcc-mp-6
3Line: /opt/local/bin/gcc-mp-6 -pipe -Os -m32   cmake_bootstrap_11022_test.c -o cmake_bootstrap_11022_test
4----------  file   -----------------------
5
6#ifdef __cplusplus
7# error "The CMAKE_C_COMPILER is set to a C++ compiler"
8#endif
9
10#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
11#error "On AIX with GNU we need the -pthread flag."
12#endif
13
14#if defined(__sun) && __STDC_VERSION__ < 199901L
15#error "On Solaris we need C99."
16#endif
17
18#include <stdio.h>
19
20int main(int argc, char* argv[])
21{
22  printf("%d%c", (argv != 0), (char)0x0a);
23  return argc - 1;
24}
25
26------------------------------------------
271
28Test succeeded
29Checking whether '/opt/local/bin/gcc-mp-6 -pipe -Os -m32    ' works.
30Try: /opt/local/bin/gcc-mp-6
31Line: /opt/local/bin/gcc-mp-6 -pipe -Os -m32     cmake_bootstrap_11022_test.c -o cmake_bootstrap_11022_test
32----------  file   -----------------------
33
34#ifdef __cplusplus
35# error "The CMAKE_C_COMPILER is set to a C++ compiler"
36#endif
37
38#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
39#error "On AIX with GNU we need the -pthread flag."
40#endif
41
42#if defined(__sun) && __STDC_VERSION__ < 199901L
43#error "On Solaris we need C99."
44#endif
45
46#include <stdio.h>
47
48int main(int argc, char* argv[])
49{
50  printf("%d%c", (argv != 0), (char)0x0a);
51  return argc - 1;
52}
53
54------------------------------------------
551
56Test succeeded
57Checking whether '/opt/local/bin/gcc-mp-6 -pipe -Os -m32      ' works.
58Try: /opt/local/bin/gcc-mp-6
59Line: /opt/local/bin/gcc-mp-6 -pipe -Os -m32       cmake_bootstrap_11022_test.c -o cmake_bootstrap_11022_test
60----------  file   -----------------------
61
62#ifdef __cplusplus
63# error "The CMAKE_C_COMPILER is set to a C++ compiler"
64#endif
65
66#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
67#error "On AIX with GNU we need the -pthread flag."
68#endif
69
70#if defined(__sun) && __STDC_VERSION__ < 199901L
71#error "On Solaris we need C99."
72#endif
73
74#include <stdio.h>
75
76int main(int argc, char* argv[])
77{
78  printf("%d%c", (argv != 0), (char)0x0a);
79  return argc - 1;
80}
81
82------------------------------------------
831
84Test succeeded
85Checking whether '/opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32  ' works.
86Try: /opt/local/bin/g++-mp-6
87Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32   cmake_bootstrap_11022_test.cxx -o cmake_bootstrap_11022_test
88----------  file   -----------------------
89
90#include <iostream>
91#include <memory>
92#include <unordered_map>
93
94#if __cplusplus < 201103L
95#error "Compiler is not in a mode aware of C++11."
96#endif
97
98#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
99#error "On AIX with GNU we need the -pthread flag."
100#endif
101
102#if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
103#error "SunPro <= 5.13 mode not supported due to bug in move semantics."
104#endif
105
106class Class
107{
108public:
109  int Get() const { return this->Member; }
110private:
111  int Member = 1;
112};
113int main()
114{
115  auto const c = std::unique_ptr<Class>(new Class);
116  std::cout << c->Get() << std::endl;
117  return 0;
118}
119
120------------------------------------------
121ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
1221
123Test succeeded
124Checking whether '/opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32     ' works.
125Try: /opt/local/bin/g++-mp-6
126Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32      cmake_bootstrap_11022_test.cxx -o cmake_bootstrap_11022_test
127----------  file   -----------------------
128
129#include <iostream>
130#include <memory>
131#include <unordered_map>
132
133#if __cplusplus < 201103L
134#error "Compiler is not in a mode aware of C++11."
135#endif
136
137#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
138#error "On AIX with GNU we need the -pthread flag."
139#endif
140
141#if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
142#error "SunPro <= 5.13 mode not supported due to bug in move semantics."
143#endif
144
145class Class
146{
147public:
148  int Get() const { return this->Member; }
149private:
150  int Member = 1;
151};
152int main()
153{
154  auto const c = std::unique_ptr<Class>(new Class);
155  std::cout << c->Get() << std::endl;
156  return 0;
157}
158
159------------------------------------------
160ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
1611
162Test succeeded
163Checking whether '/opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32        ' works.
164Try: /opt/local/bin/g++-mp-6
165Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32         cmake_bootstrap_11022_test.cxx -o cmake_bootstrap_11022_test
166----------  file   -----------------------
167
168#include <iostream>
169#include <memory>
170#include <unordered_map>
171
172#if __cplusplus < 201103L
173#error "Compiler is not in a mode aware of C++11."
174#endif
175
176#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
177#error "On AIX with GNU we need the -pthread flag."
178#endif
179
180#if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
181#error "SunPro <= 5.13 mode not supported due to bug in move semantics."
182#endif
183
184class Class
185{
186public:
187  int Get() const { return this->Member; }
188private:
189  int Member = 1;
190};
191int main()
192{
193  auto const c = std::unique_ptr<Class>(new Class);
194  std::cout << c->Get() << std::endl;
195  return 0;
196}
197
198------------------------------------------
199ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
2001
201Test succeeded
202Try: gmake
203"/opt/local/bin/gcc-mp-6" -L/opt/local/lib -Wl,-headerpad_max_install_names -framework CoreFoundation -pipe -Os -m32       -o test test.c
2041
205gmake works
206Try: /opt/local/bin/g++-mp-6
207Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32          -DTEST_KWSYS_CXX_HAS_SETENV /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_11022_test
208----------  file   -----------------------
209/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
210   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
211#ifdef TEST_KWSYS_CXX_HAS_CSTDIO
212#  include <cstdio>
213int main()
214{
215  return 0;
216}
217#endif
218
219#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
220long long f(long long n)
221{
222  return n;
223}
224int main()
225{
226  long long n = 0;
227  return static_cast<int>(f(n));
228}
229#endif
230
231#ifdef TEST_KWSYS_CXX_HAS___INT64
232__int64 f(__int64 n)
233{
234  return n;
235}
236int main()
237{
238  __int64 n = 0;
239  return static_cast<int>(f(n));
240}
241#endif
242
243#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM
244#  include <sys/types.h>
245
246#  include <sys/stat.h>
247#  include <unistd.h>
248int main()
249{
250  struct stat stat1;
251  (void)stat1.st_mtim.tv_sec;
252  (void)stat1.st_mtim.tv_nsec;
253  return 0;
254}
255#endif
256
257#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
258#  include <sys/types.h>
259
260#  include <sys/stat.h>
261#  include <unistd.h>
262int main()
263{
264  struct stat stat1;
265  (void)stat1.st_mtimespec.tv_sec;
266  (void)stat1.st_mtimespec.tv_nsec;
267  return 0;
268}
269#endif
270
271#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
272void function(long**)
273{
274}
275int main()
276{
277  __int64** p = 0;
278  function(p);
279  return 0;
280}
281#endif
282
283#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
284void function(long long**)
285{
286}
287int main()
288{
289  __int64** p = 0;
290  function(p);
291  return 0;
292}
293#endif
294
295#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
296#  include <iostream>
297int test_istream(std::istream& is, long long& x)
298{
299  return (is >> x) ? 1 : 0;
300}
301int main()
302{
303  long long x = 0;
304  return test_istream(std::cin, x);
305}
306#endif
307
308#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
309#  include <iostream>
310int test_ostream(std::ostream& os, long long x)
311{
312  return (os << x) ? 1 : 0;
313}
314int main()
315{
316  long long x = 0;
317  return test_ostream(std::cout, x);
318}
319#endif
320
321#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
322#  include <iostream>
323int test_istream(std::istream& is, __int64& x)
324{
325  return (is >> x) ? 1 : 0;
326}
327int main()
328{
329  __int64 x = 0;
330  return test_istream(std::cin, x);
331}
332#endif
333
334#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
335#  include <iostream>
336int test_ostream(std::ostream& os, __int64 x)
337{
338  return (os << x) ? 1 : 0;
339}
340int main()
341{
342  __int64 x = 0;
343  return test_ostream(std::cout, x);
344}
345#endif
346
347#ifdef TEST_KWSYS_LFS_WORKS
348/* Return 0 when LFS is available and 1 otherwise.  */
349#  define _LARGEFILE_SOURCE
350#  define _LARGEFILE64_SOURCE
351#  define _LARGE_FILES
352#  define _FILE_OFFSET_BITS 64
353#  include <sys/types.h>
354
355#  include <assert.h>
356#  include <sys/stat.h>
357#  if KWSYS_CXX_HAS_CSTDIO
358#    include <cstdio>
359#  endif
360#  include <stdio.h>
361
362int main(int, char** argv)
363{
364/* check that off_t can hold 2^63 - 1 and perform basic operations... */
365#  define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
366  if (OFF_T_64 % 2147483647 != 1)
367    return 1;
368
369  // stat breaks on SCO OpenServer
370  struct stat buf;
371  stat(argv[0], &buf);
372  if (!S_ISREG(buf.st_mode))
373    return 2;
374
375  FILE* file = fopen(argv[0], "r");
376  off_t offset = ftello(file);
377  fseek(file, offset, SEEK_CUR);
378  fclose(file);
379  return 0;
380}
381#endif
382
383#ifdef TEST_KWSYS_CXX_HAS_SETENV
384#  include <stdlib.h>
385int main()
386{
387  return setenv("A", "B", 1);
388}
389#endif
390
391#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
392#  include <stdlib.h>
393int main()
394{
395  unsetenv("A");
396  return 0;
397}
398#endif
399
400#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
401#  include <stdlib.h>
402int main()
403{
404  char* e = environ[0];
405  return e ? 0 : 1;
406}
407#endif
408
409#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
410// Match feature definitions from SystemInformation.cxx
411#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
412#    define _GNU_SOURCE
413#  endif
414#  include <stdlib.h>
415int main()
416{
417  double loadavg[3] = { 0.0, 0.0, 0.0 };
418  return getloadavg(loadavg, 3);
419}
420#endif
421
422#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
423#  if defined(KWSYS_HAS_LFS)
424#    define _LARGEFILE_SOURCE
425#    define _LARGEFILE64_SOURCE
426#    define _LARGE_FILES
427#    define _FILE_OFFSET_BITS 64
428#  endif
429#  include <sys/resource.h>
430int main()
431{
432  struct rlimit64 rlim;
433  return getrlimit64(0, &rlim);
434}
435#endif
436
437#ifdef TEST_KWSYS_CXX_HAS_ATOLL
438#  include <stdlib.h>
439int main()
440{
441  const char* str = "1024";
442  return static_cast<int>(atoll(str));
443}
444#endif
445
446#ifdef TEST_KWSYS_CXX_HAS_ATOL
447#  include <stdlib.h>
448int main()
449{
450  const char* str = "1024";
451  return static_cast<int>(atol(str));
452}
453#endif
454
455#ifdef TEST_KWSYS_CXX_HAS__ATOI64
456#  include <stdlib.h>
457int main()
458{
459  const char* str = "1024";
460  return static_cast<int>(_atoi64(str));
461}
462#endif
463
464#ifdef TEST_KWSYS_CXX_HAS_UTIMES
465#  include <sys/time.h>
466int main()
467{
468  struct timeval* current_time = 0;
469  return utimes("/example", current_time);
470}
471#endif
472
473#ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT
474#  include <fcntl.h>
475#  include <sys/stat.h>
476#  if defined(__APPLE__)
477#    include <AvailabilityMacros.h>
478#    if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
479#      error "utimensat not available on macOS < 10.13"
480#    endif
481#  endif
482int main()
483{
484  struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } };
485  return utimensat(AT_FDCWD, "/example", times, AT_SYMLINK_NOFOLLOW);
486}
487#endif
488
489#ifdef TEST_KWSYS_CXX_HAS_BACKTRACE
490#  if defined(__PATHSCALE__) || defined(__PATHCC__) ||                        \
491    (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41))
492backtrace does not work with this compiler or os
493#  endif
494#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
495#    define _GNU_SOURCE
496#  endif
497#  include <execinfo.h>
498int main()
499{
500  void* stackSymbols[256];
501  backtrace(stackSymbols, 256);
502  backtrace_symbols(&stackSymbols[0], 1);
503  return 0;
504}
505#endif
506
507#ifdef TEST_KWSYS_CXX_HAS_DLADDR
508#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
509#    define _GNU_SOURCE
510#  endif
511#  include <dlfcn.h>
512int main()
513{
514  Dl_info info;
515  int ierr = dladdr((void*)main, &info);
516  return 0;
517}
518#endif
519
520#ifdef TEST_KWSYS_CXX_HAS_CXXABI
521#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
522#    define _GNU_SOURCE
523#  endif
524#  if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux &&             \
525    __SUNPRO_CC_COMPAT == 'G'
526#    include <iostream>
527#  endif
528#  include <cxxabi.h>
529int main()
530{
531  int status = 0;
532  size_t bufferLen = 512;
533  char buffer[512] = { '\0' };
534  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
535  char* demangledFunction =
536    abi::__cxa_demangle(function, buffer, &bufferLen, &status);
537  return status;
538}
539#endif
540
541#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
542int main()
543{
544  int a = 1;
545  __asm {
546    xor EBX, EBX;
547    mov a, EBX;
548  }
549
550  return a;
551}
552#endif
553
554#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID
555int main()
556{
557  int a = 0;
558  __asm {
559    xor EAX, EAX;
560    cpuid;
561    mov a, EAX;
562  }
563
564  return a;
565}
566#endif
567
568#ifdef TEST_KWSYS_STL_HAS_WSTRING
569#  include <string>
570void f(std::wstring*)
571{
572}
573int main()
574{
575  return 0;
576}
577#endif
578
579#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
580#  include <ext/stdio_filebuf.h>
581int main()
582{
583  return 0;
584}
585#endif
586------------------------------------------
587ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
588Test succeeded
589Try: /opt/local/bin/g++-mp-6
590Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32          -DTEST_KWSYS_CXX_HAS_UNSETENV /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_11022_test
591----------  file   -----------------------
592/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
593   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
594#ifdef TEST_KWSYS_CXX_HAS_CSTDIO
595#  include <cstdio>
596int main()
597{
598  return 0;
599}
600#endif
601
602#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
603long long f(long long n)
604{
605  return n;
606}
607int main()
608{
609  long long n = 0;
610  return static_cast<int>(f(n));
611}
612#endif
613
614#ifdef TEST_KWSYS_CXX_HAS___INT64
615__int64 f(__int64 n)
616{
617  return n;
618}
619int main()
620{
621  __int64 n = 0;
622  return static_cast<int>(f(n));
623}
624#endif
625
626#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM
627#  include <sys/types.h>
628
629#  include <sys/stat.h>
630#  include <unistd.h>
631int main()
632{
633  struct stat stat1;
634  (void)stat1.st_mtim.tv_sec;
635  (void)stat1.st_mtim.tv_nsec;
636  return 0;
637}
638#endif
639
640#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
641#  include <sys/types.h>
642
643#  include <sys/stat.h>
644#  include <unistd.h>
645int main()
646{
647  struct stat stat1;
648  (void)stat1.st_mtimespec.tv_sec;
649  (void)stat1.st_mtimespec.tv_nsec;
650  return 0;
651}
652#endif
653
654#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
655void function(long**)
656{
657}
658int main()
659{
660  __int64** p = 0;
661  function(p);
662  return 0;
663}
664#endif
665
666#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
667void function(long long**)
668{
669}
670int main()
671{
672  __int64** p = 0;
673  function(p);
674  return 0;
675}
676#endif
677
678#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
679#  include <iostream>
680int test_istream(std::istream& is, long long& x)
681{
682  return (is >> x) ? 1 : 0;
683}
684int main()
685{
686  long long x = 0;
687  return test_istream(std::cin, x);
688}
689#endif
690
691#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
692#  include <iostream>
693int test_ostream(std::ostream& os, long long x)
694{
695  return (os << x) ? 1 : 0;
696}
697int main()
698{
699  long long x = 0;
700  return test_ostream(std::cout, x);
701}
702#endif
703
704#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
705#  include <iostream>
706int test_istream(std::istream& is, __int64& x)
707{
708  return (is >> x) ? 1 : 0;
709}
710int main()
711{
712  __int64 x = 0;
713  return test_istream(std::cin, x);
714}
715#endif
716
717#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
718#  include <iostream>
719int test_ostream(std::ostream& os, __int64 x)
720{
721  return (os << x) ? 1 : 0;
722}
723int main()
724{
725  __int64 x = 0;
726  return test_ostream(std::cout, x);
727}
728#endif
729
730#ifdef TEST_KWSYS_LFS_WORKS
731/* Return 0 when LFS is available and 1 otherwise.  */
732#  define _LARGEFILE_SOURCE
733#  define _LARGEFILE64_SOURCE
734#  define _LARGE_FILES
735#  define _FILE_OFFSET_BITS 64
736#  include <sys/types.h>
737
738#  include <assert.h>
739#  include <sys/stat.h>
740#  if KWSYS_CXX_HAS_CSTDIO
741#    include <cstdio>
742#  endif
743#  include <stdio.h>
744
745int main(int, char** argv)
746{
747/* check that off_t can hold 2^63 - 1 and perform basic operations... */
748#  define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
749  if (OFF_T_64 % 2147483647 != 1)
750    return 1;
751
752  // stat breaks on SCO OpenServer
753  struct stat buf;
754  stat(argv[0], &buf);
755  if (!S_ISREG(buf.st_mode))
756    return 2;
757
758  FILE* file = fopen(argv[0], "r");
759  off_t offset = ftello(file);
760  fseek(file, offset, SEEK_CUR);
761  fclose(file);
762  return 0;
763}
764#endif
765
766#ifdef TEST_KWSYS_CXX_HAS_SETENV
767#  include <stdlib.h>
768int main()
769{
770  return setenv("A", "B", 1);
771}
772#endif
773
774#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
775#  include <stdlib.h>
776int main()
777{
778  unsetenv("A");
779  return 0;
780}
781#endif
782
783#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
784#  include <stdlib.h>
785int main()
786{
787  char* e = environ[0];
788  return e ? 0 : 1;
789}
790#endif
791
792#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
793// Match feature definitions from SystemInformation.cxx
794#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
795#    define _GNU_SOURCE
796#  endif
797#  include <stdlib.h>
798int main()
799{
800  double loadavg[3] = { 0.0, 0.0, 0.0 };
801  return getloadavg(loadavg, 3);
802}
803#endif
804
805#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
806#  if defined(KWSYS_HAS_LFS)
807#    define _LARGEFILE_SOURCE
808#    define _LARGEFILE64_SOURCE
809#    define _LARGE_FILES
810#    define _FILE_OFFSET_BITS 64
811#  endif
812#  include <sys/resource.h>
813int main()
814{
815  struct rlimit64 rlim;
816  return getrlimit64(0, &rlim);
817}
818#endif
819
820#ifdef TEST_KWSYS_CXX_HAS_ATOLL
821#  include <stdlib.h>
822int main()
823{
824  const char* str = "1024";
825  return static_cast<int>(atoll(str));
826}
827#endif
828
829#ifdef TEST_KWSYS_CXX_HAS_ATOL
830#  include <stdlib.h>
831int main()
832{
833  const char* str = "1024";
834  return static_cast<int>(atol(str));
835}
836#endif
837
838#ifdef TEST_KWSYS_CXX_HAS__ATOI64
839#  include <stdlib.h>
840int main()
841{
842  const char* str = "1024";
843  return static_cast<int>(_atoi64(str));
844}
845#endif
846
847#ifdef TEST_KWSYS_CXX_HAS_UTIMES
848#  include <sys/time.h>
849int main()
850{
851  struct timeval* current_time = 0;
852  return utimes("/example", current_time);
853}
854#endif
855
856#ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT
857#  include <fcntl.h>
858#  include <sys/stat.h>
859#  if defined(__APPLE__)
860#    include <AvailabilityMacros.h>
861#    if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
862#      error "utimensat not available on macOS < 10.13"
863#    endif
864#  endif
865int main()
866{
867  struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } };
868  return utimensat(AT_FDCWD, "/example", times, AT_SYMLINK_NOFOLLOW);
869}
870#endif
871
872#ifdef TEST_KWSYS_CXX_HAS_BACKTRACE
873#  if defined(__PATHSCALE__) || defined(__PATHCC__) ||                        \
874    (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41))
875backtrace does not work with this compiler or os
876#  endif
877#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
878#    define _GNU_SOURCE
879#  endif
880#  include <execinfo.h>
881int main()
882{
883  void* stackSymbols[256];
884  backtrace(stackSymbols, 256);
885  backtrace_symbols(&stackSymbols[0], 1);
886  return 0;
887}
888#endif
889
890#ifdef TEST_KWSYS_CXX_HAS_DLADDR
891#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
892#    define _GNU_SOURCE
893#  endif
894#  include <dlfcn.h>
895int main()
896{
897  Dl_info info;
898  int ierr = dladdr((void*)main, &info);
899  return 0;
900}
901#endif
902
903#ifdef TEST_KWSYS_CXX_HAS_CXXABI
904#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
905#    define _GNU_SOURCE
906#  endif
907#  if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux &&             \
908    __SUNPRO_CC_COMPAT == 'G'
909#    include <iostream>
910#  endif
911#  include <cxxabi.h>
912int main()
913{
914  int status = 0;
915  size_t bufferLen = 512;
916  char buffer[512] = { '\0' };
917  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
918  char* demangledFunction =
919    abi::__cxa_demangle(function, buffer, &bufferLen, &status);
920  return status;
921}
922#endif
923
924#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
925int main()
926{
927  int a = 1;
928  __asm {
929    xor EBX, EBX;
930    mov a, EBX;
931  }
932
933  return a;
934}
935#endif
936
937#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID
938int main()
939{
940  int a = 0;
941  __asm {
942    xor EAX, EAX;
943    cpuid;
944    mov a, EAX;
945  }
946
947  return a;
948}
949#endif
950
951#ifdef TEST_KWSYS_STL_HAS_WSTRING
952#  include <string>
953void f(std::wstring*)
954{
955}
956int main()
957{
958  return 0;
959}
960#endif
961
962#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
963#  include <ext/stdio_filebuf.h>
964int main()
965{
966  return 0;
967}
968#endif
969------------------------------------------
970ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
971Test succeeded
972Try: /opt/local/bin/g++-mp-6
973Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32          -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_11022_test
974----------  file   -----------------------
975/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
976   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
977#ifdef TEST_KWSYS_CXX_HAS_CSTDIO
978#  include <cstdio>
979int main()
980{
981  return 0;
982}
983#endif
984
985#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
986long long f(long long n)
987{
988  return n;
989}
990int main()
991{
992  long long n = 0;
993  return static_cast<int>(f(n));
994}
995#endif
996
997#ifdef TEST_KWSYS_CXX_HAS___INT64
998__int64 f(__int64 n)
999{
1000  return n;
1001}
1002int main()
1003{
1004  __int64 n = 0;
1005  return static_cast<int>(f(n));
1006}
1007#endif
1008
1009#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM
1010#  include <sys/types.h>
1011
1012#  include <sys/stat.h>
1013#  include <unistd.h>
1014int main()
1015{
1016  struct stat stat1;
1017  (void)stat1.st_mtim.tv_sec;
1018  (void)stat1.st_mtim.tv_nsec;
1019  return 0;
1020}
1021#endif
1022
1023#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
1024#  include <sys/types.h>
1025
1026#  include <sys/stat.h>
1027#  include <unistd.h>
1028int main()
1029{
1030  struct stat stat1;
1031  (void)stat1.st_mtimespec.tv_sec;
1032  (void)stat1.st_mtimespec.tv_nsec;
1033  return 0;
1034}
1035#endif
1036
1037#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
1038void function(long**)
1039{
1040}
1041int main()
1042{
1043  __int64** p = 0;
1044  function(p);
1045  return 0;
1046}
1047#endif
1048
1049#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
1050void function(long long**)
1051{
1052}
1053int main()
1054{
1055  __int64** p = 0;
1056  function(p);
1057  return 0;
1058}
1059#endif
1060
1061#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
1062#  include <iostream>
1063int test_istream(std::istream& is, long long& x)
1064{
1065  return (is >> x) ? 1 : 0;
1066}
1067int main()
1068{
1069  long long x = 0;
1070  return test_istream(std::cin, x);
1071}
1072#endif
1073
1074#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
1075#  include <iostream>
1076int test_ostream(std::ostream& os, long long x)
1077{
1078  return (os << x) ? 1 : 0;
1079}
1080int main()
1081{
1082  long long x = 0;
1083  return test_ostream(std::cout, x);
1084}
1085#endif
1086
1087#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
1088#  include <iostream>
1089int test_istream(std::istream& is, __int64& x)
1090{
1091  return (is >> x) ? 1 : 0;
1092}
1093int main()
1094{
1095  __int64 x = 0;
1096  return test_istream(std::cin, x);
1097}
1098#endif
1099
1100#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
1101#  include <iostream>
1102int test_ostream(std::ostream& os, __int64 x)
1103{
1104  return (os << x) ? 1 : 0;
1105}
1106int main()
1107{
1108  __int64 x = 0;
1109  return test_ostream(std::cout, x);
1110}
1111#endif
1112
1113#ifdef TEST_KWSYS_LFS_WORKS
1114/* Return 0 when LFS is available and 1 otherwise.  */
1115#  define _LARGEFILE_SOURCE
1116#  define _LARGEFILE64_SOURCE
1117#  define _LARGE_FILES
1118#  define _FILE_OFFSET_BITS 64
1119#  include <sys/types.h>
1120
1121#  include <assert.h>
1122#  include <sys/stat.h>
1123#  if KWSYS_CXX_HAS_CSTDIO
1124#    include <cstdio>
1125#  endif
1126#  include <stdio.h>
1127
1128int main(int, char** argv)
1129{
1130/* check that off_t can hold 2^63 - 1 and perform basic operations... */
1131#  define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
1132  if (OFF_T_64 % 2147483647 != 1)
1133    return 1;
1134
1135  // stat breaks on SCO OpenServer
1136  struct stat buf;
1137  stat(argv[0], &buf);
1138  if (!S_ISREG(buf.st_mode))
1139    return 2;
1140
1141  FILE* file = fopen(argv[0], "r");
1142  off_t offset = ftello(file);
1143  fseek(file, offset, SEEK_CUR);
1144  fclose(file);
1145  return 0;
1146}
1147#endif
1148
1149#ifdef TEST_KWSYS_CXX_HAS_SETENV
1150#  include <stdlib.h>
1151int main()
1152{
1153  return setenv("A", "B", 1);
1154}
1155#endif
1156
1157#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
1158#  include <stdlib.h>
1159int main()
1160{
1161  unsetenv("A");
1162  return 0;
1163}
1164#endif
1165
1166#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
1167#  include <stdlib.h>
1168int main()
1169{
1170  char* e = environ[0];
1171  return e ? 0 : 1;
1172}
1173#endif
1174
1175#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
1176// Match feature definitions from SystemInformation.cxx
1177#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1178#    define _GNU_SOURCE
1179#  endif
1180#  include <stdlib.h>
1181int main()
1182{
1183  double loadavg[3] = { 0.0, 0.0, 0.0 };
1184  return getloadavg(loadavg, 3);
1185}
1186#endif
1187
1188#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
1189#  if defined(KWSYS_HAS_LFS)
1190#    define _LARGEFILE_SOURCE
1191#    define _LARGEFILE64_SOURCE
1192#    define _LARGE_FILES
1193#    define _FILE_OFFSET_BITS 64
1194#  endif
1195#  include <sys/resource.h>
1196int main()
1197{
1198  struct rlimit64 rlim;
1199  return getrlimit64(0, &rlim);
1200}
1201#endif
1202
1203#ifdef TEST_KWSYS_CXX_HAS_ATOLL
1204#  include <stdlib.h>
1205int main()
1206{
1207  const char* str = "1024";
1208  return static_cast<int>(atoll(str));
1209}
1210#endif
1211
1212#ifdef TEST_KWSYS_CXX_HAS_ATOL
1213#  include <stdlib.h>
1214int main()
1215{
1216  const char* str = "1024";
1217  return static_cast<int>(atol(str));
1218}
1219#endif
1220
1221#ifdef TEST_KWSYS_CXX_HAS__ATOI64
1222#  include <stdlib.h>
1223int main()
1224{
1225  const char* str = "1024";
1226  return static_cast<int>(_atoi64(str));
1227}
1228#endif
1229
1230#ifdef TEST_KWSYS_CXX_HAS_UTIMES
1231#  include <sys/time.h>
1232int main()
1233{
1234  struct timeval* current_time = 0;
1235  return utimes("/example", current_time);
1236}
1237#endif
1238
1239#ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT
1240#  include <fcntl.h>
1241#  include <sys/stat.h>
1242#  if defined(__APPLE__)
1243#    include <AvailabilityMacros.h>
1244#    if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
1245#      error "utimensat not available on macOS < 10.13"
1246#    endif
1247#  endif
1248int main()
1249{
1250  struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } };
1251  return utimensat(AT_FDCWD, "/example", times, AT_SYMLINK_NOFOLLOW);
1252}
1253#endif
1254
1255#ifdef TEST_KWSYS_CXX_HAS_BACKTRACE
1256#  if defined(__PATHSCALE__) || defined(__PATHCC__) ||                        \
1257    (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41))
1258backtrace does not work with this compiler or os
1259#  endif
1260#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1261#    define _GNU_SOURCE
1262#  endif
1263#  include <execinfo.h>
1264int main()
1265{
1266  void* stackSymbols[256];
1267  backtrace(stackSymbols, 256);
1268  backtrace_symbols(&stackSymbols[0], 1);
1269  return 0;
1270}
1271#endif
1272
1273#ifdef TEST_KWSYS_CXX_HAS_DLADDR
1274#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1275#    define _GNU_SOURCE
1276#  endif
1277#  include <dlfcn.h>
1278int main()
1279{
1280  Dl_info info;
1281  int ierr = dladdr((void*)main, &info);
1282  return 0;
1283}
1284#endif
1285
1286#ifdef TEST_KWSYS_CXX_HAS_CXXABI
1287#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1288#    define _GNU_SOURCE
1289#  endif
1290#  if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux &&             \
1291    __SUNPRO_CC_COMPAT == 'G'
1292#    include <iostream>
1293#  endif
1294#  include <cxxabi.h>
1295int main()
1296{
1297  int status = 0;
1298  size_t bufferLen = 512;
1299  char buffer[512] = { '\0' };
1300  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
1301  char* demangledFunction =
1302    abi::__cxa_demangle(function, buffer, &bufferLen, &status);
1303  return status;
1304}
1305#endif
1306
1307#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
1308int main()
1309{
1310  int a = 1;
1311  __asm {
1312    xor EBX, EBX;
1313    mov a, EBX;
1314  }
1315
1316  return a;
1317}
1318#endif
1319
1320#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID
1321int main()
1322{
1323  int a = 0;
1324  __asm {
1325    xor EAX, EAX;
1326    cpuid;
1327    mov a, EAX;
1328  }
1329
1330  return a;
1331}
1332#endif
1333
1334#ifdef TEST_KWSYS_STL_HAS_WSTRING
1335#  include <string>
1336void f(std::wstring*)
1337{
1338}
1339int main()
1340{
1341  return 0;
1342}
1343#endif
1344
1345#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
1346#  include <ext/stdio_filebuf.h>
1347int main()
1348{
1349  return 0;
1350}
1351#endif
1352------------------------------------------
1353/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx: In function 'int main()':
1354/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx:196:13: error: 'environ' was not declared in this scope
1355   char* e = environ[0];
1356             ^~~~~~~
1357Test failed to compile
1358Try: /opt/local/bin/g++-mp-6
1359Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32          -DTEST_KWSYS_STL_HAS_WSTRING /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_11022_test
1360----------  file   -----------------------
1361/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
1362   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
1363#ifdef TEST_KWSYS_CXX_HAS_CSTDIO
1364#  include <cstdio>
1365int main()
1366{
1367  return 0;
1368}
1369#endif
1370
1371#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
1372long long f(long long n)
1373{
1374  return n;
1375}
1376int main()
1377{
1378  long long n = 0;
1379  return static_cast<int>(f(n));
1380}
1381#endif
1382
1383#ifdef TEST_KWSYS_CXX_HAS___INT64
1384__int64 f(__int64 n)
1385{
1386  return n;
1387}
1388int main()
1389{
1390  __int64 n = 0;
1391  return static_cast<int>(f(n));
1392}
1393#endif
1394
1395#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM
1396#  include <sys/types.h>
1397
1398#  include <sys/stat.h>
1399#  include <unistd.h>
1400int main()
1401{
1402  struct stat stat1;
1403  (void)stat1.st_mtim.tv_sec;
1404  (void)stat1.st_mtim.tv_nsec;
1405  return 0;
1406}
1407#endif
1408
1409#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
1410#  include <sys/types.h>
1411
1412#  include <sys/stat.h>
1413#  include <unistd.h>
1414int main()
1415{
1416  struct stat stat1;
1417  (void)stat1.st_mtimespec.tv_sec;
1418  (void)stat1.st_mtimespec.tv_nsec;
1419  return 0;
1420}
1421#endif
1422
1423#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
1424void function(long**)
1425{
1426}
1427int main()
1428{
1429  __int64** p = 0;
1430  function(p);
1431  return 0;
1432}
1433#endif
1434
1435#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
1436void function(long long**)
1437{
1438}
1439int main()
1440{
1441  __int64** p = 0;
1442  function(p);
1443  return 0;
1444}
1445#endif
1446
1447#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
1448#  include <iostream>
1449int test_istream(std::istream& is, long long& x)
1450{
1451  return (is >> x) ? 1 : 0;
1452}
1453int main()
1454{
1455  long long x = 0;
1456  return test_istream(std::cin, x);
1457}
1458#endif
1459
1460#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
1461#  include <iostream>
1462int test_ostream(std::ostream& os, long long x)
1463{
1464  return (os << x) ? 1 : 0;
1465}
1466int main()
1467{
1468  long long x = 0;
1469  return test_ostream(std::cout, x);
1470}
1471#endif
1472
1473#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
1474#  include <iostream>
1475int test_istream(std::istream& is, __int64& x)
1476{
1477  return (is >> x) ? 1 : 0;
1478}
1479int main()
1480{
1481  __int64 x = 0;
1482  return test_istream(std::cin, x);
1483}
1484#endif
1485
1486#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
1487#  include <iostream>
1488int test_ostream(std::ostream& os, __int64 x)
1489{
1490  return (os << x) ? 1 : 0;
1491}
1492int main()
1493{
1494  __int64 x = 0;
1495  return test_ostream(std::cout, x);
1496}
1497#endif
1498
1499#ifdef TEST_KWSYS_LFS_WORKS
1500/* Return 0 when LFS is available and 1 otherwise.  */
1501#  define _LARGEFILE_SOURCE
1502#  define _LARGEFILE64_SOURCE
1503#  define _LARGE_FILES
1504#  define _FILE_OFFSET_BITS 64
1505#  include <sys/types.h>
1506
1507#  include <assert.h>
1508#  include <sys/stat.h>
1509#  if KWSYS_CXX_HAS_CSTDIO
1510#    include <cstdio>
1511#  endif
1512#  include <stdio.h>
1513
1514int main(int, char** argv)
1515{
1516/* check that off_t can hold 2^63 - 1 and perform basic operations... */
1517#  define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
1518  if (OFF_T_64 % 2147483647 != 1)
1519    return 1;
1520
1521  // stat breaks on SCO OpenServer
1522  struct stat buf;
1523  stat(argv[0], &buf);
1524  if (!S_ISREG(buf.st_mode))
1525    return 2;
1526
1527  FILE* file = fopen(argv[0], "r");
1528  off_t offset = ftello(file);
1529  fseek(file, offset, SEEK_CUR);
1530  fclose(file);
1531  return 0;
1532}
1533#endif
1534
1535#ifdef TEST_KWSYS_CXX_HAS_SETENV
1536#  include <stdlib.h>
1537int main()
1538{
1539  return setenv("A", "B", 1);
1540}
1541#endif
1542
1543#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
1544#  include <stdlib.h>
1545int main()
1546{
1547  unsetenv("A");
1548  return 0;
1549}
1550#endif
1551
1552#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
1553#  include <stdlib.h>
1554int main()
1555{
1556  char* e = environ[0];
1557  return e ? 0 : 1;
1558}
1559#endif
1560
1561#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
1562// Match feature definitions from SystemInformation.cxx
1563#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1564#    define _GNU_SOURCE
1565#  endif
1566#  include <stdlib.h>
1567int main()
1568{
1569  double loadavg[3] = { 0.0, 0.0, 0.0 };
1570  return getloadavg(loadavg, 3);
1571}
1572#endif
1573
1574#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
1575#  if defined(KWSYS_HAS_LFS)
1576#    define _LARGEFILE_SOURCE
1577#    define _LARGEFILE64_SOURCE
1578#    define _LARGE_FILES
1579#    define _FILE_OFFSET_BITS 64
1580#  endif
1581#  include <sys/resource.h>
1582int main()
1583{
1584  struct rlimit64 rlim;
1585  return getrlimit64(0, &rlim);
1586}
1587#endif
1588
1589#ifdef TEST_KWSYS_CXX_HAS_ATOLL
1590#  include <stdlib.h>
1591int main()
1592{
1593  const char* str = "1024";
1594  return static_cast<int>(atoll(str));
1595}
1596#endif
1597
1598#ifdef TEST_KWSYS_CXX_HAS_ATOL
1599#  include <stdlib.h>
1600int main()
1601{
1602  const char* str = "1024";
1603  return static_cast<int>(atol(str));
1604}
1605#endif
1606
1607#ifdef TEST_KWSYS_CXX_HAS__ATOI64
1608#  include <stdlib.h>
1609int main()
1610{
1611  const char* str = "1024";
1612  return static_cast<int>(_atoi64(str));
1613}
1614#endif
1615
1616#ifdef TEST_KWSYS_CXX_HAS_UTIMES
1617#  include <sys/time.h>
1618int main()
1619{
1620  struct timeval* current_time = 0;
1621  return utimes("/example", current_time);
1622}
1623#endif
1624
1625#ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT
1626#  include <fcntl.h>
1627#  include <sys/stat.h>
1628#  if defined(__APPLE__)
1629#    include <AvailabilityMacros.h>
1630#    if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
1631#      error "utimensat not available on macOS < 10.13"
1632#    endif
1633#  endif
1634int main()
1635{
1636  struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } };
1637  return utimensat(AT_FDCWD, "/example", times, AT_SYMLINK_NOFOLLOW);
1638}
1639#endif
1640
1641#ifdef TEST_KWSYS_CXX_HAS_BACKTRACE
1642#  if defined(__PATHSCALE__) || defined(__PATHCC__) ||                        \
1643    (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41))
1644backtrace does not work with this compiler or os
1645#  endif
1646#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1647#    define _GNU_SOURCE
1648#  endif
1649#  include <execinfo.h>
1650int main()
1651{
1652  void* stackSymbols[256];
1653  backtrace(stackSymbols, 256);
1654  backtrace_symbols(&stackSymbols[0], 1);
1655  return 0;
1656}
1657#endif
1658
1659#ifdef TEST_KWSYS_CXX_HAS_DLADDR
1660#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1661#    define _GNU_SOURCE
1662#  endif
1663#  include <dlfcn.h>
1664int main()
1665{
1666  Dl_info info;
1667  int ierr = dladdr((void*)main, &info);
1668  return 0;
1669}
1670#endif
1671
1672#ifdef TEST_KWSYS_CXX_HAS_CXXABI
1673#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1674#    define _GNU_SOURCE
1675#  endif
1676#  if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux &&             \
1677    __SUNPRO_CC_COMPAT == 'G'
1678#    include <iostream>
1679#  endif
1680#  include <cxxabi.h>
1681int main()
1682{
1683  int status = 0;
1684  size_t bufferLen = 512;
1685  char buffer[512] = { '\0' };
1686  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
1687  char* demangledFunction =
1688    abi::__cxa_demangle(function, buffer, &bufferLen, &status);
1689  return status;
1690}
1691#endif
1692
1693#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
1694int main()
1695{
1696  int a = 1;
1697  __asm {
1698    xor EBX, EBX;
1699    mov a, EBX;
1700  }
1701
1702  return a;
1703}
1704#endif
1705
1706#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID
1707int main()
1708{
1709  int a = 0;
1710  __asm {
1711    xor EAX, EAX;
1712    cpuid;
1713    mov a, EAX;
1714  }
1715
1716  return a;
1717}
1718#endif
1719
1720#ifdef TEST_KWSYS_STL_HAS_WSTRING
1721#  include <string>
1722void f(std::wstring*)
1723{
1724}
1725int main()
1726{
1727  return 0;
1728}
1729#endif
1730
1731#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
1732#  include <ext/stdio_filebuf.h>
1733int main()
1734{
1735  return 0;
1736}
1737#endif
1738------------------------------------------
1739ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
1740Test succeeded
1741Try: /opt/local/bin/g++-mp-6
1742Line: /opt/local/bin/g++-mp-6 -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -m32          -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.12.4/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_11022_test
1743----------  file   -----------------------
1744/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
1745   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
1746#ifdef TEST_KWSYS_CXX_HAS_CSTDIO
1747#  include <cstdio>
1748int main()
1749{
1750  return 0;
1751}
1752#endif
1753
1754#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
1755long long f(long long n)
1756{
1757  return n;
1758}
1759int main()
1760{
1761  long long n = 0;
1762  return static_cast<int>(f(n));
1763}
1764#endif
1765
1766#ifdef TEST_KWSYS_CXX_HAS___INT64
1767__int64 f(__int64 n)
1768{
1769  return n;
1770}
1771int main()
1772{
1773  __int64 n = 0;
1774  return static_cast<int>(f(n));
1775}
1776#endif
1777
1778#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM
1779#  include <sys/types.h>
1780
1781#  include <sys/stat.h>
1782#  include <unistd.h>
1783int main()
1784{
1785  struct stat stat1;
1786  (void)stat1.st_mtim.tv_sec;
1787  (void)stat1.st_mtim.tv_nsec;
1788  return 0;
1789}
1790#endif
1791
1792#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
1793#  include <sys/types.h>
1794
1795#  include <sys/stat.h>
1796#  include <unistd.h>
1797int main()
1798{
1799  struct stat stat1;
1800  (void)stat1.st_mtimespec.tv_sec;
1801  (void)stat1.st_mtimespec.tv_nsec;
1802  return 0;
1803}
1804#endif
1805
1806#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
1807void function(long**)
1808{
1809}
1810int main()
1811{
1812  __int64** p = 0;
1813  function(p);
1814  return 0;
1815}
1816#endif
1817
1818#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
1819void function(long long**)
1820{
1821}
1822int main()
1823{
1824  __int64** p = 0;
1825  function(p);
1826  return 0;
1827}
1828#endif
1829
1830#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
1831#  include <iostream>
1832int test_istream(std::istream& is, long long& x)
1833{
1834  return (is >> x) ? 1 : 0;
1835}
1836int main()
1837{
1838  long long x = 0;
1839  return test_istream(std::cin, x);
1840}
1841#endif
1842
1843#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
1844#  include <iostream>
1845int test_ostream(std::ostream& os, long long x)
1846{
1847  return (os << x) ? 1 : 0;
1848}
1849int main()
1850{
1851  long long x = 0;
1852  return test_ostream(std::cout, x);
1853}
1854#endif
1855
1856#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
1857#  include <iostream>
1858int test_istream(std::istream& is, __int64& x)
1859{
1860  return (is >> x) ? 1 : 0;
1861}
1862int main()
1863{
1864  __int64 x = 0;
1865  return test_istream(std::cin, x);
1866}
1867#endif
1868
1869#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
1870#  include <iostream>
1871int test_ostream(std::ostream& os, __int64 x)
1872{
1873  return (os << x) ? 1 : 0;
1874}
1875int main()
1876{
1877  __int64 x = 0;
1878  return test_ostream(std::cout, x);
1879}
1880#endif
1881
1882#ifdef TEST_KWSYS_LFS_WORKS
1883/* Return 0 when LFS is available and 1 otherwise.  */
1884#  define _LARGEFILE_SOURCE
1885#  define _LARGEFILE64_SOURCE
1886#  define _LARGE_FILES
1887#  define _FILE_OFFSET_BITS 64
1888#  include <sys/types.h>
1889
1890#  include <assert.h>
1891#  include <sys/stat.h>
1892#  if KWSYS_CXX_HAS_CSTDIO
1893#    include <cstdio>
1894#  endif
1895#  include <stdio.h>
1896
1897int main(int, char** argv)
1898{
1899/* check that off_t can hold 2^63 - 1 and perform basic operations... */
1900#  define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
1901  if (OFF_T_64 % 2147483647 != 1)
1902    return 1;
1903
1904  // stat breaks on SCO OpenServer
1905  struct stat buf;
1906  stat(argv[0], &buf);
1907  if (!S_ISREG(buf.st_mode))
1908    return 2;
1909
1910  FILE* file = fopen(argv[0], "r");
1911  off_t offset = ftello(file);
1912  fseek(file, offset, SEEK_CUR);
1913  fclose(file);
1914  return 0;
1915}
1916#endif
1917
1918#ifdef TEST_KWSYS_CXX_HAS_SETENV
1919#  include <stdlib.h>
1920int main()
1921{
1922  return setenv("A", "B", 1);
1923}
1924#endif
1925
1926#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
1927#  include <stdlib.h>
1928int main()
1929{
1930  unsetenv("A");
1931  return 0;
1932}
1933#endif
1934
1935#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
1936#  include <stdlib.h>
1937int main()
1938{
1939  char* e = environ[0];
1940  return e ? 0 : 1;
1941}
1942#endif
1943
1944#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
1945// Match feature definitions from SystemInformation.cxx
1946#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
1947#    define _GNU_SOURCE
1948#  endif
1949#  include <stdlib.h>
1950int main()
1951{
1952  double loadavg[3] = { 0.0, 0.0, 0.0 };
1953  return getloadavg(loadavg, 3);
1954}
1955#endif
1956
1957#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
1958#  if defined(KWSYS_HAS_LFS)
1959#    define _LARGEFILE_SOURCE
1960#    define _LARGEFILE64_SOURCE
1961#    define _LARGE_FILES
1962#    define _FILE_OFFSET_BITS 64
1963#  endif
1964#  include <sys/resource.h>
1965int main()
1966{
1967  struct rlimit64 rlim;
1968  return getrlimit64(0, &rlim);
1969}
1970#endif
1971
1972#ifdef TEST_KWSYS_CXX_HAS_ATOLL
1973#  include <stdlib.h>
1974int main()
1975{
1976  const char* str = "1024";
1977  return static_cast<int>(atoll(str));
1978}
1979#endif
1980
1981#ifdef TEST_KWSYS_CXX_HAS_ATOL
1982#  include <stdlib.h>
1983int main()
1984{
1985  const char* str = "1024";
1986  return static_cast<int>(atol(str));
1987}
1988#endif
1989
1990#ifdef TEST_KWSYS_CXX_HAS__ATOI64
1991#  include <stdlib.h>
1992int main()
1993{
1994  const char* str = "1024";
1995  return static_cast<int>(_atoi64(str));
1996}
1997#endif
1998
1999#ifdef TEST_KWSYS_CXX_HAS_UTIMES
2000#  include <sys/time.h>
2001int main()
2002{
2003  struct timeval* current_time = 0;
2004  return utimes("/example", current_time);
2005}
2006#endif
2007
2008#ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT
2009#  include <fcntl.h>
2010#  include <sys/stat.h>
2011#  if defined(__APPLE__)
2012#    include <AvailabilityMacros.h>
2013#    if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
2014#      error "utimensat not available on macOS < 10.13"
2015#    endif
2016#  endif
2017int main()
2018{
2019  struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } };
2020  return utimensat(AT_FDCWD, "/example", times, AT_SYMLINK_NOFOLLOW);
2021}
2022#endif
2023
2024#ifdef TEST_KWSYS_CXX_HAS_BACKTRACE
2025#  if defined(__PATHSCALE__) || defined(__PATHCC__) ||                        \
2026    (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41))
2027backtrace does not work with this compiler or os
2028#  endif
2029#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
2030#    define _GNU_SOURCE
2031#  endif
2032#  include <execinfo.h>
2033int main()
2034{
2035  void* stackSymbols[256];
2036  backtrace(stackSymbols, 256);
2037  backtrace_symbols(&stackSymbols[0], 1);
2038  return 0;
2039}
2040#endif
2041
2042#ifdef TEST_KWSYS_CXX_HAS_DLADDR
2043#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
2044#    define _GNU_SOURCE
2045#  endif
2046#  include <dlfcn.h>
2047int main()
2048{
2049  Dl_info info;
2050  int ierr = dladdr((void*)main, &info);
2051  return 0;
2052}
2053#endif
2054
2055#ifdef TEST_KWSYS_CXX_HAS_CXXABI
2056#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
2057#    define _GNU_SOURCE
2058#  endif
2059#  if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux &&             \
2060    __SUNPRO_CC_COMPAT == 'G'
2061#    include <iostream>
2062#  endif
2063#  include <cxxabi.h>
2064int main()
2065{
2066  int status = 0;
2067  size_t bufferLen = 512;
2068  char buffer[512] = { '\0' };
2069  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
2070  char* demangledFunction =
2071    abi::__cxa_demangle(function, buffer, &bufferLen, &status);
2072  return status;
2073}
2074#endif
2075
2076#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
2077int main()
2078{
2079  int a = 1;
2080  __asm {
2081    xor EBX, EBX;
2082    mov a, EBX;
2083  }
2084
2085  return a;
2086}
2087#endif
2088
2089#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID
2090int main()
2091{
2092  int a = 0;
2093  __asm {
2094    xor EAX, EAX;
2095    cpuid;
2096    mov a, EAX;
2097  }
2098
2099  return a;
2100}
2101#endif
2102
2103#ifdef TEST_KWSYS_STL_HAS_WSTRING
2104#  include <string>
2105void f(std::wstring*)
2106{
2107}
2108int main()
2109{
2110  return 0;
2111}
2112#endif
2113
2114#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
2115#  include <ext/stdio_filebuf.h>
2116int main()
2117{
2118  return 0;
2119}
2120#endif
2121------------------------------------------
2122ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/gcc6/gcc/ppc-apple-darwin8/6.5.0/crt3.o
2123Test succeeded