odb9088

cmake_bootstrap.log

Apr 5th, 2012
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 207.08 KB | None | 0 0
  1. Try: i686-pc-linux-gnu-gcc
  2. Line: i686-pc-linux-gnu-gcc -O2 -march=i686 -pipe cmake_bootstrap_655_test.c -o cmake_bootstrap_655_test
  3. ---------- file -----------------------
  4.  
  5. #ifdef __cplusplus
  6. # error "The CMAKE_C_COMPILER is set to a C++ compiler"
  7. #endif
  8.  
  9. #include<stdio.h>
  10.  
  11. #if defined(__CLASSIC_C__)
  12. int main(argc, argv)
  13. int argc;
  14. char* argv[];
  15. #else
  16. int main(int argc, char* argv[])
  17. #endif
  18. {
  19. printf("%d%c", (argv != 0), (char)0x0a);
  20. return argc-1;
  21. }
  22.  
  23. ------------------------------------------
  24. 1
  25. Test succeded
  26. Try: i686-pc-linux-gnu-g++
  27. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST1 cmake_bootstrap_655_test.cxx -o cmake_bootstrap_655_test
  28. ---------- file -----------------------
  29.  
  30. #if defined(TEST1)
  31. # include <iostream>
  32. #else
  33. # include <iostream.h>
  34. #endif
  35.  
  36. class NeedCXX
  37. {
  38. public:
  39. NeedCXX() { this->Foo = 1; }
  40. int GetFoo() { return this->Foo; }
  41. private:
  42. int Foo;
  43. };
  44. int main()
  45. {
  46. NeedCXX c;
  47. #ifdef TEST3
  48. cout << c.GetFoo() << endl;
  49. #else
  50. std::cout << c.GetFoo() << std::endl;
  51. #endif
  52. return 0;
  53. }
  54.  
  55. ------------------------------------------
  56. 1
  57. Test succeded
  58. Try: gmake
  59. "i686-pc-linux-gnu-gcc" -Wl,-O1 -Wl,--as-needed -O2 -march=i686 -pipe -o test test.c
  60. 1
  61. gmake works
  62. Try: i686-pc-linux-gnu-g++
  63. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe cmake_bootstrap_655_test.cxx -o cmake_bootstrap_655_test
  64. ---------- file -----------------------
  65.  
  66. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  67. #include <iostream>
  68. int main() { std::cout << "This is GNU" << std::endl; return 0;}
  69. #endif
  70.  
  71. ------------------------------------------
  72. This is GNU
  73. Test succeded
  74. Try: i686-pc-linux-gnu-g++
  75. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_HAVE_STD /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  76. ---------- file -----------------------
  77. /*============================================================================
  78. KWSys - Kitware System Library
  79. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  80.  
  81. Distributed under the OSI-approved BSD License (the "License");
  82. see accompanying file Copyright.txt for details.
  83.  
  84. This software is distributed WITHOUT ANY WARRANTY; without even the
  85. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  86. See the License for more information.
  87. ============================================================================*/
  88. // Setup for tests that use result of stl namespace test.
  89. #if defined(KWSYS_STL_HAVE_STD)
  90. # if KWSYS_STL_HAVE_STD
  91. # define kwsys_stl std
  92. # else
  93. # define kwsys_stl
  94. # endif
  95. #endif
  96.  
  97. // Setup for tests that use iostreams.
  98. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  99. # if defined(_MSC_VER)
  100. # pragma warning (push,1)
  101. # endif
  102. # if KWSYS_IOS_USE_ANSI
  103. # include <iostream>
  104. # else
  105. # include <iostream.h>
  106. # endif
  107. # if defined(_MSC_VER)
  108. # pragma warning (pop)
  109. # endif
  110. # if KWSYS_IOS_HAVE_STD
  111. # define kwsys_ios std
  112. # else
  113. # define kwsys_ios
  114. # endif
  115. #endif
  116.  
  117. #ifdef TEST_KWSYS_STL_HAVE_STD
  118. #include <list>
  119. void f(std ::list<int>*) {}
  120. int main() { return 0; }
  121. #endif
  122.  
  123. #ifdef TEST_KWSYS_IOS_USE_ANSI
  124. #include <iosfwd>
  125. int main() { return 0; }
  126. #endif
  127.  
  128. #ifdef TEST_KWSYS_LFS_SUPPORT
  129. #define _LARGE_FILES
  130. #include <iostream>
  131. int main() { return 0; }
  132. #endif
  133.  
  134.  
  135. #ifdef TEST_KWSYS_IOS_HAVE_STD
  136. #include <iosfwd>
  137. void f(std ::ostream*) {}
  138. int main() { return 0; }
  139. #endif
  140.  
  141. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  142. #include <sstream>
  143. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  144. # error "GCC 2.96 stringstream is buggy"
  145. #endif
  146. int main()
  147. {
  148. std ::ostringstream ostr;
  149. ostr << "hello";
  150. if(ostr.str().size() == 5)
  151. {
  152. return 0;
  153. }
  154. return -1;
  155. }
  156. #endif
  157.  
  158. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  159. #include <strstream.h>
  160. int main() { return 0; }
  161. #endif
  162.  
  163. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  164. #include <strstrea.h>
  165. int main() { return 0; }
  166. #endif
  167.  
  168. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  169. # include <iostream.h>
  170. # include <string>
  171. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  172. int main() { return 0; }
  173. #endif
  174.  
  175. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  176. # include <iostream.h>
  177. # include <string>
  178. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  179. int main() { return 0; }
  180. #endif
  181.  
  182. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  183. # include <string>
  184. bool f(const kwsys_stl::string& s) { return s != ""; }
  185. int main() { return 0; }
  186. #endif
  187.  
  188. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  189. #include <cstdio>
  190. int main() { return 0; }
  191. #endif
  192.  
  193. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  194. #include <cstddef>
  195. void f(size_t) {}
  196. int main() { return 0; }
  197. #endif
  198.  
  199. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  200. long long f(long long n) { return n; }
  201. int main()
  202. {
  203. long long n = 0;
  204. return static_cast<int>(f(n));
  205. }
  206. #endif
  207.  
  208. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  209. template <class T> class A;
  210. template <class T> int f(A<T>&);
  211. template <class T> class A
  212. {
  213. public:
  214. // "friend int f<>(A<T>&)" would conform
  215. friend int f(A<T>&);
  216. private:
  217. int x;
  218. };
  219.  
  220. template <class T> int f(A<T>& a) { return a.x = 0; }
  221. template int f(A<int>&);
  222.  
  223. int main()
  224. {
  225. A<int> a;
  226. return f(a);
  227. }
  228. #endif
  229.  
  230. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  231. template <class U>
  232. class A
  233. {
  234. public:
  235. U u;
  236. A(): u(0) {}
  237. template <class V> V m(V* p) { return *p = u; }
  238. };
  239.  
  240. int main()
  241. {
  242. A<short> a;
  243. int s = 1;
  244. return a.m(&s);
  245. }
  246. #endif
  247.  
  248. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  249. template <class T> struct A {};
  250. template <> struct A<int*>
  251. {
  252. static int f() { return 0; }
  253. };
  254. int main() { return A<int*>::f(); }
  255. #endif
  256.  
  257. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  258. namespace N
  259. {
  260. class A {};
  261. int f(A*) { return 0; }
  262. }
  263. void f(void*);
  264. int main()
  265. {
  266. N::A* a = 0;
  267. return f(a);
  268. }
  269. #endif
  270.  
  271. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  272. #include <iterator>
  273. #include <list>
  274. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  275. int main() { return 0; }
  276. #endif
  277.  
  278. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  279. #include <iterator>
  280. #include <list>
  281. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  282. int main() { return 0; }
  283. #endif
  284.  
  285. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  286. #include <iterator>
  287. #include <list>
  288. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  289. int main() { return 0; }
  290. #endif
  291.  
  292. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  293. #include <memory>
  294. template <class Alloc>
  295. void f(const Alloc&)
  296. {
  297. typedef typename Alloc::size_type alloc_size_type;
  298. }
  299. int main()
  300. {
  301. f(kwsys_stl::allocator<char>());
  302. return 0;
  303. }
  304. #endif
  305.  
  306. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  307. #include <memory>
  308. void f(kwsys_stl::allocator::size_type const&) {}
  309. int main() { return 0; }
  310. #endif
  311.  
  312. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  313. #include <memory>
  314. template <class T, class Alloc>
  315. void f(const T&, const Alloc&)
  316. {
  317. typedef typename Alloc::template rebind<T>::other alloc_type;
  318. }
  319. int main()
  320. {
  321. f(0, kwsys_stl::allocator<char>());
  322. return 0;
  323. }
  324. #endif
  325.  
  326. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  327. #include <memory>
  328. void f(kwsys_stl::allocator<char> const& a)
  329. {
  330. a.max_size(sizeof(int));
  331. }
  332. int main()
  333. {
  334. f(kwsys_stl::allocator<char>());
  335. return 0;
  336. }
  337. #endif
  338.  
  339. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  340. #include <vector>
  341. void f(kwsys_stl::vector<int> const& v1)
  342. {
  343. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  344. }
  345. int main()
  346. {
  347. f(kwsys_stl::vector<int>());
  348. return 0;
  349. }
  350. #endif
  351.  
  352. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  353. #include <sys/types.h>
  354. #include <sys/stat.h>
  355. #include <unistd.h>
  356. int main()
  357. {
  358. struct stat stat1;
  359. (void)stat1.st_mtim.tv_sec;
  360. (void)stat1.st_mtim.tv_nsec;
  361. return 0;
  362. }
  363. #endif
  364.  
  365. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  366. void function(long**) {}
  367. int main()
  368. {
  369. __int64** p = 0;
  370. function(p);
  371. return 0;
  372. }
  373. #endif
  374.  
  375. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  376. void function(long long**) {}
  377. int main()
  378. {
  379. __int64** p = 0;
  380. function(p);
  381. return 0;
  382. }
  383. #endif
  384.  
  385. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  386. void function(double& l, unsigned __int64 const& r)
  387. {
  388. l = static_cast<double>(r);
  389. }
  390.  
  391. int main()
  392. {
  393. double tTo = 0.0;
  394. unsigned __int64 tFrom = 0;
  395. function(tTo, tFrom);
  396. return 0;
  397. }
  398. #endif
  399.  
  400. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  401. int test_binary(int, ...)
  402. {
  403. return 0;
  404. }
  405. int main()
  406. {
  407. return test_binary(1, kwsys_ios::ios::binary);
  408. }
  409. #endif
  410.  
  411. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  412. int test_istream(kwsys_ios::istream& is, long long& x)
  413. {
  414. return (is >> x)? 1:0;
  415. }
  416. int main()
  417. {
  418. long long x = 0;
  419. return test_istream(kwsys_ios::cin, x);
  420. }
  421. #endif
  422.  
  423. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  424. int test_ostream(kwsys_ios::ostream& os, long long x)
  425. {
  426. return (os << x)? 1:0;
  427. }
  428. int main()
  429. {
  430. long long x = 0;
  431. return test_ostream(kwsys_ios::cout, x);
  432. }
  433. #endif
  434.  
  435. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  436. /* Return 0 for char signed and 1 for char unsigned. */
  437. int main()
  438. {
  439. unsigned char uc = 255;
  440. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  441. }
  442. #endif
  443.  
  444. #ifdef TEST_KWSYS_LFS_WORKS
  445. /* Return 0 when LFS is available and 1 otherwise. */
  446. #define _LARGEFILE_SOURCE
  447. #define _LARGEFILE64_SOURCE
  448. #define _LARGE_FILES
  449. #define _FILE_OFFSET_BITS 64
  450. #include <sys/types.h>
  451. #include <sys/stat.h>
  452. #include <assert.h>
  453. #if KWSYS_CXX_HAS_CSTDIO
  454. # include <cstdio>
  455. #endif
  456. #include <stdio.h>
  457.  
  458. int main(int, char **argv)
  459. {
  460. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  461. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  462. if (OFF_T_64 % 2147483647 != 1)
  463. return 1;
  464.  
  465. // stat breaks on SCO OpenServer
  466. struct stat buf;
  467. stat( argv[0], &buf );
  468. if (!S_ISREG(buf.st_mode))
  469. return 2;
  470.  
  471. FILE *file = fopen( argv[0], "r" );
  472. off_t offset = ftello( file );
  473. fseek( file, offset, SEEK_CUR );
  474. fclose( file );
  475. return 0;
  476. }
  477. #endif
  478.  
  479. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  480. /* Collect fundamental type information and save it to a CMake script. */
  481.  
  482. /* Include limits.h to get macros indicating long long and __int64.
  483. Note that certain compilers need special macros to define these
  484. macros in limits.h. */
  485. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  486. # define _MSC_EXTENSIONS
  487. #endif
  488. #if defined(__GNUC__) && __GNUC__ < 3
  489. # define _GNU_SOURCE
  490. #endif
  491. #include <limits.h>
  492.  
  493. #include <stdio.h>
  494. #include <string.h>
  495.  
  496. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  497. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  498. and sometimes not. This macro will make sure the value is treated
  499. as a double-quoted string. */
  500. #define TO_STRING(x) TO_STRING0(x)
  501. #define TO_STRING0(x) TO_STRING1(x)
  502. #define TO_STRING1(x) #x
  503.  
  504. void f() {}
  505.  
  506. int main()
  507. {
  508. /* Construct the output file name. Some preprocessors will add an
  509. extra level of double quotes, so strip them. */
  510. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  511. char* fname = fbuf;
  512. if(fname[0] == '"')
  513. {
  514. ++fname;
  515. int len = static_cast<int>(strlen(fname));
  516. if(len > 0 && fname[len-1] == '"')
  517. {
  518. fname[len-1] = 0;
  519. }
  520. }
  521.  
  522. /* Try to open the output file. */
  523. if(FILE* fout = fopen(fname, "w"))
  524. {
  525. /* Set the size of standard types. */
  526. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  527. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  528. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  529. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  530.  
  531. /* Set the size of some non-standard but common types. */
  532. /* Check for a limits.h macro for long long to see if the type exists. */
  533. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  534. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  535. #else
  536. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  537. #endif
  538. /* Check for a limits.h macro for __int64 to see if the type exists. */
  539. #if defined(_I64_MIN)
  540. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  541. #else
  542. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  543. #endif
  544.  
  545. /* Set the size of some pointer types. */
  546. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  547. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  548.  
  549. /* Set whether the native type "char" is signed or unsigned. */
  550. unsigned char uc = 255;
  551. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  552. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  553.  
  554. fclose(fout);
  555. return 0;
  556. }
  557. else
  558. {
  559. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  560. fname);
  561. return 1;
  562. }
  563. }
  564. #endif
  565. ------------------------------------------
  566. Test succeded
  567. Try: i686-pc-linux-gnu-g++
  568. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_IOS_USE_ANSI /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  569. ---------- file -----------------------
  570. /*============================================================================
  571. KWSys - Kitware System Library
  572. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  573.  
  574. Distributed under the OSI-approved BSD License (the "License");
  575. see accompanying file Copyright.txt for details.
  576.  
  577. This software is distributed WITHOUT ANY WARRANTY; without even the
  578. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  579. See the License for more information.
  580. ============================================================================*/
  581. // Setup for tests that use result of stl namespace test.
  582. #if defined(KWSYS_STL_HAVE_STD)
  583. # if KWSYS_STL_HAVE_STD
  584. # define kwsys_stl std
  585. # else
  586. # define kwsys_stl
  587. # endif
  588. #endif
  589.  
  590. // Setup for tests that use iostreams.
  591. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  592. # if defined(_MSC_VER)
  593. # pragma warning (push,1)
  594. # endif
  595. # if KWSYS_IOS_USE_ANSI
  596. # include <iostream>
  597. # else
  598. # include <iostream.h>
  599. # endif
  600. # if defined(_MSC_VER)
  601. # pragma warning (pop)
  602. # endif
  603. # if KWSYS_IOS_HAVE_STD
  604. # define kwsys_ios std
  605. # else
  606. # define kwsys_ios
  607. # endif
  608. #endif
  609.  
  610. #ifdef TEST_KWSYS_STL_HAVE_STD
  611. #include <list>
  612. void f(std ::list<int>*) {}
  613. int main() { return 0; }
  614. #endif
  615.  
  616. #ifdef TEST_KWSYS_IOS_USE_ANSI
  617. #include <iosfwd>
  618. int main() { return 0; }
  619. #endif
  620.  
  621. #ifdef TEST_KWSYS_LFS_SUPPORT
  622. #define _LARGE_FILES
  623. #include <iostream>
  624. int main() { return 0; }
  625. #endif
  626.  
  627.  
  628. #ifdef TEST_KWSYS_IOS_HAVE_STD
  629. #include <iosfwd>
  630. void f(std ::ostream*) {}
  631. int main() { return 0; }
  632. #endif
  633.  
  634. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  635. #include <sstream>
  636. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  637. # error "GCC 2.96 stringstream is buggy"
  638. #endif
  639. int main()
  640. {
  641. std ::ostringstream ostr;
  642. ostr << "hello";
  643. if(ostr.str().size() == 5)
  644. {
  645. return 0;
  646. }
  647. return -1;
  648. }
  649. #endif
  650.  
  651. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  652. #include <strstream.h>
  653. int main() { return 0; }
  654. #endif
  655.  
  656. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  657. #include <strstrea.h>
  658. int main() { return 0; }
  659. #endif
  660.  
  661. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  662. # include <iostream.h>
  663. # include <string>
  664. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  665. int main() { return 0; }
  666. #endif
  667.  
  668. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  669. # include <iostream.h>
  670. # include <string>
  671. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  672. int main() { return 0; }
  673. #endif
  674.  
  675. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  676. # include <string>
  677. bool f(const kwsys_stl::string& s) { return s != ""; }
  678. int main() { return 0; }
  679. #endif
  680.  
  681. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  682. #include <cstdio>
  683. int main() { return 0; }
  684. #endif
  685.  
  686. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  687. #include <cstddef>
  688. void f(size_t) {}
  689. int main() { return 0; }
  690. #endif
  691.  
  692. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  693. long long f(long long n) { return n; }
  694. int main()
  695. {
  696. long long n = 0;
  697. return static_cast<int>(f(n));
  698. }
  699. #endif
  700.  
  701. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  702. template <class T> class A;
  703. template <class T> int f(A<T>&);
  704. template <class T> class A
  705. {
  706. public:
  707. // "friend int f<>(A<T>&)" would conform
  708. friend int f(A<T>&);
  709. private:
  710. int x;
  711. };
  712.  
  713. template <class T> int f(A<T>& a) { return a.x = 0; }
  714. template int f(A<int>&);
  715.  
  716. int main()
  717. {
  718. A<int> a;
  719. return f(a);
  720. }
  721. #endif
  722.  
  723. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  724. template <class U>
  725. class A
  726. {
  727. public:
  728. U u;
  729. A(): u(0) {}
  730. template <class V> V m(V* p) { return *p = u; }
  731. };
  732.  
  733. int main()
  734. {
  735. A<short> a;
  736. int s = 1;
  737. return a.m(&s);
  738. }
  739. #endif
  740.  
  741. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  742. template <class T> struct A {};
  743. template <> struct A<int*>
  744. {
  745. static int f() { return 0; }
  746. };
  747. int main() { return A<int*>::f(); }
  748. #endif
  749.  
  750. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  751. namespace N
  752. {
  753. class A {};
  754. int f(A*) { return 0; }
  755. }
  756. void f(void*);
  757. int main()
  758. {
  759. N::A* a = 0;
  760. return f(a);
  761. }
  762. #endif
  763.  
  764. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  765. #include <iterator>
  766. #include <list>
  767. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  768. int main() { return 0; }
  769. #endif
  770.  
  771. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  772. #include <iterator>
  773. #include <list>
  774. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  775. int main() { return 0; }
  776. #endif
  777.  
  778. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  779. #include <iterator>
  780. #include <list>
  781. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  782. int main() { return 0; }
  783. #endif
  784.  
  785. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  786. #include <memory>
  787. template <class Alloc>
  788. void f(const Alloc&)
  789. {
  790. typedef typename Alloc::size_type alloc_size_type;
  791. }
  792. int main()
  793. {
  794. f(kwsys_stl::allocator<char>());
  795. return 0;
  796. }
  797. #endif
  798.  
  799. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  800. #include <memory>
  801. void f(kwsys_stl::allocator::size_type const&) {}
  802. int main() { return 0; }
  803. #endif
  804.  
  805. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  806. #include <memory>
  807. template <class T, class Alloc>
  808. void f(const T&, const Alloc&)
  809. {
  810. typedef typename Alloc::template rebind<T>::other alloc_type;
  811. }
  812. int main()
  813. {
  814. f(0, kwsys_stl::allocator<char>());
  815. return 0;
  816. }
  817. #endif
  818.  
  819. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  820. #include <memory>
  821. void f(kwsys_stl::allocator<char> const& a)
  822. {
  823. a.max_size(sizeof(int));
  824. }
  825. int main()
  826. {
  827. f(kwsys_stl::allocator<char>());
  828. return 0;
  829. }
  830. #endif
  831.  
  832. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  833. #include <vector>
  834. void f(kwsys_stl::vector<int> const& v1)
  835. {
  836. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  837. }
  838. int main()
  839. {
  840. f(kwsys_stl::vector<int>());
  841. return 0;
  842. }
  843. #endif
  844.  
  845. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  846. #include <sys/types.h>
  847. #include <sys/stat.h>
  848. #include <unistd.h>
  849. int main()
  850. {
  851. struct stat stat1;
  852. (void)stat1.st_mtim.tv_sec;
  853. (void)stat1.st_mtim.tv_nsec;
  854. return 0;
  855. }
  856. #endif
  857.  
  858. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  859. void function(long**) {}
  860. int main()
  861. {
  862. __int64** p = 0;
  863. function(p);
  864. return 0;
  865. }
  866. #endif
  867.  
  868. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  869. void function(long long**) {}
  870. int main()
  871. {
  872. __int64** p = 0;
  873. function(p);
  874. return 0;
  875. }
  876. #endif
  877.  
  878. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  879. void function(double& l, unsigned __int64 const& r)
  880. {
  881. l = static_cast<double>(r);
  882. }
  883.  
  884. int main()
  885. {
  886. double tTo = 0.0;
  887. unsigned __int64 tFrom = 0;
  888. function(tTo, tFrom);
  889. return 0;
  890. }
  891. #endif
  892.  
  893. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  894. int test_binary(int, ...)
  895. {
  896. return 0;
  897. }
  898. int main()
  899. {
  900. return test_binary(1, kwsys_ios::ios::binary);
  901. }
  902. #endif
  903.  
  904. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  905. int test_istream(kwsys_ios::istream& is, long long& x)
  906. {
  907. return (is >> x)? 1:0;
  908. }
  909. int main()
  910. {
  911. long long x = 0;
  912. return test_istream(kwsys_ios::cin, x);
  913. }
  914. #endif
  915.  
  916. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  917. int test_ostream(kwsys_ios::ostream& os, long long x)
  918. {
  919. return (os << x)? 1:0;
  920. }
  921. int main()
  922. {
  923. long long x = 0;
  924. return test_ostream(kwsys_ios::cout, x);
  925. }
  926. #endif
  927.  
  928. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  929. /* Return 0 for char signed and 1 for char unsigned. */
  930. int main()
  931. {
  932. unsigned char uc = 255;
  933. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  934. }
  935. #endif
  936.  
  937. #ifdef TEST_KWSYS_LFS_WORKS
  938. /* Return 0 when LFS is available and 1 otherwise. */
  939. #define _LARGEFILE_SOURCE
  940. #define _LARGEFILE64_SOURCE
  941. #define _LARGE_FILES
  942. #define _FILE_OFFSET_BITS 64
  943. #include <sys/types.h>
  944. #include <sys/stat.h>
  945. #include <assert.h>
  946. #if KWSYS_CXX_HAS_CSTDIO
  947. # include <cstdio>
  948. #endif
  949. #include <stdio.h>
  950.  
  951. int main(int, char **argv)
  952. {
  953. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  954. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  955. if (OFF_T_64 % 2147483647 != 1)
  956. return 1;
  957.  
  958. // stat breaks on SCO OpenServer
  959. struct stat buf;
  960. stat( argv[0], &buf );
  961. if (!S_ISREG(buf.st_mode))
  962. return 2;
  963.  
  964. FILE *file = fopen( argv[0], "r" );
  965. off_t offset = ftello( file );
  966. fseek( file, offset, SEEK_CUR );
  967. fclose( file );
  968. return 0;
  969. }
  970. #endif
  971.  
  972. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  973. /* Collect fundamental type information and save it to a CMake script. */
  974.  
  975. /* Include limits.h to get macros indicating long long and __int64.
  976. Note that certain compilers need special macros to define these
  977. macros in limits.h. */
  978. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  979. # define _MSC_EXTENSIONS
  980. #endif
  981. #if defined(__GNUC__) && __GNUC__ < 3
  982. # define _GNU_SOURCE
  983. #endif
  984. #include <limits.h>
  985.  
  986. #include <stdio.h>
  987. #include <string.h>
  988.  
  989. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  990. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  991. and sometimes not. This macro will make sure the value is treated
  992. as a double-quoted string. */
  993. #define TO_STRING(x) TO_STRING0(x)
  994. #define TO_STRING0(x) TO_STRING1(x)
  995. #define TO_STRING1(x) #x
  996.  
  997. void f() {}
  998.  
  999. int main()
  1000. {
  1001. /* Construct the output file name. Some preprocessors will add an
  1002. extra level of double quotes, so strip them. */
  1003. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  1004. char* fname = fbuf;
  1005. if(fname[0] == '"')
  1006. {
  1007. ++fname;
  1008. int len = static_cast<int>(strlen(fname));
  1009. if(len > 0 && fname[len-1] == '"')
  1010. {
  1011. fname[len-1] = 0;
  1012. }
  1013. }
  1014.  
  1015. /* Try to open the output file. */
  1016. if(FILE* fout = fopen(fname, "w"))
  1017. {
  1018. /* Set the size of standard types. */
  1019. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  1020. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  1021. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  1022. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  1023.  
  1024. /* Set the size of some non-standard but common types. */
  1025. /* Check for a limits.h macro for long long to see if the type exists. */
  1026. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  1027. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  1028. #else
  1029. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  1030. #endif
  1031. /* Check for a limits.h macro for __int64 to see if the type exists. */
  1032. #if defined(_I64_MIN)
  1033. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  1034. #else
  1035. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  1036. #endif
  1037.  
  1038. /* Set the size of some pointer types. */
  1039. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  1040. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  1041.  
  1042. /* Set whether the native type "char" is signed or unsigned. */
  1043. unsigned char uc = 255;
  1044. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  1045. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  1046.  
  1047. fclose(fout);
  1048. return 0;
  1049. }
  1050. else
  1051. {
  1052. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  1053. fname);
  1054. return 1;
  1055. }
  1056. }
  1057. #endif
  1058. ------------------------------------------
  1059. Test succeded
  1060. Try: i686-pc-linux-gnu-g++
  1061. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_IOS_HAVE_STD /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  1062. ---------- file -----------------------
  1063. /*============================================================================
  1064. KWSys - Kitware System Library
  1065. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  1066.  
  1067. Distributed under the OSI-approved BSD License (the "License");
  1068. see accompanying file Copyright.txt for details.
  1069.  
  1070. This software is distributed WITHOUT ANY WARRANTY; without even the
  1071. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1072. See the License for more information.
  1073. ============================================================================*/
  1074. // Setup for tests that use result of stl namespace test.
  1075. #if defined(KWSYS_STL_HAVE_STD)
  1076. # if KWSYS_STL_HAVE_STD
  1077. # define kwsys_stl std
  1078. # else
  1079. # define kwsys_stl
  1080. # endif
  1081. #endif
  1082.  
  1083. // Setup for tests that use iostreams.
  1084. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  1085. # if defined(_MSC_VER)
  1086. # pragma warning (push,1)
  1087. # endif
  1088. # if KWSYS_IOS_USE_ANSI
  1089. # include <iostream>
  1090. # else
  1091. # include <iostream.h>
  1092. # endif
  1093. # if defined(_MSC_VER)
  1094. # pragma warning (pop)
  1095. # endif
  1096. # if KWSYS_IOS_HAVE_STD
  1097. # define kwsys_ios std
  1098. # else
  1099. # define kwsys_ios
  1100. # endif
  1101. #endif
  1102.  
  1103. #ifdef TEST_KWSYS_STL_HAVE_STD
  1104. #include <list>
  1105. void f(std ::list<int>*) {}
  1106. int main() { return 0; }
  1107. #endif
  1108.  
  1109. #ifdef TEST_KWSYS_IOS_USE_ANSI
  1110. #include <iosfwd>
  1111. int main() { return 0; }
  1112. #endif
  1113.  
  1114. #ifdef TEST_KWSYS_LFS_SUPPORT
  1115. #define _LARGE_FILES
  1116. #include <iostream>
  1117. int main() { return 0; }
  1118. #endif
  1119.  
  1120.  
  1121. #ifdef TEST_KWSYS_IOS_HAVE_STD
  1122. #include <iosfwd>
  1123. void f(std ::ostream*) {}
  1124. int main() { return 0; }
  1125. #endif
  1126.  
  1127. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  1128. #include <sstream>
  1129. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  1130. # error "GCC 2.96 stringstream is buggy"
  1131. #endif
  1132. int main()
  1133. {
  1134. std ::ostringstream ostr;
  1135. ostr << "hello";
  1136. if(ostr.str().size() == 5)
  1137. {
  1138. return 0;
  1139. }
  1140. return -1;
  1141. }
  1142. #endif
  1143.  
  1144. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  1145. #include <strstream.h>
  1146. int main() { return 0; }
  1147. #endif
  1148.  
  1149. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  1150. #include <strstrea.h>
  1151. int main() { return 0; }
  1152. #endif
  1153.  
  1154. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  1155. # include <iostream.h>
  1156. # include <string>
  1157. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  1158. int main() { return 0; }
  1159. #endif
  1160.  
  1161. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  1162. # include <iostream.h>
  1163. # include <string>
  1164. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  1165. int main() { return 0; }
  1166. #endif
  1167.  
  1168. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  1169. # include <string>
  1170. bool f(const kwsys_stl::string& s) { return s != ""; }
  1171. int main() { return 0; }
  1172. #endif
  1173.  
  1174. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  1175. #include <cstdio>
  1176. int main() { return 0; }
  1177. #endif
  1178.  
  1179. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  1180. #include <cstddef>
  1181. void f(size_t) {}
  1182. int main() { return 0; }
  1183. #endif
  1184.  
  1185. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  1186. long long f(long long n) { return n; }
  1187. int main()
  1188. {
  1189. long long n = 0;
  1190. return static_cast<int>(f(n));
  1191. }
  1192. #endif
  1193.  
  1194. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  1195. template <class T> class A;
  1196. template <class T> int f(A<T>&);
  1197. template <class T> class A
  1198. {
  1199. public:
  1200. // "friend int f<>(A<T>&)" would conform
  1201. friend int f(A<T>&);
  1202. private:
  1203. int x;
  1204. };
  1205.  
  1206. template <class T> int f(A<T>& a) { return a.x = 0; }
  1207. template int f(A<int>&);
  1208.  
  1209. int main()
  1210. {
  1211. A<int> a;
  1212. return f(a);
  1213. }
  1214. #endif
  1215.  
  1216. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  1217. template <class U>
  1218. class A
  1219. {
  1220. public:
  1221. U u;
  1222. A(): u(0) {}
  1223. template <class V> V m(V* p) { return *p = u; }
  1224. };
  1225.  
  1226. int main()
  1227. {
  1228. A<short> a;
  1229. int s = 1;
  1230. return a.m(&s);
  1231. }
  1232. #endif
  1233.  
  1234. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  1235. template <class T> struct A {};
  1236. template <> struct A<int*>
  1237. {
  1238. static int f() { return 0; }
  1239. };
  1240. int main() { return A<int*>::f(); }
  1241. #endif
  1242.  
  1243. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  1244. namespace N
  1245. {
  1246. class A {};
  1247. int f(A*) { return 0; }
  1248. }
  1249. void f(void*);
  1250. int main()
  1251. {
  1252. N::A* a = 0;
  1253. return f(a);
  1254. }
  1255. #endif
  1256.  
  1257. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  1258. #include <iterator>
  1259. #include <list>
  1260. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  1261. int main() { return 0; }
  1262. #endif
  1263.  
  1264. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  1265. #include <iterator>
  1266. #include <list>
  1267. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  1268. int main() { return 0; }
  1269. #endif
  1270.  
  1271. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  1272. #include <iterator>
  1273. #include <list>
  1274. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  1275. int main() { return 0; }
  1276. #endif
  1277.  
  1278. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  1279. #include <memory>
  1280. template <class Alloc>
  1281. void f(const Alloc&)
  1282. {
  1283. typedef typename Alloc::size_type alloc_size_type;
  1284. }
  1285. int main()
  1286. {
  1287. f(kwsys_stl::allocator<char>());
  1288. return 0;
  1289. }
  1290. #endif
  1291.  
  1292. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  1293. #include <memory>
  1294. void f(kwsys_stl::allocator::size_type const&) {}
  1295. int main() { return 0; }
  1296. #endif
  1297.  
  1298. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  1299. #include <memory>
  1300. template <class T, class Alloc>
  1301. void f(const T&, const Alloc&)
  1302. {
  1303. typedef typename Alloc::template rebind<T>::other alloc_type;
  1304. }
  1305. int main()
  1306. {
  1307. f(0, kwsys_stl::allocator<char>());
  1308. return 0;
  1309. }
  1310. #endif
  1311.  
  1312. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  1313. #include <memory>
  1314. void f(kwsys_stl::allocator<char> const& a)
  1315. {
  1316. a.max_size(sizeof(int));
  1317. }
  1318. int main()
  1319. {
  1320. f(kwsys_stl::allocator<char>());
  1321. return 0;
  1322. }
  1323. #endif
  1324.  
  1325. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  1326. #include <vector>
  1327. void f(kwsys_stl::vector<int> const& v1)
  1328. {
  1329. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  1330. }
  1331. int main()
  1332. {
  1333. f(kwsys_stl::vector<int>());
  1334. return 0;
  1335. }
  1336. #endif
  1337.  
  1338. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  1339. #include <sys/types.h>
  1340. #include <sys/stat.h>
  1341. #include <unistd.h>
  1342. int main()
  1343. {
  1344. struct stat stat1;
  1345. (void)stat1.st_mtim.tv_sec;
  1346. (void)stat1.st_mtim.tv_nsec;
  1347. return 0;
  1348. }
  1349. #endif
  1350.  
  1351. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  1352. void function(long**) {}
  1353. int main()
  1354. {
  1355. __int64** p = 0;
  1356. function(p);
  1357. return 0;
  1358. }
  1359. #endif
  1360.  
  1361. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  1362. void function(long long**) {}
  1363. int main()
  1364. {
  1365. __int64** p = 0;
  1366. function(p);
  1367. return 0;
  1368. }
  1369. #endif
  1370.  
  1371. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  1372. void function(double& l, unsigned __int64 const& r)
  1373. {
  1374. l = static_cast<double>(r);
  1375. }
  1376.  
  1377. int main()
  1378. {
  1379. double tTo = 0.0;
  1380. unsigned __int64 tFrom = 0;
  1381. function(tTo, tFrom);
  1382. return 0;
  1383. }
  1384. #endif
  1385.  
  1386. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  1387. int test_binary(int, ...)
  1388. {
  1389. return 0;
  1390. }
  1391. int main()
  1392. {
  1393. return test_binary(1, kwsys_ios::ios::binary);
  1394. }
  1395. #endif
  1396.  
  1397. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  1398. int test_istream(kwsys_ios::istream& is, long long& x)
  1399. {
  1400. return (is >> x)? 1:0;
  1401. }
  1402. int main()
  1403. {
  1404. long long x = 0;
  1405. return test_istream(kwsys_ios::cin, x);
  1406. }
  1407. #endif
  1408.  
  1409. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  1410. int test_ostream(kwsys_ios::ostream& os, long long x)
  1411. {
  1412. return (os << x)? 1:0;
  1413. }
  1414. int main()
  1415. {
  1416. long long x = 0;
  1417. return test_ostream(kwsys_ios::cout, x);
  1418. }
  1419. #endif
  1420.  
  1421. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  1422. /* Return 0 for char signed and 1 for char unsigned. */
  1423. int main()
  1424. {
  1425. unsigned char uc = 255;
  1426. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  1427. }
  1428. #endif
  1429.  
  1430. #ifdef TEST_KWSYS_LFS_WORKS
  1431. /* Return 0 when LFS is available and 1 otherwise. */
  1432. #define _LARGEFILE_SOURCE
  1433. #define _LARGEFILE64_SOURCE
  1434. #define _LARGE_FILES
  1435. #define _FILE_OFFSET_BITS 64
  1436. #include <sys/types.h>
  1437. #include <sys/stat.h>
  1438. #include <assert.h>
  1439. #if KWSYS_CXX_HAS_CSTDIO
  1440. # include <cstdio>
  1441. #endif
  1442. #include <stdio.h>
  1443.  
  1444. int main(int, char **argv)
  1445. {
  1446. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  1447. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  1448. if (OFF_T_64 % 2147483647 != 1)
  1449. return 1;
  1450.  
  1451. // stat breaks on SCO OpenServer
  1452. struct stat buf;
  1453. stat( argv[0], &buf );
  1454. if (!S_ISREG(buf.st_mode))
  1455. return 2;
  1456.  
  1457. FILE *file = fopen( argv[0], "r" );
  1458. off_t offset = ftello( file );
  1459. fseek( file, offset, SEEK_CUR );
  1460. fclose( file );
  1461. return 0;
  1462. }
  1463. #endif
  1464.  
  1465. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  1466. /* Collect fundamental type information and save it to a CMake script. */
  1467.  
  1468. /* Include limits.h to get macros indicating long long and __int64.
  1469. Note that certain compilers need special macros to define these
  1470. macros in limits.h. */
  1471. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  1472. # define _MSC_EXTENSIONS
  1473. #endif
  1474. #if defined(__GNUC__) && __GNUC__ < 3
  1475. # define _GNU_SOURCE
  1476. #endif
  1477. #include <limits.h>
  1478.  
  1479. #include <stdio.h>
  1480. #include <string.h>
  1481.  
  1482. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  1483. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  1484. and sometimes not. This macro will make sure the value is treated
  1485. as a double-quoted string. */
  1486. #define TO_STRING(x) TO_STRING0(x)
  1487. #define TO_STRING0(x) TO_STRING1(x)
  1488. #define TO_STRING1(x) #x
  1489.  
  1490. void f() {}
  1491.  
  1492. int main()
  1493. {
  1494. /* Construct the output file name. Some preprocessors will add an
  1495. extra level of double quotes, so strip them. */
  1496. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  1497. char* fname = fbuf;
  1498. if(fname[0] == '"')
  1499. {
  1500. ++fname;
  1501. int len = static_cast<int>(strlen(fname));
  1502. if(len > 0 && fname[len-1] == '"')
  1503. {
  1504. fname[len-1] = 0;
  1505. }
  1506. }
  1507.  
  1508. /* Try to open the output file. */
  1509. if(FILE* fout = fopen(fname, "w"))
  1510. {
  1511. /* Set the size of standard types. */
  1512. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  1513. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  1514. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  1515. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  1516.  
  1517. /* Set the size of some non-standard but common types. */
  1518. /* Check for a limits.h macro for long long to see if the type exists. */
  1519. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  1520. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  1521. #else
  1522. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  1523. #endif
  1524. /* Check for a limits.h macro for __int64 to see if the type exists. */
  1525. #if defined(_I64_MIN)
  1526. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  1527. #else
  1528. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  1529. #endif
  1530.  
  1531. /* Set the size of some pointer types. */
  1532. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  1533. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  1534.  
  1535. /* Set whether the native type "char" is signed or unsigned. */
  1536. unsigned char uc = 255;
  1537. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  1538. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  1539.  
  1540. fclose(fout);
  1541. return 0;
  1542. }
  1543. else
  1544. {
  1545. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  1546. fname);
  1547. return 1;
  1548. }
  1549. }
  1550. #endif
  1551. ------------------------------------------
  1552. Test succeded
  1553. Try: i686-pc-linux-gnu-g++
  1554. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_IOS_USE_SSTREAM /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  1555. ---------- file -----------------------
  1556. /*============================================================================
  1557. KWSys - Kitware System Library
  1558. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  1559.  
  1560. Distributed under the OSI-approved BSD License (the "License");
  1561. see accompanying file Copyright.txt for details.
  1562.  
  1563. This software is distributed WITHOUT ANY WARRANTY; without even the
  1564. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1565. See the License for more information.
  1566. ============================================================================*/
  1567. // Setup for tests that use result of stl namespace test.
  1568. #if defined(KWSYS_STL_HAVE_STD)
  1569. # if KWSYS_STL_HAVE_STD
  1570. # define kwsys_stl std
  1571. # else
  1572. # define kwsys_stl
  1573. # endif
  1574. #endif
  1575.  
  1576. // Setup for tests that use iostreams.
  1577. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  1578. # if defined(_MSC_VER)
  1579. # pragma warning (push,1)
  1580. # endif
  1581. # if KWSYS_IOS_USE_ANSI
  1582. # include <iostream>
  1583. # else
  1584. # include <iostream.h>
  1585. # endif
  1586. # if defined(_MSC_VER)
  1587. # pragma warning (pop)
  1588. # endif
  1589. # if KWSYS_IOS_HAVE_STD
  1590. # define kwsys_ios std
  1591. # else
  1592. # define kwsys_ios
  1593. # endif
  1594. #endif
  1595.  
  1596. #ifdef TEST_KWSYS_STL_HAVE_STD
  1597. #include <list>
  1598. void f(std ::list<int>*) {}
  1599. int main() { return 0; }
  1600. #endif
  1601.  
  1602. #ifdef TEST_KWSYS_IOS_USE_ANSI
  1603. #include <iosfwd>
  1604. int main() { return 0; }
  1605. #endif
  1606.  
  1607. #ifdef TEST_KWSYS_LFS_SUPPORT
  1608. #define _LARGE_FILES
  1609. #include <iostream>
  1610. int main() { return 0; }
  1611. #endif
  1612.  
  1613.  
  1614. #ifdef TEST_KWSYS_IOS_HAVE_STD
  1615. #include <iosfwd>
  1616. void f(std ::ostream*) {}
  1617. int main() { return 0; }
  1618. #endif
  1619.  
  1620. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  1621. #include <sstream>
  1622. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  1623. # error "GCC 2.96 stringstream is buggy"
  1624. #endif
  1625. int main()
  1626. {
  1627. std ::ostringstream ostr;
  1628. ostr << "hello";
  1629. if(ostr.str().size() == 5)
  1630. {
  1631. return 0;
  1632. }
  1633. return -1;
  1634. }
  1635. #endif
  1636.  
  1637. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  1638. #include <strstream.h>
  1639. int main() { return 0; }
  1640. #endif
  1641.  
  1642. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  1643. #include <strstrea.h>
  1644. int main() { return 0; }
  1645. #endif
  1646.  
  1647. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  1648. # include <iostream.h>
  1649. # include <string>
  1650. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  1651. int main() { return 0; }
  1652. #endif
  1653.  
  1654. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  1655. # include <iostream.h>
  1656. # include <string>
  1657. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  1658. int main() { return 0; }
  1659. #endif
  1660.  
  1661. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  1662. # include <string>
  1663. bool f(const kwsys_stl::string& s) { return s != ""; }
  1664. int main() { return 0; }
  1665. #endif
  1666.  
  1667. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  1668. #include <cstdio>
  1669. int main() { return 0; }
  1670. #endif
  1671.  
  1672. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  1673. #include <cstddef>
  1674. void f(size_t) {}
  1675. int main() { return 0; }
  1676. #endif
  1677.  
  1678. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  1679. long long f(long long n) { return n; }
  1680. int main()
  1681. {
  1682. long long n = 0;
  1683. return static_cast<int>(f(n));
  1684. }
  1685. #endif
  1686.  
  1687. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  1688. template <class T> class A;
  1689. template <class T> int f(A<T>&);
  1690. template <class T> class A
  1691. {
  1692. public:
  1693. // "friend int f<>(A<T>&)" would conform
  1694. friend int f(A<T>&);
  1695. private:
  1696. int x;
  1697. };
  1698.  
  1699. template <class T> int f(A<T>& a) { return a.x = 0; }
  1700. template int f(A<int>&);
  1701.  
  1702. int main()
  1703. {
  1704. A<int> a;
  1705. return f(a);
  1706. }
  1707. #endif
  1708.  
  1709. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  1710. template <class U>
  1711. class A
  1712. {
  1713. public:
  1714. U u;
  1715. A(): u(0) {}
  1716. template <class V> V m(V* p) { return *p = u; }
  1717. };
  1718.  
  1719. int main()
  1720. {
  1721. A<short> a;
  1722. int s = 1;
  1723. return a.m(&s);
  1724. }
  1725. #endif
  1726.  
  1727. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  1728. template <class T> struct A {};
  1729. template <> struct A<int*>
  1730. {
  1731. static int f() { return 0; }
  1732. };
  1733. int main() { return A<int*>::f(); }
  1734. #endif
  1735.  
  1736. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  1737. namespace N
  1738. {
  1739. class A {};
  1740. int f(A*) { return 0; }
  1741. }
  1742. void f(void*);
  1743. int main()
  1744. {
  1745. N::A* a = 0;
  1746. return f(a);
  1747. }
  1748. #endif
  1749.  
  1750. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  1751. #include <iterator>
  1752. #include <list>
  1753. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  1754. int main() { return 0; }
  1755. #endif
  1756.  
  1757. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  1758. #include <iterator>
  1759. #include <list>
  1760. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  1761. int main() { return 0; }
  1762. #endif
  1763.  
  1764. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  1765. #include <iterator>
  1766. #include <list>
  1767. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  1768. int main() { return 0; }
  1769. #endif
  1770.  
  1771. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  1772. #include <memory>
  1773. template <class Alloc>
  1774. void f(const Alloc&)
  1775. {
  1776. typedef typename Alloc::size_type alloc_size_type;
  1777. }
  1778. int main()
  1779. {
  1780. f(kwsys_stl::allocator<char>());
  1781. return 0;
  1782. }
  1783. #endif
  1784.  
  1785. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  1786. #include <memory>
  1787. void f(kwsys_stl::allocator::size_type const&) {}
  1788. int main() { return 0; }
  1789. #endif
  1790.  
  1791. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  1792. #include <memory>
  1793. template <class T, class Alloc>
  1794. void f(const T&, const Alloc&)
  1795. {
  1796. typedef typename Alloc::template rebind<T>::other alloc_type;
  1797. }
  1798. int main()
  1799. {
  1800. f(0, kwsys_stl::allocator<char>());
  1801. return 0;
  1802. }
  1803. #endif
  1804.  
  1805. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  1806. #include <memory>
  1807. void f(kwsys_stl::allocator<char> const& a)
  1808. {
  1809. a.max_size(sizeof(int));
  1810. }
  1811. int main()
  1812. {
  1813. f(kwsys_stl::allocator<char>());
  1814. return 0;
  1815. }
  1816. #endif
  1817.  
  1818. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  1819. #include <vector>
  1820. void f(kwsys_stl::vector<int> const& v1)
  1821. {
  1822. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  1823. }
  1824. int main()
  1825. {
  1826. f(kwsys_stl::vector<int>());
  1827. return 0;
  1828. }
  1829. #endif
  1830.  
  1831. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  1832. #include <sys/types.h>
  1833. #include <sys/stat.h>
  1834. #include <unistd.h>
  1835. int main()
  1836. {
  1837. struct stat stat1;
  1838. (void)stat1.st_mtim.tv_sec;
  1839. (void)stat1.st_mtim.tv_nsec;
  1840. return 0;
  1841. }
  1842. #endif
  1843.  
  1844. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  1845. void function(long**) {}
  1846. int main()
  1847. {
  1848. __int64** p = 0;
  1849. function(p);
  1850. return 0;
  1851. }
  1852. #endif
  1853.  
  1854. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  1855. void function(long long**) {}
  1856. int main()
  1857. {
  1858. __int64** p = 0;
  1859. function(p);
  1860. return 0;
  1861. }
  1862. #endif
  1863.  
  1864. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  1865. void function(double& l, unsigned __int64 const& r)
  1866. {
  1867. l = static_cast<double>(r);
  1868. }
  1869.  
  1870. int main()
  1871. {
  1872. double tTo = 0.0;
  1873. unsigned __int64 tFrom = 0;
  1874. function(tTo, tFrom);
  1875. return 0;
  1876. }
  1877. #endif
  1878.  
  1879. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  1880. int test_binary(int, ...)
  1881. {
  1882. return 0;
  1883. }
  1884. int main()
  1885. {
  1886. return test_binary(1, kwsys_ios::ios::binary);
  1887. }
  1888. #endif
  1889.  
  1890. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  1891. int test_istream(kwsys_ios::istream& is, long long& x)
  1892. {
  1893. return (is >> x)? 1:0;
  1894. }
  1895. int main()
  1896. {
  1897. long long x = 0;
  1898. return test_istream(kwsys_ios::cin, x);
  1899. }
  1900. #endif
  1901.  
  1902. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  1903. int test_ostream(kwsys_ios::ostream& os, long long x)
  1904. {
  1905. return (os << x)? 1:0;
  1906. }
  1907. int main()
  1908. {
  1909. long long x = 0;
  1910. return test_ostream(kwsys_ios::cout, x);
  1911. }
  1912. #endif
  1913.  
  1914. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  1915. /* Return 0 for char signed and 1 for char unsigned. */
  1916. int main()
  1917. {
  1918. unsigned char uc = 255;
  1919. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  1920. }
  1921. #endif
  1922.  
  1923. #ifdef TEST_KWSYS_LFS_WORKS
  1924. /* Return 0 when LFS is available and 1 otherwise. */
  1925. #define _LARGEFILE_SOURCE
  1926. #define _LARGEFILE64_SOURCE
  1927. #define _LARGE_FILES
  1928. #define _FILE_OFFSET_BITS 64
  1929. #include <sys/types.h>
  1930. #include <sys/stat.h>
  1931. #include <assert.h>
  1932. #if KWSYS_CXX_HAS_CSTDIO
  1933. # include <cstdio>
  1934. #endif
  1935. #include <stdio.h>
  1936.  
  1937. int main(int, char **argv)
  1938. {
  1939. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  1940. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  1941. if (OFF_T_64 % 2147483647 != 1)
  1942. return 1;
  1943.  
  1944. // stat breaks on SCO OpenServer
  1945. struct stat buf;
  1946. stat( argv[0], &buf );
  1947. if (!S_ISREG(buf.st_mode))
  1948. return 2;
  1949.  
  1950. FILE *file = fopen( argv[0], "r" );
  1951. off_t offset = ftello( file );
  1952. fseek( file, offset, SEEK_CUR );
  1953. fclose( file );
  1954. return 0;
  1955. }
  1956. #endif
  1957.  
  1958. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  1959. /* Collect fundamental type information and save it to a CMake script. */
  1960.  
  1961. /* Include limits.h to get macros indicating long long and __int64.
  1962. Note that certain compilers need special macros to define these
  1963. macros in limits.h. */
  1964. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  1965. # define _MSC_EXTENSIONS
  1966. #endif
  1967. #if defined(__GNUC__) && __GNUC__ < 3
  1968. # define _GNU_SOURCE
  1969. #endif
  1970. #include <limits.h>
  1971.  
  1972. #include <stdio.h>
  1973. #include <string.h>
  1974.  
  1975. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  1976. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  1977. and sometimes not. This macro will make sure the value is treated
  1978. as a double-quoted string. */
  1979. #define TO_STRING(x) TO_STRING0(x)
  1980. #define TO_STRING0(x) TO_STRING1(x)
  1981. #define TO_STRING1(x) #x
  1982.  
  1983. void f() {}
  1984.  
  1985. int main()
  1986. {
  1987. /* Construct the output file name. Some preprocessors will add an
  1988. extra level of double quotes, so strip them. */
  1989. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  1990. char* fname = fbuf;
  1991. if(fname[0] == '"')
  1992. {
  1993. ++fname;
  1994. int len = static_cast<int>(strlen(fname));
  1995. if(len > 0 && fname[len-1] == '"')
  1996. {
  1997. fname[len-1] = 0;
  1998. }
  1999. }
  2000.  
  2001. /* Try to open the output file. */
  2002. if(FILE* fout = fopen(fname, "w"))
  2003. {
  2004. /* Set the size of standard types. */
  2005. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  2006. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  2007. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  2008. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  2009.  
  2010. /* Set the size of some non-standard but common types. */
  2011. /* Check for a limits.h macro for long long to see if the type exists. */
  2012. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  2013. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  2014. #else
  2015. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  2016. #endif
  2017. /* Check for a limits.h macro for __int64 to see if the type exists. */
  2018. #if defined(_I64_MIN)
  2019. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  2020. #else
  2021. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  2022. #endif
  2023.  
  2024. /* Set the size of some pointer types. */
  2025. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  2026. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  2027.  
  2028. /* Set whether the native type "char" is signed or unsigned. */
  2029. unsigned char uc = 255;
  2030. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  2031. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  2032.  
  2033. fclose(fout);
  2034. return 0;
  2035. }
  2036. else
  2037. {
  2038. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  2039. fname);
  2040. return 1;
  2041. }
  2042. }
  2043. #endif
  2044. ------------------------------------------
  2045. Test succeded
  2046. Try: i686-pc-linux-gnu-g++
  2047. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  2048. ---------- file -----------------------
  2049. /*============================================================================
  2050. KWSys - Kitware System Library
  2051. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  2052.  
  2053. Distributed under the OSI-approved BSD License (the "License");
  2054. see accompanying file Copyright.txt for details.
  2055.  
  2056. This software is distributed WITHOUT ANY WARRANTY; without even the
  2057. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  2058. See the License for more information.
  2059. ============================================================================*/
  2060. // Setup for tests that use result of stl namespace test.
  2061. #if defined(KWSYS_STL_HAVE_STD)
  2062. # if KWSYS_STL_HAVE_STD
  2063. # define kwsys_stl std
  2064. # else
  2065. # define kwsys_stl
  2066. # endif
  2067. #endif
  2068.  
  2069. // Setup for tests that use iostreams.
  2070. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  2071. # if defined(_MSC_VER)
  2072. # pragma warning (push,1)
  2073. # endif
  2074. # if KWSYS_IOS_USE_ANSI
  2075. # include <iostream>
  2076. # else
  2077. # include <iostream.h>
  2078. # endif
  2079. # if defined(_MSC_VER)
  2080. # pragma warning (pop)
  2081. # endif
  2082. # if KWSYS_IOS_HAVE_STD
  2083. # define kwsys_ios std
  2084. # else
  2085. # define kwsys_ios
  2086. # endif
  2087. #endif
  2088.  
  2089. #ifdef TEST_KWSYS_STL_HAVE_STD
  2090. #include <list>
  2091. void f(std ::list<int>*) {}
  2092. int main() { return 0; }
  2093. #endif
  2094.  
  2095. #ifdef TEST_KWSYS_IOS_USE_ANSI
  2096. #include <iosfwd>
  2097. int main() { return 0; }
  2098. #endif
  2099.  
  2100. #ifdef TEST_KWSYS_LFS_SUPPORT
  2101. #define _LARGE_FILES
  2102. #include <iostream>
  2103. int main() { return 0; }
  2104. #endif
  2105.  
  2106.  
  2107. #ifdef TEST_KWSYS_IOS_HAVE_STD
  2108. #include <iosfwd>
  2109. void f(std ::ostream*) {}
  2110. int main() { return 0; }
  2111. #endif
  2112.  
  2113. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  2114. #include <sstream>
  2115. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  2116. # error "GCC 2.96 stringstream is buggy"
  2117. #endif
  2118. int main()
  2119. {
  2120. std ::ostringstream ostr;
  2121. ostr << "hello";
  2122. if(ostr.str().size() == 5)
  2123. {
  2124. return 0;
  2125. }
  2126. return -1;
  2127. }
  2128. #endif
  2129.  
  2130. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  2131. #include <strstream.h>
  2132. int main() { return 0; }
  2133. #endif
  2134.  
  2135. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  2136. #include <strstrea.h>
  2137. int main() { return 0; }
  2138. #endif
  2139.  
  2140. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  2141. # include <iostream.h>
  2142. # include <string>
  2143. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  2144. int main() { return 0; }
  2145. #endif
  2146.  
  2147. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  2148. # include <iostream.h>
  2149. # include <string>
  2150. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  2151. int main() { return 0; }
  2152. #endif
  2153.  
  2154. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  2155. # include <string>
  2156. bool f(const kwsys_stl::string& s) { return s != ""; }
  2157. int main() { return 0; }
  2158. #endif
  2159.  
  2160. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  2161. #include <cstdio>
  2162. int main() { return 0; }
  2163. #endif
  2164.  
  2165. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  2166. #include <cstddef>
  2167. void f(size_t) {}
  2168. int main() { return 0; }
  2169. #endif
  2170.  
  2171. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  2172. long long f(long long n) { return n; }
  2173. int main()
  2174. {
  2175. long long n = 0;
  2176. return static_cast<int>(f(n));
  2177. }
  2178. #endif
  2179.  
  2180. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  2181. template <class T> class A;
  2182. template <class T> int f(A<T>&);
  2183. template <class T> class A
  2184. {
  2185. public:
  2186. // "friend int f<>(A<T>&)" would conform
  2187. friend int f(A<T>&);
  2188. private:
  2189. int x;
  2190. };
  2191.  
  2192. template <class T> int f(A<T>& a) { return a.x = 0; }
  2193. template int f(A<int>&);
  2194.  
  2195. int main()
  2196. {
  2197. A<int> a;
  2198. return f(a);
  2199. }
  2200. #endif
  2201.  
  2202. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  2203. template <class U>
  2204. class A
  2205. {
  2206. public:
  2207. U u;
  2208. A(): u(0) {}
  2209. template <class V> V m(V* p) { return *p = u; }
  2210. };
  2211.  
  2212. int main()
  2213. {
  2214. A<short> a;
  2215. int s = 1;
  2216. return a.m(&s);
  2217. }
  2218. #endif
  2219.  
  2220. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  2221. template <class T> struct A {};
  2222. template <> struct A<int*>
  2223. {
  2224. static int f() { return 0; }
  2225. };
  2226. int main() { return A<int*>::f(); }
  2227. #endif
  2228.  
  2229. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  2230. namespace N
  2231. {
  2232. class A {};
  2233. int f(A*) { return 0; }
  2234. }
  2235. void f(void*);
  2236. int main()
  2237. {
  2238. N::A* a = 0;
  2239. return f(a);
  2240. }
  2241. #endif
  2242.  
  2243. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  2244. #include <iterator>
  2245. #include <list>
  2246. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  2247. int main() { return 0; }
  2248. #endif
  2249.  
  2250. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  2251. #include <iterator>
  2252. #include <list>
  2253. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  2254. int main() { return 0; }
  2255. #endif
  2256.  
  2257. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  2258. #include <iterator>
  2259. #include <list>
  2260. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  2261. int main() { return 0; }
  2262. #endif
  2263.  
  2264. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  2265. #include <memory>
  2266. template <class Alloc>
  2267. void f(const Alloc&)
  2268. {
  2269. typedef typename Alloc::size_type alloc_size_type;
  2270. }
  2271. int main()
  2272. {
  2273. f(kwsys_stl::allocator<char>());
  2274. return 0;
  2275. }
  2276. #endif
  2277.  
  2278. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  2279. #include <memory>
  2280. void f(kwsys_stl::allocator::size_type const&) {}
  2281. int main() { return 0; }
  2282. #endif
  2283.  
  2284. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  2285. #include <memory>
  2286. template <class T, class Alloc>
  2287. void f(const T&, const Alloc&)
  2288. {
  2289. typedef typename Alloc::template rebind<T>::other alloc_type;
  2290. }
  2291. int main()
  2292. {
  2293. f(0, kwsys_stl::allocator<char>());
  2294. return 0;
  2295. }
  2296. #endif
  2297.  
  2298. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  2299. #include <memory>
  2300. void f(kwsys_stl::allocator<char> const& a)
  2301. {
  2302. a.max_size(sizeof(int));
  2303. }
  2304. int main()
  2305. {
  2306. f(kwsys_stl::allocator<char>());
  2307. return 0;
  2308. }
  2309. #endif
  2310.  
  2311. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  2312. #include <vector>
  2313. void f(kwsys_stl::vector<int> const& v1)
  2314. {
  2315. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  2316. }
  2317. int main()
  2318. {
  2319. f(kwsys_stl::vector<int>());
  2320. return 0;
  2321. }
  2322. #endif
  2323.  
  2324. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  2325. #include <sys/types.h>
  2326. #include <sys/stat.h>
  2327. #include <unistd.h>
  2328. int main()
  2329. {
  2330. struct stat stat1;
  2331. (void)stat1.st_mtim.tv_sec;
  2332. (void)stat1.st_mtim.tv_nsec;
  2333. return 0;
  2334. }
  2335. #endif
  2336.  
  2337. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  2338. void function(long**) {}
  2339. int main()
  2340. {
  2341. __int64** p = 0;
  2342. function(p);
  2343. return 0;
  2344. }
  2345. #endif
  2346.  
  2347. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  2348. void function(long long**) {}
  2349. int main()
  2350. {
  2351. __int64** p = 0;
  2352. function(p);
  2353. return 0;
  2354. }
  2355. #endif
  2356.  
  2357. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  2358. void function(double& l, unsigned __int64 const& r)
  2359. {
  2360. l = static_cast<double>(r);
  2361. }
  2362.  
  2363. int main()
  2364. {
  2365. double tTo = 0.0;
  2366. unsigned __int64 tFrom = 0;
  2367. function(tTo, tFrom);
  2368. return 0;
  2369. }
  2370. #endif
  2371.  
  2372. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  2373. int test_binary(int, ...)
  2374. {
  2375. return 0;
  2376. }
  2377. int main()
  2378. {
  2379. return test_binary(1, kwsys_ios::ios::binary);
  2380. }
  2381. #endif
  2382.  
  2383. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  2384. int test_istream(kwsys_ios::istream& is, long long& x)
  2385. {
  2386. return (is >> x)? 1:0;
  2387. }
  2388. int main()
  2389. {
  2390. long long x = 0;
  2391. return test_istream(kwsys_ios::cin, x);
  2392. }
  2393. #endif
  2394.  
  2395. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  2396. int test_ostream(kwsys_ios::ostream& os, long long x)
  2397. {
  2398. return (os << x)? 1:0;
  2399. }
  2400. int main()
  2401. {
  2402. long long x = 0;
  2403. return test_ostream(kwsys_ios::cout, x);
  2404. }
  2405. #endif
  2406.  
  2407. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  2408. /* Return 0 for char signed and 1 for char unsigned. */
  2409. int main()
  2410. {
  2411. unsigned char uc = 255;
  2412. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  2413. }
  2414. #endif
  2415.  
  2416. #ifdef TEST_KWSYS_LFS_WORKS
  2417. /* Return 0 when LFS is available and 1 otherwise. */
  2418. #define _LARGEFILE_SOURCE
  2419. #define _LARGEFILE64_SOURCE
  2420. #define _LARGE_FILES
  2421. #define _FILE_OFFSET_BITS 64
  2422. #include <sys/types.h>
  2423. #include <sys/stat.h>
  2424. #include <assert.h>
  2425. #if KWSYS_CXX_HAS_CSTDIO
  2426. # include <cstdio>
  2427. #endif
  2428. #include <stdio.h>
  2429.  
  2430. int main(int, char **argv)
  2431. {
  2432. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  2433. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  2434. if (OFF_T_64 % 2147483647 != 1)
  2435. return 1;
  2436.  
  2437. // stat breaks on SCO OpenServer
  2438. struct stat buf;
  2439. stat( argv[0], &buf );
  2440. if (!S_ISREG(buf.st_mode))
  2441. return 2;
  2442.  
  2443. FILE *file = fopen( argv[0], "r" );
  2444. off_t offset = ftello( file );
  2445. fseek( file, offset, SEEK_CUR );
  2446. fclose( file );
  2447. return 0;
  2448. }
  2449. #endif
  2450.  
  2451. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  2452. /* Collect fundamental type information and save it to a CMake script. */
  2453.  
  2454. /* Include limits.h to get macros indicating long long and __int64.
  2455. Note that certain compilers need special macros to define these
  2456. macros in limits.h. */
  2457. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  2458. # define _MSC_EXTENSIONS
  2459. #endif
  2460. #if defined(__GNUC__) && __GNUC__ < 3
  2461. # define _GNU_SOURCE
  2462. #endif
  2463. #include <limits.h>
  2464.  
  2465. #include <stdio.h>
  2466. #include <string.h>
  2467.  
  2468. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  2469. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  2470. and sometimes not. This macro will make sure the value is treated
  2471. as a double-quoted string. */
  2472. #define TO_STRING(x) TO_STRING0(x)
  2473. #define TO_STRING0(x) TO_STRING1(x)
  2474. #define TO_STRING1(x) #x
  2475.  
  2476. void f() {}
  2477.  
  2478. int main()
  2479. {
  2480. /* Construct the output file name. Some preprocessors will add an
  2481. extra level of double quotes, so strip them. */
  2482. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  2483. char* fname = fbuf;
  2484. if(fname[0] == '"')
  2485. {
  2486. ++fname;
  2487. int len = static_cast<int>(strlen(fname));
  2488. if(len > 0 && fname[len-1] == '"')
  2489. {
  2490. fname[len-1] = 0;
  2491. }
  2492. }
  2493.  
  2494. /* Try to open the output file. */
  2495. if(FILE* fout = fopen(fname, "w"))
  2496. {
  2497. /* Set the size of standard types. */
  2498. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  2499. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  2500. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  2501. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  2502.  
  2503. /* Set the size of some non-standard but common types. */
  2504. /* Check for a limits.h macro for long long to see if the type exists. */
  2505. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  2506. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  2507. #else
  2508. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  2509. #endif
  2510. /* Check for a limits.h macro for __int64 to see if the type exists. */
  2511. #if defined(_I64_MIN)
  2512. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  2513. #else
  2514. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  2515. #endif
  2516.  
  2517. /* Set the size of some pointer types. */
  2518. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  2519. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  2520.  
  2521. /* Set whether the native type "char" is signed or unsigned. */
  2522. unsigned char uc = 255;
  2523. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  2524. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  2525.  
  2526. fclose(fout);
  2527. return 0;
  2528. }
  2529. else
  2530. {
  2531. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  2532. fname);
  2533. return 1;
  2534. }
  2535. }
  2536. #endif
  2537. ------------------------------------------
  2538. Test succeded
  2539. Try: i686-pc-linux-gnu-g++
  2540. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  2541. ---------- file -----------------------
  2542. /*============================================================================
  2543. KWSys - Kitware System Library
  2544. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  2545.  
  2546. Distributed under the OSI-approved BSD License (the "License");
  2547. see accompanying file Copyright.txt for details.
  2548.  
  2549. This software is distributed WITHOUT ANY WARRANTY; without even the
  2550. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  2551. See the License for more information.
  2552. ============================================================================*/
  2553. // Setup for tests that use result of stl namespace test.
  2554. #if defined(KWSYS_STL_HAVE_STD)
  2555. # if KWSYS_STL_HAVE_STD
  2556. # define kwsys_stl std
  2557. # else
  2558. # define kwsys_stl
  2559. # endif
  2560. #endif
  2561.  
  2562. // Setup for tests that use iostreams.
  2563. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  2564. # if defined(_MSC_VER)
  2565. # pragma warning (push,1)
  2566. # endif
  2567. # if KWSYS_IOS_USE_ANSI
  2568. # include <iostream>
  2569. # else
  2570. # include <iostream.h>
  2571. # endif
  2572. # if defined(_MSC_VER)
  2573. # pragma warning (pop)
  2574. # endif
  2575. # if KWSYS_IOS_HAVE_STD
  2576. # define kwsys_ios std
  2577. # else
  2578. # define kwsys_ios
  2579. # endif
  2580. #endif
  2581.  
  2582. #ifdef TEST_KWSYS_STL_HAVE_STD
  2583. #include <list>
  2584. void f(std ::list<int>*) {}
  2585. int main() { return 0; }
  2586. #endif
  2587.  
  2588. #ifdef TEST_KWSYS_IOS_USE_ANSI
  2589. #include <iosfwd>
  2590. int main() { return 0; }
  2591. #endif
  2592.  
  2593. #ifdef TEST_KWSYS_LFS_SUPPORT
  2594. #define _LARGE_FILES
  2595. #include <iostream>
  2596. int main() { return 0; }
  2597. #endif
  2598.  
  2599.  
  2600. #ifdef TEST_KWSYS_IOS_HAVE_STD
  2601. #include <iosfwd>
  2602. void f(std ::ostream*) {}
  2603. int main() { return 0; }
  2604. #endif
  2605.  
  2606. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  2607. #include <sstream>
  2608. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  2609. # error "GCC 2.96 stringstream is buggy"
  2610. #endif
  2611. int main()
  2612. {
  2613. std ::ostringstream ostr;
  2614. ostr << "hello";
  2615. if(ostr.str().size() == 5)
  2616. {
  2617. return 0;
  2618. }
  2619. return -1;
  2620. }
  2621. #endif
  2622.  
  2623. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  2624. #include <strstream.h>
  2625. int main() { return 0; }
  2626. #endif
  2627.  
  2628. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  2629. #include <strstrea.h>
  2630. int main() { return 0; }
  2631. #endif
  2632.  
  2633. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  2634. # include <iostream.h>
  2635. # include <string>
  2636. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  2637. int main() { return 0; }
  2638. #endif
  2639.  
  2640. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  2641. # include <iostream.h>
  2642. # include <string>
  2643. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  2644. int main() { return 0; }
  2645. #endif
  2646.  
  2647. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  2648. # include <string>
  2649. bool f(const kwsys_stl::string& s) { return s != ""; }
  2650. int main() { return 0; }
  2651. #endif
  2652.  
  2653. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  2654. #include <cstdio>
  2655. int main() { return 0; }
  2656. #endif
  2657.  
  2658. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  2659. #include <cstddef>
  2660. void f(size_t) {}
  2661. int main() { return 0; }
  2662. #endif
  2663.  
  2664. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  2665. long long f(long long n) { return n; }
  2666. int main()
  2667. {
  2668. long long n = 0;
  2669. return static_cast<int>(f(n));
  2670. }
  2671. #endif
  2672.  
  2673. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  2674. template <class T> class A;
  2675. template <class T> int f(A<T>&);
  2676. template <class T> class A
  2677. {
  2678. public:
  2679. // "friend int f<>(A<T>&)" would conform
  2680. friend int f(A<T>&);
  2681. private:
  2682. int x;
  2683. };
  2684.  
  2685. template <class T> int f(A<T>& a) { return a.x = 0; }
  2686. template int f(A<int>&);
  2687.  
  2688. int main()
  2689. {
  2690. A<int> a;
  2691. return f(a);
  2692. }
  2693. #endif
  2694.  
  2695. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  2696. template <class U>
  2697. class A
  2698. {
  2699. public:
  2700. U u;
  2701. A(): u(0) {}
  2702. template <class V> V m(V* p) { return *p = u; }
  2703. };
  2704.  
  2705. int main()
  2706. {
  2707. A<short> a;
  2708. int s = 1;
  2709. return a.m(&s);
  2710. }
  2711. #endif
  2712.  
  2713. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  2714. template <class T> struct A {};
  2715. template <> struct A<int*>
  2716. {
  2717. static int f() { return 0; }
  2718. };
  2719. int main() { return A<int*>::f(); }
  2720. #endif
  2721.  
  2722. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  2723. namespace N
  2724. {
  2725. class A {};
  2726. int f(A*) { return 0; }
  2727. }
  2728. void f(void*);
  2729. int main()
  2730. {
  2731. N::A* a = 0;
  2732. return f(a);
  2733. }
  2734. #endif
  2735.  
  2736. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  2737. #include <iterator>
  2738. #include <list>
  2739. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  2740. int main() { return 0; }
  2741. #endif
  2742.  
  2743. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  2744. #include <iterator>
  2745. #include <list>
  2746. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  2747. int main() { return 0; }
  2748. #endif
  2749.  
  2750. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  2751. #include <iterator>
  2752. #include <list>
  2753. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  2754. int main() { return 0; }
  2755. #endif
  2756.  
  2757. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  2758. #include <memory>
  2759. template <class Alloc>
  2760. void f(const Alloc&)
  2761. {
  2762. typedef typename Alloc::size_type alloc_size_type;
  2763. }
  2764. int main()
  2765. {
  2766. f(kwsys_stl::allocator<char>());
  2767. return 0;
  2768. }
  2769. #endif
  2770.  
  2771. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  2772. #include <memory>
  2773. void f(kwsys_stl::allocator::size_type const&) {}
  2774. int main() { return 0; }
  2775. #endif
  2776.  
  2777. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  2778. #include <memory>
  2779. template <class T, class Alloc>
  2780. void f(const T&, const Alloc&)
  2781. {
  2782. typedef typename Alloc::template rebind<T>::other alloc_type;
  2783. }
  2784. int main()
  2785. {
  2786. f(0, kwsys_stl::allocator<char>());
  2787. return 0;
  2788. }
  2789. #endif
  2790.  
  2791. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  2792. #include <memory>
  2793. void f(kwsys_stl::allocator<char> const& a)
  2794. {
  2795. a.max_size(sizeof(int));
  2796. }
  2797. int main()
  2798. {
  2799. f(kwsys_stl::allocator<char>());
  2800. return 0;
  2801. }
  2802. #endif
  2803.  
  2804. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  2805. #include <vector>
  2806. void f(kwsys_stl::vector<int> const& v1)
  2807. {
  2808. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  2809. }
  2810. int main()
  2811. {
  2812. f(kwsys_stl::vector<int>());
  2813. return 0;
  2814. }
  2815. #endif
  2816.  
  2817. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  2818. #include <sys/types.h>
  2819. #include <sys/stat.h>
  2820. #include <unistd.h>
  2821. int main()
  2822. {
  2823. struct stat stat1;
  2824. (void)stat1.st_mtim.tv_sec;
  2825. (void)stat1.st_mtim.tv_nsec;
  2826. return 0;
  2827. }
  2828. #endif
  2829.  
  2830. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  2831. void function(long**) {}
  2832. int main()
  2833. {
  2834. __int64** p = 0;
  2835. function(p);
  2836. return 0;
  2837. }
  2838. #endif
  2839.  
  2840. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  2841. void function(long long**) {}
  2842. int main()
  2843. {
  2844. __int64** p = 0;
  2845. function(p);
  2846. return 0;
  2847. }
  2848. #endif
  2849.  
  2850. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  2851. void function(double& l, unsigned __int64 const& r)
  2852. {
  2853. l = static_cast<double>(r);
  2854. }
  2855.  
  2856. int main()
  2857. {
  2858. double tTo = 0.0;
  2859. unsigned __int64 tFrom = 0;
  2860. function(tTo, tFrom);
  2861. return 0;
  2862. }
  2863. #endif
  2864.  
  2865. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  2866. int test_binary(int, ...)
  2867. {
  2868. return 0;
  2869. }
  2870. int main()
  2871. {
  2872. return test_binary(1, kwsys_ios::ios::binary);
  2873. }
  2874. #endif
  2875.  
  2876. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  2877. int test_istream(kwsys_ios::istream& is, long long& x)
  2878. {
  2879. return (is >> x)? 1:0;
  2880. }
  2881. int main()
  2882. {
  2883. long long x = 0;
  2884. return test_istream(kwsys_ios::cin, x);
  2885. }
  2886. #endif
  2887.  
  2888. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  2889. int test_ostream(kwsys_ios::ostream& os, long long x)
  2890. {
  2891. return (os << x)? 1:0;
  2892. }
  2893. int main()
  2894. {
  2895. long long x = 0;
  2896. return test_ostream(kwsys_ios::cout, x);
  2897. }
  2898. #endif
  2899.  
  2900. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  2901. /* Return 0 for char signed and 1 for char unsigned. */
  2902. int main()
  2903. {
  2904. unsigned char uc = 255;
  2905. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  2906. }
  2907. #endif
  2908.  
  2909. #ifdef TEST_KWSYS_LFS_WORKS
  2910. /* Return 0 when LFS is available and 1 otherwise. */
  2911. #define _LARGEFILE_SOURCE
  2912. #define _LARGEFILE64_SOURCE
  2913. #define _LARGE_FILES
  2914. #define _FILE_OFFSET_BITS 64
  2915. #include <sys/types.h>
  2916. #include <sys/stat.h>
  2917. #include <assert.h>
  2918. #if KWSYS_CXX_HAS_CSTDIO
  2919. # include <cstdio>
  2920. #endif
  2921. #include <stdio.h>
  2922.  
  2923. int main(int, char **argv)
  2924. {
  2925. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  2926. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  2927. if (OFF_T_64 % 2147483647 != 1)
  2928. return 1;
  2929.  
  2930. // stat breaks on SCO OpenServer
  2931. struct stat buf;
  2932. stat( argv[0], &buf );
  2933. if (!S_ISREG(buf.st_mode))
  2934. return 2;
  2935.  
  2936. FILE *file = fopen( argv[0], "r" );
  2937. off_t offset = ftello( file );
  2938. fseek( file, offset, SEEK_CUR );
  2939. fclose( file );
  2940. return 0;
  2941. }
  2942. #endif
  2943.  
  2944. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  2945. /* Collect fundamental type information and save it to a CMake script. */
  2946.  
  2947. /* Include limits.h to get macros indicating long long and __int64.
  2948. Note that certain compilers need special macros to define these
  2949. macros in limits.h. */
  2950. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  2951. # define _MSC_EXTENSIONS
  2952. #endif
  2953. #if defined(__GNUC__) && __GNUC__ < 3
  2954. # define _GNU_SOURCE
  2955. #endif
  2956. #include <limits.h>
  2957.  
  2958. #include <stdio.h>
  2959. #include <string.h>
  2960.  
  2961. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  2962. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  2963. and sometimes not. This macro will make sure the value is treated
  2964. as a double-quoted string. */
  2965. #define TO_STRING(x) TO_STRING0(x)
  2966. #define TO_STRING0(x) TO_STRING1(x)
  2967. #define TO_STRING1(x) #x
  2968.  
  2969. void f() {}
  2970.  
  2971. int main()
  2972. {
  2973. /* Construct the output file name. Some preprocessors will add an
  2974. extra level of double quotes, so strip them. */
  2975. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  2976. char* fname = fbuf;
  2977. if(fname[0] == '"')
  2978. {
  2979. ++fname;
  2980. int len = static_cast<int>(strlen(fname));
  2981. if(len > 0 && fname[len-1] == '"')
  2982. {
  2983. fname[len-1] = 0;
  2984. }
  2985. }
  2986.  
  2987. /* Try to open the output file. */
  2988. if(FILE* fout = fopen(fname, "w"))
  2989. {
  2990. /* Set the size of standard types. */
  2991. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  2992. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  2993. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  2994. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  2995.  
  2996. /* Set the size of some non-standard but common types. */
  2997. /* Check for a limits.h macro for long long to see if the type exists. */
  2998. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  2999. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  3000. #else
  3001. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  3002. #endif
  3003. /* Check for a limits.h macro for __int64 to see if the type exists. */
  3004. #if defined(_I64_MIN)
  3005. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  3006. #else
  3007. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  3008. #endif
  3009.  
  3010. /* Set the size of some pointer types. */
  3011. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  3012. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  3013.  
  3014. /* Set whether the native type "char" is signed or unsigned. */
  3015. unsigned char uc = 255;
  3016. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  3017. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  3018.  
  3019. fclose(fout);
  3020. return 0;
  3021. }
  3022. else
  3023. {
  3024. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  3025. fname);
  3026. return 1;
  3027. }
  3028. }
  3029. #endif
  3030. ------------------------------------------
  3031. Test succeded
  3032. Try: i686-pc-linux-gnu-g++
  3033. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_LFS_SUPPORT /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  3034. ---------- file -----------------------
  3035. /*============================================================================
  3036. KWSys - Kitware System Library
  3037. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  3038.  
  3039. Distributed under the OSI-approved BSD License (the "License");
  3040. see accompanying file Copyright.txt for details.
  3041.  
  3042. This software is distributed WITHOUT ANY WARRANTY; without even the
  3043. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  3044. See the License for more information.
  3045. ============================================================================*/
  3046. // Setup for tests that use result of stl namespace test.
  3047. #if defined(KWSYS_STL_HAVE_STD)
  3048. # if KWSYS_STL_HAVE_STD
  3049. # define kwsys_stl std
  3050. # else
  3051. # define kwsys_stl
  3052. # endif
  3053. #endif
  3054.  
  3055. // Setup for tests that use iostreams.
  3056. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  3057. # if defined(_MSC_VER)
  3058. # pragma warning (push,1)
  3059. # endif
  3060. # if KWSYS_IOS_USE_ANSI
  3061. # include <iostream>
  3062. # else
  3063. # include <iostream.h>
  3064. # endif
  3065. # if defined(_MSC_VER)
  3066. # pragma warning (pop)
  3067. # endif
  3068. # if KWSYS_IOS_HAVE_STD
  3069. # define kwsys_ios std
  3070. # else
  3071. # define kwsys_ios
  3072. # endif
  3073. #endif
  3074.  
  3075. #ifdef TEST_KWSYS_STL_HAVE_STD
  3076. #include <list>
  3077. void f(std ::list<int>*) {}
  3078. int main() { return 0; }
  3079. #endif
  3080.  
  3081. #ifdef TEST_KWSYS_IOS_USE_ANSI
  3082. #include <iosfwd>
  3083. int main() { return 0; }
  3084. #endif
  3085.  
  3086. #ifdef TEST_KWSYS_LFS_SUPPORT
  3087. #define _LARGE_FILES
  3088. #include <iostream>
  3089. int main() { return 0; }
  3090. #endif
  3091.  
  3092.  
  3093. #ifdef TEST_KWSYS_IOS_HAVE_STD
  3094. #include <iosfwd>
  3095. void f(std ::ostream*) {}
  3096. int main() { return 0; }
  3097. #endif
  3098.  
  3099. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  3100. #include <sstream>
  3101. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  3102. # error "GCC 2.96 stringstream is buggy"
  3103. #endif
  3104. int main()
  3105. {
  3106. std ::ostringstream ostr;
  3107. ostr << "hello";
  3108. if(ostr.str().size() == 5)
  3109. {
  3110. return 0;
  3111. }
  3112. return -1;
  3113. }
  3114. #endif
  3115.  
  3116. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  3117. #include <strstream.h>
  3118. int main() { return 0; }
  3119. #endif
  3120.  
  3121. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  3122. #include <strstrea.h>
  3123. int main() { return 0; }
  3124. #endif
  3125.  
  3126. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  3127. # include <iostream.h>
  3128. # include <string>
  3129. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  3130. int main() { return 0; }
  3131. #endif
  3132.  
  3133. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  3134. # include <iostream.h>
  3135. # include <string>
  3136. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  3137. int main() { return 0; }
  3138. #endif
  3139.  
  3140. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  3141. # include <string>
  3142. bool f(const kwsys_stl::string& s) { return s != ""; }
  3143. int main() { return 0; }
  3144. #endif
  3145.  
  3146. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  3147. #include <cstdio>
  3148. int main() { return 0; }
  3149. #endif
  3150.  
  3151. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  3152. #include <cstddef>
  3153. void f(size_t) {}
  3154. int main() { return 0; }
  3155. #endif
  3156.  
  3157. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  3158. long long f(long long n) { return n; }
  3159. int main()
  3160. {
  3161. long long n = 0;
  3162. return static_cast<int>(f(n));
  3163. }
  3164. #endif
  3165.  
  3166. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  3167. template <class T> class A;
  3168. template <class T> int f(A<T>&);
  3169. template <class T> class A
  3170. {
  3171. public:
  3172. // "friend int f<>(A<T>&)" would conform
  3173. friend int f(A<T>&);
  3174. private:
  3175. int x;
  3176. };
  3177.  
  3178. template <class T> int f(A<T>& a) { return a.x = 0; }
  3179. template int f(A<int>&);
  3180.  
  3181. int main()
  3182. {
  3183. A<int> a;
  3184. return f(a);
  3185. }
  3186. #endif
  3187.  
  3188. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  3189. template <class U>
  3190. class A
  3191. {
  3192. public:
  3193. U u;
  3194. A(): u(0) {}
  3195. template <class V> V m(V* p) { return *p = u; }
  3196. };
  3197.  
  3198. int main()
  3199. {
  3200. A<short> a;
  3201. int s = 1;
  3202. return a.m(&s);
  3203. }
  3204. #endif
  3205.  
  3206. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  3207. template <class T> struct A {};
  3208. template <> struct A<int*>
  3209. {
  3210. static int f() { return 0; }
  3211. };
  3212. int main() { return A<int*>::f(); }
  3213. #endif
  3214.  
  3215. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  3216. namespace N
  3217. {
  3218. class A {};
  3219. int f(A*) { return 0; }
  3220. }
  3221. void f(void*);
  3222. int main()
  3223. {
  3224. N::A* a = 0;
  3225. return f(a);
  3226. }
  3227. #endif
  3228.  
  3229. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  3230. #include <iterator>
  3231. #include <list>
  3232. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  3233. int main() { return 0; }
  3234. #endif
  3235.  
  3236. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  3237. #include <iterator>
  3238. #include <list>
  3239. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  3240. int main() { return 0; }
  3241. #endif
  3242.  
  3243. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  3244. #include <iterator>
  3245. #include <list>
  3246. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  3247. int main() { return 0; }
  3248. #endif
  3249.  
  3250. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  3251. #include <memory>
  3252. template <class Alloc>
  3253. void f(const Alloc&)
  3254. {
  3255. typedef typename Alloc::size_type alloc_size_type;
  3256. }
  3257. int main()
  3258. {
  3259. f(kwsys_stl::allocator<char>());
  3260. return 0;
  3261. }
  3262. #endif
  3263.  
  3264. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  3265. #include <memory>
  3266. void f(kwsys_stl::allocator::size_type const&) {}
  3267. int main() { return 0; }
  3268. #endif
  3269.  
  3270. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  3271. #include <memory>
  3272. template <class T, class Alloc>
  3273. void f(const T&, const Alloc&)
  3274. {
  3275. typedef typename Alloc::template rebind<T>::other alloc_type;
  3276. }
  3277. int main()
  3278. {
  3279. f(0, kwsys_stl::allocator<char>());
  3280. return 0;
  3281. }
  3282. #endif
  3283.  
  3284. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  3285. #include <memory>
  3286. void f(kwsys_stl::allocator<char> const& a)
  3287. {
  3288. a.max_size(sizeof(int));
  3289. }
  3290. int main()
  3291. {
  3292. f(kwsys_stl::allocator<char>());
  3293. return 0;
  3294. }
  3295. #endif
  3296.  
  3297. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  3298. #include <vector>
  3299. void f(kwsys_stl::vector<int> const& v1)
  3300. {
  3301. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  3302. }
  3303. int main()
  3304. {
  3305. f(kwsys_stl::vector<int>());
  3306. return 0;
  3307. }
  3308. #endif
  3309.  
  3310. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  3311. #include <sys/types.h>
  3312. #include <sys/stat.h>
  3313. #include <unistd.h>
  3314. int main()
  3315. {
  3316. struct stat stat1;
  3317. (void)stat1.st_mtim.tv_sec;
  3318. (void)stat1.st_mtim.tv_nsec;
  3319. return 0;
  3320. }
  3321. #endif
  3322.  
  3323. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  3324. void function(long**) {}
  3325. int main()
  3326. {
  3327. __int64** p = 0;
  3328. function(p);
  3329. return 0;
  3330. }
  3331. #endif
  3332.  
  3333. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  3334. void function(long long**) {}
  3335. int main()
  3336. {
  3337. __int64** p = 0;
  3338. function(p);
  3339. return 0;
  3340. }
  3341. #endif
  3342.  
  3343. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  3344. void function(double& l, unsigned __int64 const& r)
  3345. {
  3346. l = static_cast<double>(r);
  3347. }
  3348.  
  3349. int main()
  3350. {
  3351. double tTo = 0.0;
  3352. unsigned __int64 tFrom = 0;
  3353. function(tTo, tFrom);
  3354. return 0;
  3355. }
  3356. #endif
  3357.  
  3358. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  3359. int test_binary(int, ...)
  3360. {
  3361. return 0;
  3362. }
  3363. int main()
  3364. {
  3365. return test_binary(1, kwsys_ios::ios::binary);
  3366. }
  3367. #endif
  3368.  
  3369. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  3370. int test_istream(kwsys_ios::istream& is, long long& x)
  3371. {
  3372. return (is >> x)? 1:0;
  3373. }
  3374. int main()
  3375. {
  3376. long long x = 0;
  3377. return test_istream(kwsys_ios::cin, x);
  3378. }
  3379. #endif
  3380.  
  3381. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  3382. int test_ostream(kwsys_ios::ostream& os, long long x)
  3383. {
  3384. return (os << x)? 1:0;
  3385. }
  3386. int main()
  3387. {
  3388. long long x = 0;
  3389. return test_ostream(kwsys_ios::cout, x);
  3390. }
  3391. #endif
  3392.  
  3393. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  3394. /* Return 0 for char signed and 1 for char unsigned. */
  3395. int main()
  3396. {
  3397. unsigned char uc = 255;
  3398. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  3399. }
  3400. #endif
  3401.  
  3402. #ifdef TEST_KWSYS_LFS_WORKS
  3403. /* Return 0 when LFS is available and 1 otherwise. */
  3404. #define _LARGEFILE_SOURCE
  3405. #define _LARGEFILE64_SOURCE
  3406. #define _LARGE_FILES
  3407. #define _FILE_OFFSET_BITS 64
  3408. #include <sys/types.h>
  3409. #include <sys/stat.h>
  3410. #include <assert.h>
  3411. #if KWSYS_CXX_HAS_CSTDIO
  3412. # include <cstdio>
  3413. #endif
  3414. #include <stdio.h>
  3415.  
  3416. int main(int, char **argv)
  3417. {
  3418. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  3419. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  3420. if (OFF_T_64 % 2147483647 != 1)
  3421. return 1;
  3422.  
  3423. // stat breaks on SCO OpenServer
  3424. struct stat buf;
  3425. stat( argv[0], &buf );
  3426. if (!S_ISREG(buf.st_mode))
  3427. return 2;
  3428.  
  3429. FILE *file = fopen( argv[0], "r" );
  3430. off_t offset = ftello( file );
  3431. fseek( file, offset, SEEK_CUR );
  3432. fclose( file );
  3433. return 0;
  3434. }
  3435. #endif
  3436.  
  3437. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  3438. /* Collect fundamental type information and save it to a CMake script. */
  3439.  
  3440. /* Include limits.h to get macros indicating long long and __int64.
  3441. Note that certain compilers need special macros to define these
  3442. macros in limits.h. */
  3443. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  3444. # define _MSC_EXTENSIONS
  3445. #endif
  3446. #if defined(__GNUC__) && __GNUC__ < 3
  3447. # define _GNU_SOURCE
  3448. #endif
  3449. #include <limits.h>
  3450.  
  3451. #include <stdio.h>
  3452. #include <string.h>
  3453.  
  3454. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  3455. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  3456. and sometimes not. This macro will make sure the value is treated
  3457. as a double-quoted string. */
  3458. #define TO_STRING(x) TO_STRING0(x)
  3459. #define TO_STRING0(x) TO_STRING1(x)
  3460. #define TO_STRING1(x) #x
  3461.  
  3462. void f() {}
  3463.  
  3464. int main()
  3465. {
  3466. /* Construct the output file name. Some preprocessors will add an
  3467. extra level of double quotes, so strip them. */
  3468. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  3469. char* fname = fbuf;
  3470. if(fname[0] == '"')
  3471. {
  3472. ++fname;
  3473. int len = static_cast<int>(strlen(fname));
  3474. if(len > 0 && fname[len-1] == '"')
  3475. {
  3476. fname[len-1] = 0;
  3477. }
  3478. }
  3479.  
  3480. /* Try to open the output file. */
  3481. if(FILE* fout = fopen(fname, "w"))
  3482. {
  3483. /* Set the size of standard types. */
  3484. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  3485. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  3486. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  3487. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  3488.  
  3489. /* Set the size of some non-standard but common types. */
  3490. /* Check for a limits.h macro for long long to see if the type exists. */
  3491. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  3492. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  3493. #else
  3494. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  3495. #endif
  3496. /* Check for a limits.h macro for __int64 to see if the type exists. */
  3497. #if defined(_I64_MIN)
  3498. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  3499. #else
  3500. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  3501. #endif
  3502.  
  3503. /* Set the size of some pointer types. */
  3504. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  3505. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  3506.  
  3507. /* Set whether the native type "char" is signed or unsigned. */
  3508. unsigned char uc = 255;
  3509. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  3510. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  3511.  
  3512. fclose(fout);
  3513. return 0;
  3514. }
  3515. else
  3516. {
  3517. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  3518. fname);
  3519. return 1;
  3520. }
  3521. }
  3522. #endif
  3523. ------------------------------------------
  3524. Test succeded
  3525. Try: i686-pc-linux-gnu-g++
  3526. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  3527. ---------- file -----------------------
  3528. /*============================================================================
  3529. KWSys - Kitware System Library
  3530. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  3531.  
  3532. Distributed under the OSI-approved BSD License (the "License");
  3533. see accompanying file Copyright.txt for details.
  3534.  
  3535. This software is distributed WITHOUT ANY WARRANTY; without even the
  3536. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  3537. See the License for more information.
  3538. ============================================================================*/
  3539. // Setup for tests that use result of stl namespace test.
  3540. #if defined(KWSYS_STL_HAVE_STD)
  3541. # if KWSYS_STL_HAVE_STD
  3542. # define kwsys_stl std
  3543. # else
  3544. # define kwsys_stl
  3545. # endif
  3546. #endif
  3547.  
  3548. // Setup for tests that use iostreams.
  3549. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  3550. # if defined(_MSC_VER)
  3551. # pragma warning (push,1)
  3552. # endif
  3553. # if KWSYS_IOS_USE_ANSI
  3554. # include <iostream>
  3555. # else
  3556. # include <iostream.h>
  3557. # endif
  3558. # if defined(_MSC_VER)
  3559. # pragma warning (pop)
  3560. # endif
  3561. # if KWSYS_IOS_HAVE_STD
  3562. # define kwsys_ios std
  3563. # else
  3564. # define kwsys_ios
  3565. # endif
  3566. #endif
  3567.  
  3568. #ifdef TEST_KWSYS_STL_HAVE_STD
  3569. #include <list>
  3570. void f(std ::list<int>*) {}
  3571. int main() { return 0; }
  3572. #endif
  3573.  
  3574. #ifdef TEST_KWSYS_IOS_USE_ANSI
  3575. #include <iosfwd>
  3576. int main() { return 0; }
  3577. #endif
  3578.  
  3579. #ifdef TEST_KWSYS_LFS_SUPPORT
  3580. #define _LARGE_FILES
  3581. #include <iostream>
  3582. int main() { return 0; }
  3583. #endif
  3584.  
  3585.  
  3586. #ifdef TEST_KWSYS_IOS_HAVE_STD
  3587. #include <iosfwd>
  3588. void f(std ::ostream*) {}
  3589. int main() { return 0; }
  3590. #endif
  3591.  
  3592. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  3593. #include <sstream>
  3594. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  3595. # error "GCC 2.96 stringstream is buggy"
  3596. #endif
  3597. int main()
  3598. {
  3599. std ::ostringstream ostr;
  3600. ostr << "hello";
  3601. if(ostr.str().size() == 5)
  3602. {
  3603. return 0;
  3604. }
  3605. return -1;
  3606. }
  3607. #endif
  3608.  
  3609. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  3610. #include <strstream.h>
  3611. int main() { return 0; }
  3612. #endif
  3613.  
  3614. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  3615. #include <strstrea.h>
  3616. int main() { return 0; }
  3617. #endif
  3618.  
  3619. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  3620. # include <iostream.h>
  3621. # include <string>
  3622. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  3623. int main() { return 0; }
  3624. #endif
  3625.  
  3626. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  3627. # include <iostream.h>
  3628. # include <string>
  3629. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  3630. int main() { return 0; }
  3631. #endif
  3632.  
  3633. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  3634. # include <string>
  3635. bool f(const kwsys_stl::string& s) { return s != ""; }
  3636. int main() { return 0; }
  3637. #endif
  3638.  
  3639. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  3640. #include <cstdio>
  3641. int main() { return 0; }
  3642. #endif
  3643.  
  3644. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  3645. #include <cstddef>
  3646. void f(size_t) {}
  3647. int main() { return 0; }
  3648. #endif
  3649.  
  3650. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  3651. long long f(long long n) { return n; }
  3652. int main()
  3653. {
  3654. long long n = 0;
  3655. return static_cast<int>(f(n));
  3656. }
  3657. #endif
  3658.  
  3659. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  3660. template <class T> class A;
  3661. template <class T> int f(A<T>&);
  3662. template <class T> class A
  3663. {
  3664. public:
  3665. // "friend int f<>(A<T>&)" would conform
  3666. friend int f(A<T>&);
  3667. private:
  3668. int x;
  3669. };
  3670.  
  3671. template <class T> int f(A<T>& a) { return a.x = 0; }
  3672. template int f(A<int>&);
  3673.  
  3674. int main()
  3675. {
  3676. A<int> a;
  3677. return f(a);
  3678. }
  3679. #endif
  3680.  
  3681. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  3682. template <class U>
  3683. class A
  3684. {
  3685. public:
  3686. U u;
  3687. A(): u(0) {}
  3688. template <class V> V m(V* p) { return *p = u; }
  3689. };
  3690.  
  3691. int main()
  3692. {
  3693. A<short> a;
  3694. int s = 1;
  3695. return a.m(&s);
  3696. }
  3697. #endif
  3698.  
  3699. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  3700. template <class T> struct A {};
  3701. template <> struct A<int*>
  3702. {
  3703. static int f() { return 0; }
  3704. };
  3705. int main() { return A<int*>::f(); }
  3706. #endif
  3707.  
  3708. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  3709. namespace N
  3710. {
  3711. class A {};
  3712. int f(A*) { return 0; }
  3713. }
  3714. void f(void*);
  3715. int main()
  3716. {
  3717. N::A* a = 0;
  3718. return f(a);
  3719. }
  3720. #endif
  3721.  
  3722. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  3723. #include <iterator>
  3724. #include <list>
  3725. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  3726. int main() { return 0; }
  3727. #endif
  3728.  
  3729. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  3730. #include <iterator>
  3731. #include <list>
  3732. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  3733. int main() { return 0; }
  3734. #endif
  3735.  
  3736. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  3737. #include <iterator>
  3738. #include <list>
  3739. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  3740. int main() { return 0; }
  3741. #endif
  3742.  
  3743. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  3744. #include <memory>
  3745. template <class Alloc>
  3746. void f(const Alloc&)
  3747. {
  3748. typedef typename Alloc::size_type alloc_size_type;
  3749. }
  3750. int main()
  3751. {
  3752. f(kwsys_stl::allocator<char>());
  3753. return 0;
  3754. }
  3755. #endif
  3756.  
  3757. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  3758. #include <memory>
  3759. void f(kwsys_stl::allocator::size_type const&) {}
  3760. int main() { return 0; }
  3761. #endif
  3762.  
  3763. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  3764. #include <memory>
  3765. template <class T, class Alloc>
  3766. void f(const T&, const Alloc&)
  3767. {
  3768. typedef typename Alloc::template rebind<T>::other alloc_type;
  3769. }
  3770. int main()
  3771. {
  3772. f(0, kwsys_stl::allocator<char>());
  3773. return 0;
  3774. }
  3775. #endif
  3776.  
  3777. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  3778. #include <memory>
  3779. void f(kwsys_stl::allocator<char> const& a)
  3780. {
  3781. a.max_size(sizeof(int));
  3782. }
  3783. int main()
  3784. {
  3785. f(kwsys_stl::allocator<char>());
  3786. return 0;
  3787. }
  3788. #endif
  3789.  
  3790. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  3791. #include <vector>
  3792. void f(kwsys_stl::vector<int> const& v1)
  3793. {
  3794. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  3795. }
  3796. int main()
  3797. {
  3798. f(kwsys_stl::vector<int>());
  3799. return 0;
  3800. }
  3801. #endif
  3802.  
  3803. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  3804. #include <sys/types.h>
  3805. #include <sys/stat.h>
  3806. #include <unistd.h>
  3807. int main()
  3808. {
  3809. struct stat stat1;
  3810. (void)stat1.st_mtim.tv_sec;
  3811. (void)stat1.st_mtim.tv_nsec;
  3812. return 0;
  3813. }
  3814. #endif
  3815.  
  3816. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  3817. void function(long**) {}
  3818. int main()
  3819. {
  3820. __int64** p = 0;
  3821. function(p);
  3822. return 0;
  3823. }
  3824. #endif
  3825.  
  3826. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  3827. void function(long long**) {}
  3828. int main()
  3829. {
  3830. __int64** p = 0;
  3831. function(p);
  3832. return 0;
  3833. }
  3834. #endif
  3835.  
  3836. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  3837. void function(double& l, unsigned __int64 const& r)
  3838. {
  3839. l = static_cast<double>(r);
  3840. }
  3841.  
  3842. int main()
  3843. {
  3844. double tTo = 0.0;
  3845. unsigned __int64 tFrom = 0;
  3846. function(tTo, tFrom);
  3847. return 0;
  3848. }
  3849. #endif
  3850.  
  3851. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  3852. int test_binary(int, ...)
  3853. {
  3854. return 0;
  3855. }
  3856. int main()
  3857. {
  3858. return test_binary(1, kwsys_ios::ios::binary);
  3859. }
  3860. #endif
  3861.  
  3862. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  3863. int test_istream(kwsys_ios::istream& is, long long& x)
  3864. {
  3865. return (is >> x)? 1:0;
  3866. }
  3867. int main()
  3868. {
  3869. long long x = 0;
  3870. return test_istream(kwsys_ios::cin, x);
  3871. }
  3872. #endif
  3873.  
  3874. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  3875. int test_ostream(kwsys_ios::ostream& os, long long x)
  3876. {
  3877. return (os << x)? 1:0;
  3878. }
  3879. int main()
  3880. {
  3881. long long x = 0;
  3882. return test_ostream(kwsys_ios::cout, x);
  3883. }
  3884. #endif
  3885.  
  3886. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  3887. /* Return 0 for char signed and 1 for char unsigned. */
  3888. int main()
  3889. {
  3890. unsigned char uc = 255;
  3891. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  3892. }
  3893. #endif
  3894.  
  3895. #ifdef TEST_KWSYS_LFS_WORKS
  3896. /* Return 0 when LFS is available and 1 otherwise. */
  3897. #define _LARGEFILE_SOURCE
  3898. #define _LARGEFILE64_SOURCE
  3899. #define _LARGE_FILES
  3900. #define _FILE_OFFSET_BITS 64
  3901. #include <sys/types.h>
  3902. #include <sys/stat.h>
  3903. #include <assert.h>
  3904. #if KWSYS_CXX_HAS_CSTDIO
  3905. # include <cstdio>
  3906. #endif
  3907. #include <stdio.h>
  3908.  
  3909. int main(int, char **argv)
  3910. {
  3911. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  3912. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  3913. if (OFF_T_64 % 2147483647 != 1)
  3914. return 1;
  3915.  
  3916. // stat breaks on SCO OpenServer
  3917. struct stat buf;
  3918. stat( argv[0], &buf );
  3919. if (!S_ISREG(buf.st_mode))
  3920. return 2;
  3921.  
  3922. FILE *file = fopen( argv[0], "r" );
  3923. off_t offset = ftello( file );
  3924. fseek( file, offset, SEEK_CUR );
  3925. fclose( file );
  3926. return 0;
  3927. }
  3928. #endif
  3929.  
  3930. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  3931. /* Collect fundamental type information and save it to a CMake script. */
  3932.  
  3933. /* Include limits.h to get macros indicating long long and __int64.
  3934. Note that certain compilers need special macros to define these
  3935. macros in limits.h. */
  3936. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  3937. # define _MSC_EXTENSIONS
  3938. #endif
  3939. #if defined(__GNUC__) && __GNUC__ < 3
  3940. # define _GNU_SOURCE
  3941. #endif
  3942. #include <limits.h>
  3943.  
  3944. #include <stdio.h>
  3945. #include <string.h>
  3946.  
  3947. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  3948. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  3949. and sometimes not. This macro will make sure the value is treated
  3950. as a double-quoted string. */
  3951. #define TO_STRING(x) TO_STRING0(x)
  3952. #define TO_STRING0(x) TO_STRING1(x)
  3953. #define TO_STRING1(x) #x
  3954.  
  3955. void f() {}
  3956.  
  3957. int main()
  3958. {
  3959. /* Construct the output file name. Some preprocessors will add an
  3960. extra level of double quotes, so strip them. */
  3961. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  3962. char* fname = fbuf;
  3963. if(fname[0] == '"')
  3964. {
  3965. ++fname;
  3966. int len = static_cast<int>(strlen(fname));
  3967. if(len > 0 && fname[len-1] == '"')
  3968. {
  3969. fname[len-1] = 0;
  3970. }
  3971. }
  3972.  
  3973. /* Try to open the output file. */
  3974. if(FILE* fout = fopen(fname, "w"))
  3975. {
  3976. /* Set the size of standard types. */
  3977. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  3978. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  3979. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  3980. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  3981.  
  3982. /* Set the size of some non-standard but common types. */
  3983. /* Check for a limits.h macro for long long to see if the type exists. */
  3984. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  3985. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  3986. #else
  3987. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  3988. #endif
  3989. /* Check for a limits.h macro for __int64 to see if the type exists. */
  3990. #if defined(_I64_MIN)
  3991. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  3992. #else
  3993. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  3994. #endif
  3995.  
  3996. /* Set the size of some pointer types. */
  3997. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  3998. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  3999.  
  4000. /* Set whether the native type "char" is signed or unsigned. */
  4001. unsigned char uc = 255;
  4002. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  4003. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  4004.  
  4005. fclose(fout);
  4006. return 0;
  4007. }
  4008. else
  4009. {
  4010. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  4011. fname);
  4012. return 1;
  4013. }
  4014. }
  4015. #endif
  4016. ------------------------------------------
  4017. Test succeded
  4018. Try: i686-pc-linux-gnu-g++
  4019. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  4020. ---------- file -----------------------
  4021. /*============================================================================
  4022. KWSys - Kitware System Library
  4023. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4024.  
  4025. Distributed under the OSI-approved BSD License (the "License");
  4026. see accompanying file Copyright.txt for details.
  4027.  
  4028. This software is distributed WITHOUT ANY WARRANTY; without even the
  4029. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  4030. See the License for more information.
  4031. ============================================================================*/
  4032. // Setup for tests that use result of stl namespace test.
  4033. #if defined(KWSYS_STL_HAVE_STD)
  4034. # if KWSYS_STL_HAVE_STD
  4035. # define kwsys_stl std
  4036. # else
  4037. # define kwsys_stl
  4038. # endif
  4039. #endif
  4040.  
  4041. // Setup for tests that use iostreams.
  4042. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  4043. # if defined(_MSC_VER)
  4044. # pragma warning (push,1)
  4045. # endif
  4046. # if KWSYS_IOS_USE_ANSI
  4047. # include <iostream>
  4048. # else
  4049. # include <iostream.h>
  4050. # endif
  4051. # if defined(_MSC_VER)
  4052. # pragma warning (pop)
  4053. # endif
  4054. # if KWSYS_IOS_HAVE_STD
  4055. # define kwsys_ios std
  4056. # else
  4057. # define kwsys_ios
  4058. # endif
  4059. #endif
  4060.  
  4061. #ifdef TEST_KWSYS_STL_HAVE_STD
  4062. #include <list>
  4063. void f(std ::list<int>*) {}
  4064. int main() { return 0; }
  4065. #endif
  4066.  
  4067. #ifdef TEST_KWSYS_IOS_USE_ANSI
  4068. #include <iosfwd>
  4069. int main() { return 0; }
  4070. #endif
  4071.  
  4072. #ifdef TEST_KWSYS_LFS_SUPPORT
  4073. #define _LARGE_FILES
  4074. #include <iostream>
  4075. int main() { return 0; }
  4076. #endif
  4077.  
  4078.  
  4079. #ifdef TEST_KWSYS_IOS_HAVE_STD
  4080. #include <iosfwd>
  4081. void f(std ::ostream*) {}
  4082. int main() { return 0; }
  4083. #endif
  4084.  
  4085. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  4086. #include <sstream>
  4087. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  4088. # error "GCC 2.96 stringstream is buggy"
  4089. #endif
  4090. int main()
  4091. {
  4092. std ::ostringstream ostr;
  4093. ostr << "hello";
  4094. if(ostr.str().size() == 5)
  4095. {
  4096. return 0;
  4097. }
  4098. return -1;
  4099. }
  4100. #endif
  4101.  
  4102. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  4103. #include <strstream.h>
  4104. int main() { return 0; }
  4105. #endif
  4106.  
  4107. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  4108. #include <strstrea.h>
  4109. int main() { return 0; }
  4110. #endif
  4111.  
  4112. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  4113. # include <iostream.h>
  4114. # include <string>
  4115. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  4116. int main() { return 0; }
  4117. #endif
  4118.  
  4119. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  4120. # include <iostream.h>
  4121. # include <string>
  4122. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  4123. int main() { return 0; }
  4124. #endif
  4125.  
  4126. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  4127. # include <string>
  4128. bool f(const kwsys_stl::string& s) { return s != ""; }
  4129. int main() { return 0; }
  4130. #endif
  4131.  
  4132. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  4133. #include <cstdio>
  4134. int main() { return 0; }
  4135. #endif
  4136.  
  4137. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  4138. #include <cstddef>
  4139. void f(size_t) {}
  4140. int main() { return 0; }
  4141. #endif
  4142.  
  4143. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  4144. long long f(long long n) { return n; }
  4145. int main()
  4146. {
  4147. long long n = 0;
  4148. return static_cast<int>(f(n));
  4149. }
  4150. #endif
  4151.  
  4152. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  4153. template <class T> class A;
  4154. template <class T> int f(A<T>&);
  4155. template <class T> class A
  4156. {
  4157. public:
  4158. // "friend int f<>(A<T>&)" would conform
  4159. friend int f(A<T>&);
  4160. private:
  4161. int x;
  4162. };
  4163.  
  4164. template <class T> int f(A<T>& a) { return a.x = 0; }
  4165. template int f(A<int>&);
  4166.  
  4167. int main()
  4168. {
  4169. A<int> a;
  4170. return f(a);
  4171. }
  4172. #endif
  4173.  
  4174. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  4175. template <class U>
  4176. class A
  4177. {
  4178. public:
  4179. U u;
  4180. A(): u(0) {}
  4181. template <class V> V m(V* p) { return *p = u; }
  4182. };
  4183.  
  4184. int main()
  4185. {
  4186. A<short> a;
  4187. int s = 1;
  4188. return a.m(&s);
  4189. }
  4190. #endif
  4191.  
  4192. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  4193. template <class T> struct A {};
  4194. template <> struct A<int*>
  4195. {
  4196. static int f() { return 0; }
  4197. };
  4198. int main() { return A<int*>::f(); }
  4199. #endif
  4200.  
  4201. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  4202. namespace N
  4203. {
  4204. class A {};
  4205. int f(A*) { return 0; }
  4206. }
  4207. void f(void*);
  4208. int main()
  4209. {
  4210. N::A* a = 0;
  4211. return f(a);
  4212. }
  4213. #endif
  4214.  
  4215. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  4216. #include <iterator>
  4217. #include <list>
  4218. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  4219. int main() { return 0; }
  4220. #endif
  4221.  
  4222. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  4223. #include <iterator>
  4224. #include <list>
  4225. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  4226. int main() { return 0; }
  4227. #endif
  4228.  
  4229. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  4230. #include <iterator>
  4231. #include <list>
  4232. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  4233. int main() { return 0; }
  4234. #endif
  4235.  
  4236. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  4237. #include <memory>
  4238. template <class Alloc>
  4239. void f(const Alloc&)
  4240. {
  4241. typedef typename Alloc::size_type alloc_size_type;
  4242. }
  4243. int main()
  4244. {
  4245. f(kwsys_stl::allocator<char>());
  4246. return 0;
  4247. }
  4248. #endif
  4249.  
  4250. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  4251. #include <memory>
  4252. void f(kwsys_stl::allocator::size_type const&) {}
  4253. int main() { return 0; }
  4254. #endif
  4255.  
  4256. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  4257. #include <memory>
  4258. template <class T, class Alloc>
  4259. void f(const T&, const Alloc&)
  4260. {
  4261. typedef typename Alloc::template rebind<T>::other alloc_type;
  4262. }
  4263. int main()
  4264. {
  4265. f(0, kwsys_stl::allocator<char>());
  4266. return 0;
  4267. }
  4268. #endif
  4269.  
  4270. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  4271. #include <memory>
  4272. void f(kwsys_stl::allocator<char> const& a)
  4273. {
  4274. a.max_size(sizeof(int));
  4275. }
  4276. int main()
  4277. {
  4278. f(kwsys_stl::allocator<char>());
  4279. return 0;
  4280. }
  4281. #endif
  4282.  
  4283. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  4284. #include <vector>
  4285. void f(kwsys_stl::vector<int> const& v1)
  4286. {
  4287. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  4288. }
  4289. int main()
  4290. {
  4291. f(kwsys_stl::vector<int>());
  4292. return 0;
  4293. }
  4294. #endif
  4295.  
  4296. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  4297. #include <sys/types.h>
  4298. #include <sys/stat.h>
  4299. #include <unistd.h>
  4300. int main()
  4301. {
  4302. struct stat stat1;
  4303. (void)stat1.st_mtim.tv_sec;
  4304. (void)stat1.st_mtim.tv_nsec;
  4305. return 0;
  4306. }
  4307. #endif
  4308.  
  4309. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  4310. void function(long**) {}
  4311. int main()
  4312. {
  4313. __int64** p = 0;
  4314. function(p);
  4315. return 0;
  4316. }
  4317. #endif
  4318.  
  4319. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  4320. void function(long long**) {}
  4321. int main()
  4322. {
  4323. __int64** p = 0;
  4324. function(p);
  4325. return 0;
  4326. }
  4327. #endif
  4328.  
  4329. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  4330. void function(double& l, unsigned __int64 const& r)
  4331. {
  4332. l = static_cast<double>(r);
  4333. }
  4334.  
  4335. int main()
  4336. {
  4337. double tTo = 0.0;
  4338. unsigned __int64 tFrom = 0;
  4339. function(tTo, tFrom);
  4340. return 0;
  4341. }
  4342. #endif
  4343.  
  4344. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  4345. int test_binary(int, ...)
  4346. {
  4347. return 0;
  4348. }
  4349. int main()
  4350. {
  4351. return test_binary(1, kwsys_ios::ios::binary);
  4352. }
  4353. #endif
  4354.  
  4355. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  4356. int test_istream(kwsys_ios::istream& is, long long& x)
  4357. {
  4358. return (is >> x)? 1:0;
  4359. }
  4360. int main()
  4361. {
  4362. long long x = 0;
  4363. return test_istream(kwsys_ios::cin, x);
  4364. }
  4365. #endif
  4366.  
  4367. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  4368. int test_ostream(kwsys_ios::ostream& os, long long x)
  4369. {
  4370. return (os << x)? 1:0;
  4371. }
  4372. int main()
  4373. {
  4374. long long x = 0;
  4375. return test_ostream(kwsys_ios::cout, x);
  4376. }
  4377. #endif
  4378.  
  4379. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  4380. /* Return 0 for char signed and 1 for char unsigned. */
  4381. int main()
  4382. {
  4383. unsigned char uc = 255;
  4384. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  4385. }
  4386. #endif
  4387.  
  4388. #ifdef TEST_KWSYS_LFS_WORKS
  4389. /* Return 0 when LFS is available and 1 otherwise. */
  4390. #define _LARGEFILE_SOURCE
  4391. #define _LARGEFILE64_SOURCE
  4392. #define _LARGE_FILES
  4393. #define _FILE_OFFSET_BITS 64
  4394. #include <sys/types.h>
  4395. #include <sys/stat.h>
  4396. #include <assert.h>
  4397. #if KWSYS_CXX_HAS_CSTDIO
  4398. # include <cstdio>
  4399. #endif
  4400. #include <stdio.h>
  4401.  
  4402. int main(int, char **argv)
  4403. {
  4404. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  4405. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  4406. if (OFF_T_64 % 2147483647 != 1)
  4407. return 1;
  4408.  
  4409. // stat breaks on SCO OpenServer
  4410. struct stat buf;
  4411. stat( argv[0], &buf );
  4412. if (!S_ISREG(buf.st_mode))
  4413. return 2;
  4414.  
  4415. FILE *file = fopen( argv[0], "r" );
  4416. off_t offset = ftello( file );
  4417. fseek( file, offset, SEEK_CUR );
  4418. fclose( file );
  4419. return 0;
  4420. }
  4421. #endif
  4422.  
  4423. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  4424. /* Collect fundamental type information and save it to a CMake script. */
  4425.  
  4426. /* Include limits.h to get macros indicating long long and __int64.
  4427. Note that certain compilers need special macros to define these
  4428. macros in limits.h. */
  4429. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  4430. # define _MSC_EXTENSIONS
  4431. #endif
  4432. #if defined(__GNUC__) && __GNUC__ < 3
  4433. # define _GNU_SOURCE
  4434. #endif
  4435. #include <limits.h>
  4436.  
  4437. #include <stdio.h>
  4438. #include <string.h>
  4439.  
  4440. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  4441. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  4442. and sometimes not. This macro will make sure the value is treated
  4443. as a double-quoted string. */
  4444. #define TO_STRING(x) TO_STRING0(x)
  4445. #define TO_STRING0(x) TO_STRING1(x)
  4446. #define TO_STRING1(x) #x
  4447.  
  4448. void f() {}
  4449.  
  4450. int main()
  4451. {
  4452. /* Construct the output file name. Some preprocessors will add an
  4453. extra level of double quotes, so strip them. */
  4454. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  4455. char* fname = fbuf;
  4456. if(fname[0] == '"')
  4457. {
  4458. ++fname;
  4459. int len = static_cast<int>(strlen(fname));
  4460. if(len > 0 && fname[len-1] == '"')
  4461. {
  4462. fname[len-1] = 0;
  4463. }
  4464. }
  4465.  
  4466. /* Try to open the output file. */
  4467. if(FILE* fout = fopen(fname, "w"))
  4468. {
  4469. /* Set the size of standard types. */
  4470. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  4471. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  4472. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  4473. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  4474.  
  4475. /* Set the size of some non-standard but common types. */
  4476. /* Check for a limits.h macro for long long to see if the type exists. */
  4477. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  4478. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  4479. #else
  4480. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  4481. #endif
  4482. /* Check for a limits.h macro for __int64 to see if the type exists. */
  4483. #if defined(_I64_MIN)
  4484. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  4485. #else
  4486. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  4487. #endif
  4488.  
  4489. /* Set the size of some pointer types. */
  4490. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  4491. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  4492.  
  4493. /* Set whether the native type "char" is signed or unsigned. */
  4494. unsigned char uc = 255;
  4495. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  4496. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  4497.  
  4498. fclose(fout);
  4499. return 0;
  4500. }
  4501. else
  4502. {
  4503. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  4504. fname);
  4505. return 1;
  4506. }
  4507. }
  4508. #endif
  4509. ------------------------------------------
  4510. Test succeded
  4511. Try: i686-pc-linux-gnu-g++
  4512. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  4513. ---------- file -----------------------
  4514. /*============================================================================
  4515. KWSys - Kitware System Library
  4516. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4517.  
  4518. Distributed under the OSI-approved BSD License (the "License");
  4519. see accompanying file Copyright.txt for details.
  4520.  
  4521. This software is distributed WITHOUT ANY WARRANTY; without even the
  4522. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  4523. See the License for more information.
  4524. ============================================================================*/
  4525. // Setup for tests that use result of stl namespace test.
  4526. #if defined(KWSYS_STL_HAVE_STD)
  4527. # if KWSYS_STL_HAVE_STD
  4528. # define kwsys_stl std
  4529. # else
  4530. # define kwsys_stl
  4531. # endif
  4532. #endif
  4533.  
  4534. // Setup for tests that use iostreams.
  4535. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  4536. # if defined(_MSC_VER)
  4537. # pragma warning (push,1)
  4538. # endif
  4539. # if KWSYS_IOS_USE_ANSI
  4540. # include <iostream>
  4541. # else
  4542. # include <iostream.h>
  4543. # endif
  4544. # if defined(_MSC_VER)
  4545. # pragma warning (pop)
  4546. # endif
  4547. # if KWSYS_IOS_HAVE_STD
  4548. # define kwsys_ios std
  4549. # else
  4550. # define kwsys_ios
  4551. # endif
  4552. #endif
  4553.  
  4554. #ifdef TEST_KWSYS_STL_HAVE_STD
  4555. #include <list>
  4556. void f(std ::list<int>*) {}
  4557. int main() { return 0; }
  4558. #endif
  4559.  
  4560. #ifdef TEST_KWSYS_IOS_USE_ANSI
  4561. #include <iosfwd>
  4562. int main() { return 0; }
  4563. #endif
  4564.  
  4565. #ifdef TEST_KWSYS_LFS_SUPPORT
  4566. #define _LARGE_FILES
  4567. #include <iostream>
  4568. int main() { return 0; }
  4569. #endif
  4570.  
  4571.  
  4572. #ifdef TEST_KWSYS_IOS_HAVE_STD
  4573. #include <iosfwd>
  4574. void f(std ::ostream*) {}
  4575. int main() { return 0; }
  4576. #endif
  4577.  
  4578. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  4579. #include <sstream>
  4580. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  4581. # error "GCC 2.96 stringstream is buggy"
  4582. #endif
  4583. int main()
  4584. {
  4585. std ::ostringstream ostr;
  4586. ostr << "hello";
  4587. if(ostr.str().size() == 5)
  4588. {
  4589. return 0;
  4590. }
  4591. return -1;
  4592. }
  4593. #endif
  4594.  
  4595. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  4596. #include <strstream.h>
  4597. int main() { return 0; }
  4598. #endif
  4599.  
  4600. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  4601. #include <strstrea.h>
  4602. int main() { return 0; }
  4603. #endif
  4604.  
  4605. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  4606. # include <iostream.h>
  4607. # include <string>
  4608. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  4609. int main() { return 0; }
  4610. #endif
  4611.  
  4612. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  4613. # include <iostream.h>
  4614. # include <string>
  4615. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  4616. int main() { return 0; }
  4617. #endif
  4618.  
  4619. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  4620. # include <string>
  4621. bool f(const kwsys_stl::string& s) { return s != ""; }
  4622. int main() { return 0; }
  4623. #endif
  4624.  
  4625. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  4626. #include <cstdio>
  4627. int main() { return 0; }
  4628. #endif
  4629.  
  4630. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  4631. #include <cstddef>
  4632. void f(size_t) {}
  4633. int main() { return 0; }
  4634. #endif
  4635.  
  4636. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  4637. long long f(long long n) { return n; }
  4638. int main()
  4639. {
  4640. long long n = 0;
  4641. return static_cast<int>(f(n));
  4642. }
  4643. #endif
  4644.  
  4645. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  4646. template <class T> class A;
  4647. template <class T> int f(A<T>&);
  4648. template <class T> class A
  4649. {
  4650. public:
  4651. // "friend int f<>(A<T>&)" would conform
  4652. friend int f(A<T>&);
  4653. private:
  4654. int x;
  4655. };
  4656.  
  4657. template <class T> int f(A<T>& a) { return a.x = 0; }
  4658. template int f(A<int>&);
  4659.  
  4660. int main()
  4661. {
  4662. A<int> a;
  4663. return f(a);
  4664. }
  4665. #endif
  4666.  
  4667. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  4668. template <class U>
  4669. class A
  4670. {
  4671. public:
  4672. U u;
  4673. A(): u(0) {}
  4674. template <class V> V m(V* p) { return *p = u; }
  4675. };
  4676.  
  4677. int main()
  4678. {
  4679. A<short> a;
  4680. int s = 1;
  4681. return a.m(&s);
  4682. }
  4683. #endif
  4684.  
  4685. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  4686. template <class T> struct A {};
  4687. template <> struct A<int*>
  4688. {
  4689. static int f() { return 0; }
  4690. };
  4691. int main() { return A<int*>::f(); }
  4692. #endif
  4693.  
  4694. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  4695. namespace N
  4696. {
  4697. class A {};
  4698. int f(A*) { return 0; }
  4699. }
  4700. void f(void*);
  4701. int main()
  4702. {
  4703. N::A* a = 0;
  4704. return f(a);
  4705. }
  4706. #endif
  4707.  
  4708. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  4709. #include <iterator>
  4710. #include <list>
  4711. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  4712. int main() { return 0; }
  4713. #endif
  4714.  
  4715. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  4716. #include <iterator>
  4717. #include <list>
  4718. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  4719. int main() { return 0; }
  4720. #endif
  4721.  
  4722. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  4723. #include <iterator>
  4724. #include <list>
  4725. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  4726. int main() { return 0; }
  4727. #endif
  4728.  
  4729. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  4730. #include <memory>
  4731. template <class Alloc>
  4732. void f(const Alloc&)
  4733. {
  4734. typedef typename Alloc::size_type alloc_size_type;
  4735. }
  4736. int main()
  4737. {
  4738. f(kwsys_stl::allocator<char>());
  4739. return 0;
  4740. }
  4741. #endif
  4742.  
  4743. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  4744. #include <memory>
  4745. void f(kwsys_stl::allocator::size_type const&) {}
  4746. int main() { return 0; }
  4747. #endif
  4748.  
  4749. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  4750. #include <memory>
  4751. template <class T, class Alloc>
  4752. void f(const T&, const Alloc&)
  4753. {
  4754. typedef typename Alloc::template rebind<T>::other alloc_type;
  4755. }
  4756. int main()
  4757. {
  4758. f(0, kwsys_stl::allocator<char>());
  4759. return 0;
  4760. }
  4761. #endif
  4762.  
  4763. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  4764. #include <memory>
  4765. void f(kwsys_stl::allocator<char> const& a)
  4766. {
  4767. a.max_size(sizeof(int));
  4768. }
  4769. int main()
  4770. {
  4771. f(kwsys_stl::allocator<char>());
  4772. return 0;
  4773. }
  4774. #endif
  4775.  
  4776. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  4777. #include <vector>
  4778. void f(kwsys_stl::vector<int> const& v1)
  4779. {
  4780. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  4781. }
  4782. int main()
  4783. {
  4784. f(kwsys_stl::vector<int>());
  4785. return 0;
  4786. }
  4787. #endif
  4788.  
  4789. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  4790. #include <sys/types.h>
  4791. #include <sys/stat.h>
  4792. #include <unistd.h>
  4793. int main()
  4794. {
  4795. struct stat stat1;
  4796. (void)stat1.st_mtim.tv_sec;
  4797. (void)stat1.st_mtim.tv_nsec;
  4798. return 0;
  4799. }
  4800. #endif
  4801.  
  4802. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  4803. void function(long**) {}
  4804. int main()
  4805. {
  4806. __int64** p = 0;
  4807. function(p);
  4808. return 0;
  4809. }
  4810. #endif
  4811.  
  4812. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  4813. void function(long long**) {}
  4814. int main()
  4815. {
  4816. __int64** p = 0;
  4817. function(p);
  4818. return 0;
  4819. }
  4820. #endif
  4821.  
  4822. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  4823. void function(double& l, unsigned __int64 const& r)
  4824. {
  4825. l = static_cast<double>(r);
  4826. }
  4827.  
  4828. int main()
  4829. {
  4830. double tTo = 0.0;
  4831. unsigned __int64 tFrom = 0;
  4832. function(tTo, tFrom);
  4833. return 0;
  4834. }
  4835. #endif
  4836.  
  4837. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  4838. int test_binary(int, ...)
  4839. {
  4840. return 0;
  4841. }
  4842. int main()
  4843. {
  4844. return test_binary(1, kwsys_ios::ios::binary);
  4845. }
  4846. #endif
  4847.  
  4848. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  4849. int test_istream(kwsys_ios::istream& is, long long& x)
  4850. {
  4851. return (is >> x)? 1:0;
  4852. }
  4853. int main()
  4854. {
  4855. long long x = 0;
  4856. return test_istream(kwsys_ios::cin, x);
  4857. }
  4858. #endif
  4859.  
  4860. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  4861. int test_ostream(kwsys_ios::ostream& os, long long x)
  4862. {
  4863. return (os << x)? 1:0;
  4864. }
  4865. int main()
  4866. {
  4867. long long x = 0;
  4868. return test_ostream(kwsys_ios::cout, x);
  4869. }
  4870. #endif
  4871.  
  4872. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  4873. /* Return 0 for char signed and 1 for char unsigned. */
  4874. int main()
  4875. {
  4876. unsigned char uc = 255;
  4877. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  4878. }
  4879. #endif
  4880.  
  4881. #ifdef TEST_KWSYS_LFS_WORKS
  4882. /* Return 0 when LFS is available and 1 otherwise. */
  4883. #define _LARGEFILE_SOURCE
  4884. #define _LARGEFILE64_SOURCE
  4885. #define _LARGE_FILES
  4886. #define _FILE_OFFSET_BITS 64
  4887. #include <sys/types.h>
  4888. #include <sys/stat.h>
  4889. #include <assert.h>
  4890. #if KWSYS_CXX_HAS_CSTDIO
  4891. # include <cstdio>
  4892. #endif
  4893. #include <stdio.h>
  4894.  
  4895. int main(int, char **argv)
  4896. {
  4897. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  4898. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  4899. if (OFF_T_64 % 2147483647 != 1)
  4900. return 1;
  4901.  
  4902. // stat breaks on SCO OpenServer
  4903. struct stat buf;
  4904. stat( argv[0], &buf );
  4905. if (!S_ISREG(buf.st_mode))
  4906. return 2;
  4907.  
  4908. FILE *file = fopen( argv[0], "r" );
  4909. off_t offset = ftello( file );
  4910. fseek( file, offset, SEEK_CUR );
  4911. fclose( file );
  4912. return 0;
  4913. }
  4914. #endif
  4915.  
  4916. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  4917. /* Collect fundamental type information and save it to a CMake script. */
  4918.  
  4919. /* Include limits.h to get macros indicating long long and __int64.
  4920. Note that certain compilers need special macros to define these
  4921. macros in limits.h. */
  4922. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  4923. # define _MSC_EXTENSIONS
  4924. #endif
  4925. #if defined(__GNUC__) && __GNUC__ < 3
  4926. # define _GNU_SOURCE
  4927. #endif
  4928. #include <limits.h>
  4929.  
  4930. #include <stdio.h>
  4931. #include <string.h>
  4932.  
  4933. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  4934. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  4935. and sometimes not. This macro will make sure the value is treated
  4936. as a double-quoted string. */
  4937. #define TO_STRING(x) TO_STRING0(x)
  4938. #define TO_STRING0(x) TO_STRING1(x)
  4939. #define TO_STRING1(x) #x
  4940.  
  4941. void f() {}
  4942.  
  4943. int main()
  4944. {
  4945. /* Construct the output file name. Some preprocessors will add an
  4946. extra level of double quotes, so strip them. */
  4947. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  4948. char* fname = fbuf;
  4949. if(fname[0] == '"')
  4950. {
  4951. ++fname;
  4952. int len = static_cast<int>(strlen(fname));
  4953. if(len > 0 && fname[len-1] == '"')
  4954. {
  4955. fname[len-1] = 0;
  4956. }
  4957. }
  4958.  
  4959. /* Try to open the output file. */
  4960. if(FILE* fout = fopen(fname, "w"))
  4961. {
  4962. /* Set the size of standard types. */
  4963. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  4964. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  4965. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  4966. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  4967.  
  4968. /* Set the size of some non-standard but common types. */
  4969. /* Check for a limits.h macro for long long to see if the type exists. */
  4970. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  4971. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  4972. #else
  4973. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  4974. #endif
  4975. /* Check for a limits.h macro for __int64 to see if the type exists. */
  4976. #if defined(_I64_MIN)
  4977. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  4978. #else
  4979. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  4980. #endif
  4981.  
  4982. /* Set the size of some pointer types. */
  4983. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  4984. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  4985.  
  4986. /* Set whether the native type "char" is signed or unsigned. */
  4987. unsigned char uc = 255;
  4988. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  4989. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  4990.  
  4991. fclose(fout);
  4992. return 0;
  4993. }
  4994. else
  4995. {
  4996. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  4997. fname);
  4998. return 1;
  4999. }
  5000. }
  5001. #endif
  5002. ------------------------------------------
  5003. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx: In function 'void f(const std::allocator<char>&)':
  5004. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx:254:25: error: no matching function for call to 'std::allocator<char>::max_size(unsigned int) const'
  5005. /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/ext/new_allocator.h:98:7: note: candidate is: __gnu_cxx::new_allocator::size_type __gnu_cxx::new_allocator<_Tp>::max_size() const [with _Tp = char, __gnu_cxx::new_allocator::size_type = unsigned int]
  5006. Test failed to compile
  5007. Try: i686-pc-linux-gnu-g++
  5008. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  5009. ---------- file -----------------------
  5010. /*============================================================================
  5011. KWSys - Kitware System Library
  5012. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  5013.  
  5014. Distributed under the OSI-approved BSD License (the "License");
  5015. see accompanying file Copyright.txt for details.
  5016.  
  5017. This software is distributed WITHOUT ANY WARRANTY; without even the
  5018. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  5019. See the License for more information.
  5020. ============================================================================*/
  5021. // Setup for tests that use result of stl namespace test.
  5022. #if defined(KWSYS_STL_HAVE_STD)
  5023. # if KWSYS_STL_HAVE_STD
  5024. # define kwsys_stl std
  5025. # else
  5026. # define kwsys_stl
  5027. # endif
  5028. #endif
  5029.  
  5030. // Setup for tests that use iostreams.
  5031. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  5032. # if defined(_MSC_VER)
  5033. # pragma warning (push,1)
  5034. # endif
  5035. # if KWSYS_IOS_USE_ANSI
  5036. # include <iostream>
  5037. # else
  5038. # include <iostream.h>
  5039. # endif
  5040. # if defined(_MSC_VER)
  5041. # pragma warning (pop)
  5042. # endif
  5043. # if KWSYS_IOS_HAVE_STD
  5044. # define kwsys_ios std
  5045. # else
  5046. # define kwsys_ios
  5047. # endif
  5048. #endif
  5049.  
  5050. #ifdef TEST_KWSYS_STL_HAVE_STD
  5051. #include <list>
  5052. void f(std ::list<int>*) {}
  5053. int main() { return 0; }
  5054. #endif
  5055.  
  5056. #ifdef TEST_KWSYS_IOS_USE_ANSI
  5057. #include <iosfwd>
  5058. int main() { return 0; }
  5059. #endif
  5060.  
  5061. #ifdef TEST_KWSYS_LFS_SUPPORT
  5062. #define _LARGE_FILES
  5063. #include <iostream>
  5064. int main() { return 0; }
  5065. #endif
  5066.  
  5067.  
  5068. #ifdef TEST_KWSYS_IOS_HAVE_STD
  5069. #include <iosfwd>
  5070. void f(std ::ostream*) {}
  5071. int main() { return 0; }
  5072. #endif
  5073.  
  5074. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  5075. #include <sstream>
  5076. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  5077. # error "GCC 2.96 stringstream is buggy"
  5078. #endif
  5079. int main()
  5080. {
  5081. std ::ostringstream ostr;
  5082. ostr << "hello";
  5083. if(ostr.str().size() == 5)
  5084. {
  5085. return 0;
  5086. }
  5087. return -1;
  5088. }
  5089. #endif
  5090.  
  5091. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  5092. #include <strstream.h>
  5093. int main() { return 0; }
  5094. #endif
  5095.  
  5096. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  5097. #include <strstrea.h>
  5098. int main() { return 0; }
  5099. #endif
  5100.  
  5101. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  5102. # include <iostream.h>
  5103. # include <string>
  5104. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  5105. int main() { return 0; }
  5106. #endif
  5107.  
  5108. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  5109. # include <iostream.h>
  5110. # include <string>
  5111. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  5112. int main() { return 0; }
  5113. #endif
  5114.  
  5115. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  5116. # include <string>
  5117. bool f(const kwsys_stl::string& s) { return s != ""; }
  5118. int main() { return 0; }
  5119. #endif
  5120.  
  5121. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  5122. #include <cstdio>
  5123. int main() { return 0; }
  5124. #endif
  5125.  
  5126. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  5127. #include <cstddef>
  5128. void f(size_t) {}
  5129. int main() { return 0; }
  5130. #endif
  5131.  
  5132. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  5133. long long f(long long n) { return n; }
  5134. int main()
  5135. {
  5136. long long n = 0;
  5137. return static_cast<int>(f(n));
  5138. }
  5139. #endif
  5140.  
  5141. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  5142. template <class T> class A;
  5143. template <class T> int f(A<T>&);
  5144. template <class T> class A
  5145. {
  5146. public:
  5147. // "friend int f<>(A<T>&)" would conform
  5148. friend int f(A<T>&);
  5149. private:
  5150. int x;
  5151. };
  5152.  
  5153. template <class T> int f(A<T>& a) { return a.x = 0; }
  5154. template int f(A<int>&);
  5155.  
  5156. int main()
  5157. {
  5158. A<int> a;
  5159. return f(a);
  5160. }
  5161. #endif
  5162.  
  5163. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  5164. template <class U>
  5165. class A
  5166. {
  5167. public:
  5168. U u;
  5169. A(): u(0) {}
  5170. template <class V> V m(V* p) { return *p = u; }
  5171. };
  5172.  
  5173. int main()
  5174. {
  5175. A<short> a;
  5176. int s = 1;
  5177. return a.m(&s);
  5178. }
  5179. #endif
  5180.  
  5181. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  5182. template <class T> struct A {};
  5183. template <> struct A<int*>
  5184. {
  5185. static int f() { return 0; }
  5186. };
  5187. int main() { return A<int*>::f(); }
  5188. #endif
  5189.  
  5190. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  5191. namespace N
  5192. {
  5193. class A {};
  5194. int f(A*) { return 0; }
  5195. }
  5196. void f(void*);
  5197. int main()
  5198. {
  5199. N::A* a = 0;
  5200. return f(a);
  5201. }
  5202. #endif
  5203.  
  5204. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  5205. #include <iterator>
  5206. #include <list>
  5207. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  5208. int main() { return 0; }
  5209. #endif
  5210.  
  5211. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  5212. #include <iterator>
  5213. #include <list>
  5214. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  5215. int main() { return 0; }
  5216. #endif
  5217.  
  5218. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  5219. #include <iterator>
  5220. #include <list>
  5221. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  5222. int main() { return 0; }
  5223. #endif
  5224.  
  5225. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  5226. #include <memory>
  5227. template <class Alloc>
  5228. void f(const Alloc&)
  5229. {
  5230. typedef typename Alloc::size_type alloc_size_type;
  5231. }
  5232. int main()
  5233. {
  5234. f(kwsys_stl::allocator<char>());
  5235. return 0;
  5236. }
  5237. #endif
  5238.  
  5239. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  5240. #include <memory>
  5241. void f(kwsys_stl::allocator::size_type const&) {}
  5242. int main() { return 0; }
  5243. #endif
  5244.  
  5245. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  5246. #include <memory>
  5247. template <class T, class Alloc>
  5248. void f(const T&, const Alloc&)
  5249. {
  5250. typedef typename Alloc::template rebind<T>::other alloc_type;
  5251. }
  5252. int main()
  5253. {
  5254. f(0, kwsys_stl::allocator<char>());
  5255. return 0;
  5256. }
  5257. #endif
  5258.  
  5259. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  5260. #include <memory>
  5261. void f(kwsys_stl::allocator<char> const& a)
  5262. {
  5263. a.max_size(sizeof(int));
  5264. }
  5265. int main()
  5266. {
  5267. f(kwsys_stl::allocator<char>());
  5268. return 0;
  5269. }
  5270. #endif
  5271.  
  5272. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  5273. #include <vector>
  5274. void f(kwsys_stl::vector<int> const& v1)
  5275. {
  5276. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  5277. }
  5278. int main()
  5279. {
  5280. f(kwsys_stl::vector<int>());
  5281. return 0;
  5282. }
  5283. #endif
  5284.  
  5285. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  5286. #include <sys/types.h>
  5287. #include <sys/stat.h>
  5288. #include <unistd.h>
  5289. int main()
  5290. {
  5291. struct stat stat1;
  5292. (void)stat1.st_mtim.tv_sec;
  5293. (void)stat1.st_mtim.tv_nsec;
  5294. return 0;
  5295. }
  5296. #endif
  5297.  
  5298. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  5299. void function(long**) {}
  5300. int main()
  5301. {
  5302. __int64** p = 0;
  5303. function(p);
  5304. return 0;
  5305. }
  5306. #endif
  5307.  
  5308. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  5309. void function(long long**) {}
  5310. int main()
  5311. {
  5312. __int64** p = 0;
  5313. function(p);
  5314. return 0;
  5315. }
  5316. #endif
  5317.  
  5318. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  5319. void function(double& l, unsigned __int64 const& r)
  5320. {
  5321. l = static_cast<double>(r);
  5322. }
  5323.  
  5324. int main()
  5325. {
  5326. double tTo = 0.0;
  5327. unsigned __int64 tFrom = 0;
  5328. function(tTo, tFrom);
  5329. return 0;
  5330. }
  5331. #endif
  5332.  
  5333. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  5334. int test_binary(int, ...)
  5335. {
  5336. return 0;
  5337. }
  5338. int main()
  5339. {
  5340. return test_binary(1, kwsys_ios::ios::binary);
  5341. }
  5342. #endif
  5343.  
  5344. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  5345. int test_istream(kwsys_ios::istream& is, long long& x)
  5346. {
  5347. return (is >> x)? 1:0;
  5348. }
  5349. int main()
  5350. {
  5351. long long x = 0;
  5352. return test_istream(kwsys_ios::cin, x);
  5353. }
  5354. #endif
  5355.  
  5356. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  5357. int test_ostream(kwsys_ios::ostream& os, long long x)
  5358. {
  5359. return (os << x)? 1:0;
  5360. }
  5361. int main()
  5362. {
  5363. long long x = 0;
  5364. return test_ostream(kwsys_ios::cout, x);
  5365. }
  5366. #endif
  5367.  
  5368. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  5369. /* Return 0 for char signed and 1 for char unsigned. */
  5370. int main()
  5371. {
  5372. unsigned char uc = 255;
  5373. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  5374. }
  5375. #endif
  5376.  
  5377. #ifdef TEST_KWSYS_LFS_WORKS
  5378. /* Return 0 when LFS is available and 1 otherwise. */
  5379. #define _LARGEFILE_SOURCE
  5380. #define _LARGEFILE64_SOURCE
  5381. #define _LARGE_FILES
  5382. #define _FILE_OFFSET_BITS 64
  5383. #include <sys/types.h>
  5384. #include <sys/stat.h>
  5385. #include <assert.h>
  5386. #if KWSYS_CXX_HAS_CSTDIO
  5387. # include <cstdio>
  5388. #endif
  5389. #include <stdio.h>
  5390.  
  5391. int main(int, char **argv)
  5392. {
  5393. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  5394. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  5395. if (OFF_T_64 % 2147483647 != 1)
  5396. return 1;
  5397.  
  5398. // stat breaks on SCO OpenServer
  5399. struct stat buf;
  5400. stat( argv[0], &buf );
  5401. if (!S_ISREG(buf.st_mode))
  5402. return 2;
  5403.  
  5404. FILE *file = fopen( argv[0], "r" );
  5405. off_t offset = ftello( file );
  5406. fseek( file, offset, SEEK_CUR );
  5407. fclose( file );
  5408. return 0;
  5409. }
  5410. #endif
  5411.  
  5412. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  5413. /* Collect fundamental type information and save it to a CMake script. */
  5414.  
  5415. /* Include limits.h to get macros indicating long long and __int64.
  5416. Note that certain compilers need special macros to define these
  5417. macros in limits.h. */
  5418. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  5419. # define _MSC_EXTENSIONS
  5420. #endif
  5421. #if defined(__GNUC__) && __GNUC__ < 3
  5422. # define _GNU_SOURCE
  5423. #endif
  5424. #include <limits.h>
  5425.  
  5426. #include <stdio.h>
  5427. #include <string.h>
  5428.  
  5429. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  5430. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  5431. and sometimes not. This macro will make sure the value is treated
  5432. as a double-quoted string. */
  5433. #define TO_STRING(x) TO_STRING0(x)
  5434. #define TO_STRING0(x) TO_STRING1(x)
  5435. #define TO_STRING1(x) #x
  5436.  
  5437. void f() {}
  5438.  
  5439. int main()
  5440. {
  5441. /* Construct the output file name. Some preprocessors will add an
  5442. extra level of double quotes, so strip them. */
  5443. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  5444. char* fname = fbuf;
  5445. if(fname[0] == '"')
  5446. {
  5447. ++fname;
  5448. int len = static_cast<int>(strlen(fname));
  5449. if(len > 0 && fname[len-1] == '"')
  5450. {
  5451. fname[len-1] = 0;
  5452. }
  5453. }
  5454.  
  5455. /* Try to open the output file. */
  5456. if(FILE* fout = fopen(fname, "w"))
  5457. {
  5458. /* Set the size of standard types. */
  5459. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  5460. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  5461. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  5462. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  5463.  
  5464. /* Set the size of some non-standard but common types. */
  5465. /* Check for a limits.h macro for long long to see if the type exists. */
  5466. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  5467. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  5468. #else
  5469. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  5470. #endif
  5471. /* Check for a limits.h macro for __int64 to see if the type exists. */
  5472. #if defined(_I64_MIN)
  5473. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  5474. #else
  5475. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  5476. #endif
  5477.  
  5478. /* Set the size of some pointer types. */
  5479. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  5480. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  5481.  
  5482. /* Set whether the native type "char" is signed or unsigned. */
  5483. unsigned char uc = 255;
  5484. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  5485. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  5486.  
  5487. fclose(fout);
  5488. return 0;
  5489. }
  5490. else
  5491. {
  5492. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  5493. fname);
  5494. return 1;
  5495. }
  5496. }
  5497. #endif
  5498. ------------------------------------------
  5499. Test succeded
  5500. Try: i686-pc-linux-gnu-g++
  5501. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_CXX_HAS_CSTDDEF /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  5502. ---------- file -----------------------
  5503. /*============================================================================
  5504. KWSys - Kitware System Library
  5505. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  5506.  
  5507. Distributed under the OSI-approved BSD License (the "License");
  5508. see accompanying file Copyright.txt for details.
  5509.  
  5510. This software is distributed WITHOUT ANY WARRANTY; without even the
  5511. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  5512. See the License for more information.
  5513. ============================================================================*/
  5514. // Setup for tests that use result of stl namespace test.
  5515. #if defined(KWSYS_STL_HAVE_STD)
  5516. # if KWSYS_STL_HAVE_STD
  5517. # define kwsys_stl std
  5518. # else
  5519. # define kwsys_stl
  5520. # endif
  5521. #endif
  5522.  
  5523. // Setup for tests that use iostreams.
  5524. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  5525. # if defined(_MSC_VER)
  5526. # pragma warning (push,1)
  5527. # endif
  5528. # if KWSYS_IOS_USE_ANSI
  5529. # include <iostream>
  5530. # else
  5531. # include <iostream.h>
  5532. # endif
  5533. # if defined(_MSC_VER)
  5534. # pragma warning (pop)
  5535. # endif
  5536. # if KWSYS_IOS_HAVE_STD
  5537. # define kwsys_ios std
  5538. # else
  5539. # define kwsys_ios
  5540. # endif
  5541. #endif
  5542.  
  5543. #ifdef TEST_KWSYS_STL_HAVE_STD
  5544. #include <list>
  5545. void f(std ::list<int>*) {}
  5546. int main() { return 0; }
  5547. #endif
  5548.  
  5549. #ifdef TEST_KWSYS_IOS_USE_ANSI
  5550. #include <iosfwd>
  5551. int main() { return 0; }
  5552. #endif
  5553.  
  5554. #ifdef TEST_KWSYS_LFS_SUPPORT
  5555. #define _LARGE_FILES
  5556. #include <iostream>
  5557. int main() { return 0; }
  5558. #endif
  5559.  
  5560.  
  5561. #ifdef TEST_KWSYS_IOS_HAVE_STD
  5562. #include <iosfwd>
  5563. void f(std ::ostream*) {}
  5564. int main() { return 0; }
  5565. #endif
  5566.  
  5567. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  5568. #include <sstream>
  5569. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  5570. # error "GCC 2.96 stringstream is buggy"
  5571. #endif
  5572. int main()
  5573. {
  5574. std ::ostringstream ostr;
  5575. ostr << "hello";
  5576. if(ostr.str().size() == 5)
  5577. {
  5578. return 0;
  5579. }
  5580. return -1;
  5581. }
  5582. #endif
  5583.  
  5584. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  5585. #include <strstream.h>
  5586. int main() { return 0; }
  5587. #endif
  5588.  
  5589. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  5590. #include <strstrea.h>
  5591. int main() { return 0; }
  5592. #endif
  5593.  
  5594. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  5595. # include <iostream.h>
  5596. # include <string>
  5597. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  5598. int main() { return 0; }
  5599. #endif
  5600.  
  5601. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  5602. # include <iostream.h>
  5603. # include <string>
  5604. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  5605. int main() { return 0; }
  5606. #endif
  5607.  
  5608. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  5609. # include <string>
  5610. bool f(const kwsys_stl::string& s) { return s != ""; }
  5611. int main() { return 0; }
  5612. #endif
  5613.  
  5614. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  5615. #include <cstdio>
  5616. int main() { return 0; }
  5617. #endif
  5618.  
  5619. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  5620. #include <cstddef>
  5621. void f(size_t) {}
  5622. int main() { return 0; }
  5623. #endif
  5624.  
  5625. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  5626. long long f(long long n) { return n; }
  5627. int main()
  5628. {
  5629. long long n = 0;
  5630. return static_cast<int>(f(n));
  5631. }
  5632. #endif
  5633.  
  5634. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  5635. template <class T> class A;
  5636. template <class T> int f(A<T>&);
  5637. template <class T> class A
  5638. {
  5639. public:
  5640. // "friend int f<>(A<T>&)" would conform
  5641. friend int f(A<T>&);
  5642. private:
  5643. int x;
  5644. };
  5645.  
  5646. template <class T> int f(A<T>& a) { return a.x = 0; }
  5647. template int f(A<int>&);
  5648.  
  5649. int main()
  5650. {
  5651. A<int> a;
  5652. return f(a);
  5653. }
  5654. #endif
  5655.  
  5656. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  5657. template <class U>
  5658. class A
  5659. {
  5660. public:
  5661. U u;
  5662. A(): u(0) {}
  5663. template <class V> V m(V* p) { return *p = u; }
  5664. };
  5665.  
  5666. int main()
  5667. {
  5668. A<short> a;
  5669. int s = 1;
  5670. return a.m(&s);
  5671. }
  5672. #endif
  5673.  
  5674. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  5675. template <class T> struct A {};
  5676. template <> struct A<int*>
  5677. {
  5678. static int f() { return 0; }
  5679. };
  5680. int main() { return A<int*>::f(); }
  5681. #endif
  5682.  
  5683. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  5684. namespace N
  5685. {
  5686. class A {};
  5687. int f(A*) { return 0; }
  5688. }
  5689. void f(void*);
  5690. int main()
  5691. {
  5692. N::A* a = 0;
  5693. return f(a);
  5694. }
  5695. #endif
  5696.  
  5697. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  5698. #include <iterator>
  5699. #include <list>
  5700. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  5701. int main() { return 0; }
  5702. #endif
  5703.  
  5704. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  5705. #include <iterator>
  5706. #include <list>
  5707. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  5708. int main() { return 0; }
  5709. #endif
  5710.  
  5711. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  5712. #include <iterator>
  5713. #include <list>
  5714. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  5715. int main() { return 0; }
  5716. #endif
  5717.  
  5718. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  5719. #include <memory>
  5720. template <class Alloc>
  5721. void f(const Alloc&)
  5722. {
  5723. typedef typename Alloc::size_type alloc_size_type;
  5724. }
  5725. int main()
  5726. {
  5727. f(kwsys_stl::allocator<char>());
  5728. return 0;
  5729. }
  5730. #endif
  5731.  
  5732. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  5733. #include <memory>
  5734. void f(kwsys_stl::allocator::size_type const&) {}
  5735. int main() { return 0; }
  5736. #endif
  5737.  
  5738. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  5739. #include <memory>
  5740. template <class T, class Alloc>
  5741. void f(const T&, const Alloc&)
  5742. {
  5743. typedef typename Alloc::template rebind<T>::other alloc_type;
  5744. }
  5745. int main()
  5746. {
  5747. f(0, kwsys_stl::allocator<char>());
  5748. return 0;
  5749. }
  5750. #endif
  5751.  
  5752. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  5753. #include <memory>
  5754. void f(kwsys_stl::allocator<char> const& a)
  5755. {
  5756. a.max_size(sizeof(int));
  5757. }
  5758. int main()
  5759. {
  5760. f(kwsys_stl::allocator<char>());
  5761. return 0;
  5762. }
  5763. #endif
  5764.  
  5765. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  5766. #include <vector>
  5767. void f(kwsys_stl::vector<int> const& v1)
  5768. {
  5769. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  5770. }
  5771. int main()
  5772. {
  5773. f(kwsys_stl::vector<int>());
  5774. return 0;
  5775. }
  5776. #endif
  5777.  
  5778. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  5779. #include <sys/types.h>
  5780. #include <sys/stat.h>
  5781. #include <unistd.h>
  5782. int main()
  5783. {
  5784. struct stat stat1;
  5785. (void)stat1.st_mtim.tv_sec;
  5786. (void)stat1.st_mtim.tv_nsec;
  5787. return 0;
  5788. }
  5789. #endif
  5790.  
  5791. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  5792. void function(long**) {}
  5793. int main()
  5794. {
  5795. __int64** p = 0;
  5796. function(p);
  5797. return 0;
  5798. }
  5799. #endif
  5800.  
  5801. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  5802. void function(long long**) {}
  5803. int main()
  5804. {
  5805. __int64** p = 0;
  5806. function(p);
  5807. return 0;
  5808. }
  5809. #endif
  5810.  
  5811. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  5812. void function(double& l, unsigned __int64 const& r)
  5813. {
  5814. l = static_cast<double>(r);
  5815. }
  5816.  
  5817. int main()
  5818. {
  5819. double tTo = 0.0;
  5820. unsigned __int64 tFrom = 0;
  5821. function(tTo, tFrom);
  5822. return 0;
  5823. }
  5824. #endif
  5825.  
  5826. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  5827. int test_binary(int, ...)
  5828. {
  5829. return 0;
  5830. }
  5831. int main()
  5832. {
  5833. return test_binary(1, kwsys_ios::ios::binary);
  5834. }
  5835. #endif
  5836.  
  5837. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  5838. int test_istream(kwsys_ios::istream& is, long long& x)
  5839. {
  5840. return (is >> x)? 1:0;
  5841. }
  5842. int main()
  5843. {
  5844. long long x = 0;
  5845. return test_istream(kwsys_ios::cin, x);
  5846. }
  5847. #endif
  5848.  
  5849. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  5850. int test_ostream(kwsys_ios::ostream& os, long long x)
  5851. {
  5852. return (os << x)? 1:0;
  5853. }
  5854. int main()
  5855. {
  5856. long long x = 0;
  5857. return test_ostream(kwsys_ios::cout, x);
  5858. }
  5859. #endif
  5860.  
  5861. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  5862. /* Return 0 for char signed and 1 for char unsigned. */
  5863. int main()
  5864. {
  5865. unsigned char uc = 255;
  5866. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  5867. }
  5868. #endif
  5869.  
  5870. #ifdef TEST_KWSYS_LFS_WORKS
  5871. /* Return 0 when LFS is available and 1 otherwise. */
  5872. #define _LARGEFILE_SOURCE
  5873. #define _LARGEFILE64_SOURCE
  5874. #define _LARGE_FILES
  5875. #define _FILE_OFFSET_BITS 64
  5876. #include <sys/types.h>
  5877. #include <sys/stat.h>
  5878. #include <assert.h>
  5879. #if KWSYS_CXX_HAS_CSTDIO
  5880. # include <cstdio>
  5881. #endif
  5882. #include <stdio.h>
  5883.  
  5884. int main(int, char **argv)
  5885. {
  5886. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  5887. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  5888. if (OFF_T_64 % 2147483647 != 1)
  5889. return 1;
  5890.  
  5891. // stat breaks on SCO OpenServer
  5892. struct stat buf;
  5893. stat( argv[0], &buf );
  5894. if (!S_ISREG(buf.st_mode))
  5895. return 2;
  5896.  
  5897. FILE *file = fopen( argv[0], "r" );
  5898. off_t offset = ftello( file );
  5899. fseek( file, offset, SEEK_CUR );
  5900. fclose( file );
  5901. return 0;
  5902. }
  5903. #endif
  5904.  
  5905. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  5906. /* Collect fundamental type information and save it to a CMake script. */
  5907.  
  5908. /* Include limits.h to get macros indicating long long and __int64.
  5909. Note that certain compilers need special macros to define these
  5910. macros in limits.h. */
  5911. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  5912. # define _MSC_EXTENSIONS
  5913. #endif
  5914. #if defined(__GNUC__) && __GNUC__ < 3
  5915. # define _GNU_SOURCE
  5916. #endif
  5917. #include <limits.h>
  5918.  
  5919. #include <stdio.h>
  5920. #include <string.h>
  5921.  
  5922. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  5923. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  5924. and sometimes not. This macro will make sure the value is treated
  5925. as a double-quoted string. */
  5926. #define TO_STRING(x) TO_STRING0(x)
  5927. #define TO_STRING0(x) TO_STRING1(x)
  5928. #define TO_STRING1(x) #x
  5929.  
  5930. void f() {}
  5931.  
  5932. int main()
  5933. {
  5934. /* Construct the output file name. Some preprocessors will add an
  5935. extra level of double quotes, so strip them. */
  5936. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  5937. char* fname = fbuf;
  5938. if(fname[0] == '"')
  5939. {
  5940. ++fname;
  5941. int len = static_cast<int>(strlen(fname));
  5942. if(len > 0 && fname[len-1] == '"')
  5943. {
  5944. fname[len-1] = 0;
  5945. }
  5946. }
  5947.  
  5948. /* Try to open the output file. */
  5949. if(FILE* fout = fopen(fname, "w"))
  5950. {
  5951. /* Set the size of standard types. */
  5952. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  5953. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  5954. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  5955. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  5956.  
  5957. /* Set the size of some non-standard but common types. */
  5958. /* Check for a limits.h macro for long long to see if the type exists. */
  5959. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  5960. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  5961. #else
  5962. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  5963. #endif
  5964. /* Check for a limits.h macro for __int64 to see if the type exists. */
  5965. #if defined(_I64_MIN)
  5966. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  5967. #else
  5968. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  5969. #endif
  5970.  
  5971. /* Set the size of some pointer types. */
  5972. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  5973. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  5974.  
  5975. /* Set whether the native type "char" is signed or unsigned. */
  5976. unsigned char uc = 255;
  5977. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  5978. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  5979.  
  5980. fclose(fout);
  5981. return 0;
  5982. }
  5983. else
  5984. {
  5985. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  5986. fname);
  5987. return 1;
  5988. }
  5989. }
  5990. #endif
  5991. ------------------------------------------
  5992. Test succeded
  5993. Try: i686-pc-linux-gnu-g++
  5994. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  5995. ---------- file -----------------------
  5996. /*============================================================================
  5997. KWSys - Kitware System Library
  5998. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  5999.  
  6000. Distributed under the OSI-approved BSD License (the "License");
  6001. see accompanying file Copyright.txt for details.
  6002.  
  6003. This software is distributed WITHOUT ANY WARRANTY; without even the
  6004. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  6005. See the License for more information.
  6006. ============================================================================*/
  6007. // Setup for tests that use result of stl namespace test.
  6008. #if defined(KWSYS_STL_HAVE_STD)
  6009. # if KWSYS_STL_HAVE_STD
  6010. # define kwsys_stl std
  6011. # else
  6012. # define kwsys_stl
  6013. # endif
  6014. #endif
  6015.  
  6016. // Setup for tests that use iostreams.
  6017. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  6018. # if defined(_MSC_VER)
  6019. # pragma warning (push,1)
  6020. # endif
  6021. # if KWSYS_IOS_USE_ANSI
  6022. # include <iostream>
  6023. # else
  6024. # include <iostream.h>
  6025. # endif
  6026. # if defined(_MSC_VER)
  6027. # pragma warning (pop)
  6028. # endif
  6029. # if KWSYS_IOS_HAVE_STD
  6030. # define kwsys_ios std
  6031. # else
  6032. # define kwsys_ios
  6033. # endif
  6034. #endif
  6035.  
  6036. #ifdef TEST_KWSYS_STL_HAVE_STD
  6037. #include <list>
  6038. void f(std ::list<int>*) {}
  6039. int main() { return 0; }
  6040. #endif
  6041.  
  6042. #ifdef TEST_KWSYS_IOS_USE_ANSI
  6043. #include <iosfwd>
  6044. int main() { return 0; }
  6045. #endif
  6046.  
  6047. #ifdef TEST_KWSYS_LFS_SUPPORT
  6048. #define _LARGE_FILES
  6049. #include <iostream>
  6050. int main() { return 0; }
  6051. #endif
  6052.  
  6053.  
  6054. #ifdef TEST_KWSYS_IOS_HAVE_STD
  6055. #include <iosfwd>
  6056. void f(std ::ostream*) {}
  6057. int main() { return 0; }
  6058. #endif
  6059.  
  6060. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  6061. #include <sstream>
  6062. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  6063. # error "GCC 2.96 stringstream is buggy"
  6064. #endif
  6065. int main()
  6066. {
  6067. std ::ostringstream ostr;
  6068. ostr << "hello";
  6069. if(ostr.str().size() == 5)
  6070. {
  6071. return 0;
  6072. }
  6073. return -1;
  6074. }
  6075. #endif
  6076.  
  6077. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  6078. #include <strstream.h>
  6079. int main() { return 0; }
  6080. #endif
  6081.  
  6082. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  6083. #include <strstrea.h>
  6084. int main() { return 0; }
  6085. #endif
  6086.  
  6087. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  6088. # include <iostream.h>
  6089. # include <string>
  6090. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  6091. int main() { return 0; }
  6092. #endif
  6093.  
  6094. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  6095. # include <iostream.h>
  6096. # include <string>
  6097. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  6098. int main() { return 0; }
  6099. #endif
  6100.  
  6101. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  6102. # include <string>
  6103. bool f(const kwsys_stl::string& s) { return s != ""; }
  6104. int main() { return 0; }
  6105. #endif
  6106.  
  6107. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  6108. #include <cstdio>
  6109. int main() { return 0; }
  6110. #endif
  6111.  
  6112. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  6113. #include <cstddef>
  6114. void f(size_t) {}
  6115. int main() { return 0; }
  6116. #endif
  6117.  
  6118. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  6119. long long f(long long n) { return n; }
  6120. int main()
  6121. {
  6122. long long n = 0;
  6123. return static_cast<int>(f(n));
  6124. }
  6125. #endif
  6126.  
  6127. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  6128. template <class T> class A;
  6129. template <class T> int f(A<T>&);
  6130. template <class T> class A
  6131. {
  6132. public:
  6133. // "friend int f<>(A<T>&)" would conform
  6134. friend int f(A<T>&);
  6135. private:
  6136. int x;
  6137. };
  6138.  
  6139. template <class T> int f(A<T>& a) { return a.x = 0; }
  6140. template int f(A<int>&);
  6141.  
  6142. int main()
  6143. {
  6144. A<int> a;
  6145. return f(a);
  6146. }
  6147. #endif
  6148.  
  6149. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  6150. template <class U>
  6151. class A
  6152. {
  6153. public:
  6154. U u;
  6155. A(): u(0) {}
  6156. template <class V> V m(V* p) { return *p = u; }
  6157. };
  6158.  
  6159. int main()
  6160. {
  6161. A<short> a;
  6162. int s = 1;
  6163. return a.m(&s);
  6164. }
  6165. #endif
  6166.  
  6167. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  6168. template <class T> struct A {};
  6169. template <> struct A<int*>
  6170. {
  6171. static int f() { return 0; }
  6172. };
  6173. int main() { return A<int*>::f(); }
  6174. #endif
  6175.  
  6176. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  6177. namespace N
  6178. {
  6179. class A {};
  6180. int f(A*) { return 0; }
  6181. }
  6182. void f(void*);
  6183. int main()
  6184. {
  6185. N::A* a = 0;
  6186. return f(a);
  6187. }
  6188. #endif
  6189.  
  6190. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  6191. #include <iterator>
  6192. #include <list>
  6193. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  6194. int main() { return 0; }
  6195. #endif
  6196.  
  6197. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  6198. #include <iterator>
  6199. #include <list>
  6200. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  6201. int main() { return 0; }
  6202. #endif
  6203.  
  6204. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  6205. #include <iterator>
  6206. #include <list>
  6207. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  6208. int main() { return 0; }
  6209. #endif
  6210.  
  6211. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  6212. #include <memory>
  6213. template <class Alloc>
  6214. void f(const Alloc&)
  6215. {
  6216. typedef typename Alloc::size_type alloc_size_type;
  6217. }
  6218. int main()
  6219. {
  6220. f(kwsys_stl::allocator<char>());
  6221. return 0;
  6222. }
  6223. #endif
  6224.  
  6225. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  6226. #include <memory>
  6227. void f(kwsys_stl::allocator::size_type const&) {}
  6228. int main() { return 0; }
  6229. #endif
  6230.  
  6231. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  6232. #include <memory>
  6233. template <class T, class Alloc>
  6234. void f(const T&, const Alloc&)
  6235. {
  6236. typedef typename Alloc::template rebind<T>::other alloc_type;
  6237. }
  6238. int main()
  6239. {
  6240. f(0, kwsys_stl::allocator<char>());
  6241. return 0;
  6242. }
  6243. #endif
  6244.  
  6245. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  6246. #include <memory>
  6247. void f(kwsys_stl::allocator<char> const& a)
  6248. {
  6249. a.max_size(sizeof(int));
  6250. }
  6251. int main()
  6252. {
  6253. f(kwsys_stl::allocator<char>());
  6254. return 0;
  6255. }
  6256. #endif
  6257.  
  6258. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  6259. #include <vector>
  6260. void f(kwsys_stl::vector<int> const& v1)
  6261. {
  6262. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  6263. }
  6264. int main()
  6265. {
  6266. f(kwsys_stl::vector<int>());
  6267. return 0;
  6268. }
  6269. #endif
  6270.  
  6271. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  6272. #include <sys/types.h>
  6273. #include <sys/stat.h>
  6274. #include <unistd.h>
  6275. int main()
  6276. {
  6277. struct stat stat1;
  6278. (void)stat1.st_mtim.tv_sec;
  6279. (void)stat1.st_mtim.tv_nsec;
  6280. return 0;
  6281. }
  6282. #endif
  6283.  
  6284. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  6285. void function(long**) {}
  6286. int main()
  6287. {
  6288. __int64** p = 0;
  6289. function(p);
  6290. return 0;
  6291. }
  6292. #endif
  6293.  
  6294. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  6295. void function(long long**) {}
  6296. int main()
  6297. {
  6298. __int64** p = 0;
  6299. function(p);
  6300. return 0;
  6301. }
  6302. #endif
  6303.  
  6304. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  6305. void function(double& l, unsigned __int64 const& r)
  6306. {
  6307. l = static_cast<double>(r);
  6308. }
  6309.  
  6310. int main()
  6311. {
  6312. double tTo = 0.0;
  6313. unsigned __int64 tFrom = 0;
  6314. function(tTo, tFrom);
  6315. return 0;
  6316. }
  6317. #endif
  6318.  
  6319. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  6320. int test_binary(int, ...)
  6321. {
  6322. return 0;
  6323. }
  6324. int main()
  6325. {
  6326. return test_binary(1, kwsys_ios::ios::binary);
  6327. }
  6328. #endif
  6329.  
  6330. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  6331. int test_istream(kwsys_ios::istream& is, long long& x)
  6332. {
  6333. return (is >> x)? 1:0;
  6334. }
  6335. int main()
  6336. {
  6337. long long x = 0;
  6338. return test_istream(kwsys_ios::cin, x);
  6339. }
  6340. #endif
  6341.  
  6342. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  6343. int test_ostream(kwsys_ios::ostream& os, long long x)
  6344. {
  6345. return (os << x)? 1:0;
  6346. }
  6347. int main()
  6348. {
  6349. long long x = 0;
  6350. return test_ostream(kwsys_ios::cout, x);
  6351. }
  6352. #endif
  6353.  
  6354. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  6355. /* Return 0 for char signed and 1 for char unsigned. */
  6356. int main()
  6357. {
  6358. unsigned char uc = 255;
  6359. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  6360. }
  6361. #endif
  6362.  
  6363. #ifdef TEST_KWSYS_LFS_WORKS
  6364. /* Return 0 when LFS is available and 1 otherwise. */
  6365. #define _LARGEFILE_SOURCE
  6366. #define _LARGEFILE64_SOURCE
  6367. #define _LARGE_FILES
  6368. #define _FILE_OFFSET_BITS 64
  6369. #include <sys/types.h>
  6370. #include <sys/stat.h>
  6371. #include <assert.h>
  6372. #if KWSYS_CXX_HAS_CSTDIO
  6373. # include <cstdio>
  6374. #endif
  6375. #include <stdio.h>
  6376.  
  6377. int main(int, char **argv)
  6378. {
  6379. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  6380. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  6381. if (OFF_T_64 % 2147483647 != 1)
  6382. return 1;
  6383.  
  6384. // stat breaks on SCO OpenServer
  6385. struct stat buf;
  6386. stat( argv[0], &buf );
  6387. if (!S_ISREG(buf.st_mode))
  6388. return 2;
  6389.  
  6390. FILE *file = fopen( argv[0], "r" );
  6391. off_t offset = ftello( file );
  6392. fseek( file, offset, SEEK_CUR );
  6393. fclose( file );
  6394. return 0;
  6395. }
  6396. #endif
  6397.  
  6398. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  6399. /* Collect fundamental type information and save it to a CMake script. */
  6400.  
  6401. /* Include limits.h to get macros indicating long long and __int64.
  6402. Note that certain compilers need special macros to define these
  6403. macros in limits.h. */
  6404. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  6405. # define _MSC_EXTENSIONS
  6406. #endif
  6407. #if defined(__GNUC__) && __GNUC__ < 3
  6408. # define _GNU_SOURCE
  6409. #endif
  6410. #include <limits.h>
  6411.  
  6412. #include <stdio.h>
  6413. #include <string.h>
  6414.  
  6415. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  6416. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  6417. and sometimes not. This macro will make sure the value is treated
  6418. as a double-quoted string. */
  6419. #define TO_STRING(x) TO_STRING0(x)
  6420. #define TO_STRING0(x) TO_STRING1(x)
  6421. #define TO_STRING1(x) #x
  6422.  
  6423. void f() {}
  6424.  
  6425. int main()
  6426. {
  6427. /* Construct the output file name. Some preprocessors will add an
  6428. extra level of double quotes, so strip them. */
  6429. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  6430. char* fname = fbuf;
  6431. if(fname[0] == '"')
  6432. {
  6433. ++fname;
  6434. int len = static_cast<int>(strlen(fname));
  6435. if(len > 0 && fname[len-1] == '"')
  6436. {
  6437. fname[len-1] = 0;
  6438. }
  6439. }
  6440.  
  6441. /* Try to open the output file. */
  6442. if(FILE* fout = fopen(fname, "w"))
  6443. {
  6444. /* Set the size of standard types. */
  6445. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  6446. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  6447. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  6448. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  6449.  
  6450. /* Set the size of some non-standard but common types. */
  6451. /* Check for a limits.h macro for long long to see if the type exists. */
  6452. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  6453. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  6454. #else
  6455. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  6456. #endif
  6457. /* Check for a limits.h macro for __int64 to see if the type exists. */
  6458. #if defined(_I64_MIN)
  6459. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  6460. #else
  6461. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  6462. #endif
  6463.  
  6464. /* Set the size of some pointer types. */
  6465. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  6466. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  6467.  
  6468. /* Set whether the native type "char" is signed or unsigned. */
  6469. unsigned char uc = 255;
  6470. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  6471. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  6472.  
  6473. fclose(fout);
  6474. return 0;
  6475. }
  6476. else
  6477. {
  6478. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  6479. fname);
  6480. return 1;
  6481. }
  6482. }
  6483. #endif
  6484. ------------------------------------------
  6485. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx:139:21: warning: friend declaration 'int f(A<T>&)' declares a non-template function
  6486. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx:139:21: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here)
  6487. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx: In function 'int f(A<T>&) [with T = int]':
  6488. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx:145:23: instantiated from here
  6489. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx:141:7: error: 'int A<int>::x' is private
  6490. /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx:144:50: error: within this context
  6491. Test failed to compile
  6492. Try: i686-pc-linux-gnu-g++
  6493. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  6494. ---------- file -----------------------
  6495. /*============================================================================
  6496. KWSys - Kitware System Library
  6497. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  6498.  
  6499. Distributed under the OSI-approved BSD License (the "License");
  6500. see accompanying file Copyright.txt for details.
  6501.  
  6502. This software is distributed WITHOUT ANY WARRANTY; without even the
  6503. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  6504. See the License for more information.
  6505. ============================================================================*/
  6506. // Setup for tests that use result of stl namespace test.
  6507. #if defined(KWSYS_STL_HAVE_STD)
  6508. # if KWSYS_STL_HAVE_STD
  6509. # define kwsys_stl std
  6510. # else
  6511. # define kwsys_stl
  6512. # endif
  6513. #endif
  6514.  
  6515. // Setup for tests that use iostreams.
  6516. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  6517. # if defined(_MSC_VER)
  6518. # pragma warning (push,1)
  6519. # endif
  6520. # if KWSYS_IOS_USE_ANSI
  6521. # include <iostream>
  6522. # else
  6523. # include <iostream.h>
  6524. # endif
  6525. # if defined(_MSC_VER)
  6526. # pragma warning (pop)
  6527. # endif
  6528. # if KWSYS_IOS_HAVE_STD
  6529. # define kwsys_ios std
  6530. # else
  6531. # define kwsys_ios
  6532. # endif
  6533. #endif
  6534.  
  6535. #ifdef TEST_KWSYS_STL_HAVE_STD
  6536. #include <list>
  6537. void f(std ::list<int>*) {}
  6538. int main() { return 0; }
  6539. #endif
  6540.  
  6541. #ifdef TEST_KWSYS_IOS_USE_ANSI
  6542. #include <iosfwd>
  6543. int main() { return 0; }
  6544. #endif
  6545.  
  6546. #ifdef TEST_KWSYS_LFS_SUPPORT
  6547. #define _LARGE_FILES
  6548. #include <iostream>
  6549. int main() { return 0; }
  6550. #endif
  6551.  
  6552.  
  6553. #ifdef TEST_KWSYS_IOS_HAVE_STD
  6554. #include <iosfwd>
  6555. void f(std ::ostream*) {}
  6556. int main() { return 0; }
  6557. #endif
  6558.  
  6559. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  6560. #include <sstream>
  6561. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  6562. # error "GCC 2.96 stringstream is buggy"
  6563. #endif
  6564. int main()
  6565. {
  6566. std ::ostringstream ostr;
  6567. ostr << "hello";
  6568. if(ostr.str().size() == 5)
  6569. {
  6570. return 0;
  6571. }
  6572. return -1;
  6573. }
  6574. #endif
  6575.  
  6576. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  6577. #include <strstream.h>
  6578. int main() { return 0; }
  6579. #endif
  6580.  
  6581. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  6582. #include <strstrea.h>
  6583. int main() { return 0; }
  6584. #endif
  6585.  
  6586. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  6587. # include <iostream.h>
  6588. # include <string>
  6589. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  6590. int main() { return 0; }
  6591. #endif
  6592.  
  6593. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  6594. # include <iostream.h>
  6595. # include <string>
  6596. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  6597. int main() { return 0; }
  6598. #endif
  6599.  
  6600. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  6601. # include <string>
  6602. bool f(const kwsys_stl::string& s) { return s != ""; }
  6603. int main() { return 0; }
  6604. #endif
  6605.  
  6606. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  6607. #include <cstdio>
  6608. int main() { return 0; }
  6609. #endif
  6610.  
  6611. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  6612. #include <cstddef>
  6613. void f(size_t) {}
  6614. int main() { return 0; }
  6615. #endif
  6616.  
  6617. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  6618. long long f(long long n) { return n; }
  6619. int main()
  6620. {
  6621. long long n = 0;
  6622. return static_cast<int>(f(n));
  6623. }
  6624. #endif
  6625.  
  6626. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  6627. template <class T> class A;
  6628. template <class T> int f(A<T>&);
  6629. template <class T> class A
  6630. {
  6631. public:
  6632. // "friend int f<>(A<T>&)" would conform
  6633. friend int f(A<T>&);
  6634. private:
  6635. int x;
  6636. };
  6637.  
  6638. template <class T> int f(A<T>& a) { return a.x = 0; }
  6639. template int f(A<int>&);
  6640.  
  6641. int main()
  6642. {
  6643. A<int> a;
  6644. return f(a);
  6645. }
  6646. #endif
  6647.  
  6648. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  6649. template <class U>
  6650. class A
  6651. {
  6652. public:
  6653. U u;
  6654. A(): u(0) {}
  6655. template <class V> V m(V* p) { return *p = u; }
  6656. };
  6657.  
  6658. int main()
  6659. {
  6660. A<short> a;
  6661. int s = 1;
  6662. return a.m(&s);
  6663. }
  6664. #endif
  6665.  
  6666. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  6667. template <class T> struct A {};
  6668. template <> struct A<int*>
  6669. {
  6670. static int f() { return 0; }
  6671. };
  6672. int main() { return A<int*>::f(); }
  6673. #endif
  6674.  
  6675. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  6676. namespace N
  6677. {
  6678. class A {};
  6679. int f(A*) { return 0; }
  6680. }
  6681. void f(void*);
  6682. int main()
  6683. {
  6684. N::A* a = 0;
  6685. return f(a);
  6686. }
  6687. #endif
  6688.  
  6689. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  6690. #include <iterator>
  6691. #include <list>
  6692. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  6693. int main() { return 0; }
  6694. #endif
  6695.  
  6696. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  6697. #include <iterator>
  6698. #include <list>
  6699. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  6700. int main() { return 0; }
  6701. #endif
  6702.  
  6703. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  6704. #include <iterator>
  6705. #include <list>
  6706. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  6707. int main() { return 0; }
  6708. #endif
  6709.  
  6710. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  6711. #include <memory>
  6712. template <class Alloc>
  6713. void f(const Alloc&)
  6714. {
  6715. typedef typename Alloc::size_type alloc_size_type;
  6716. }
  6717. int main()
  6718. {
  6719. f(kwsys_stl::allocator<char>());
  6720. return 0;
  6721. }
  6722. #endif
  6723.  
  6724. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  6725. #include <memory>
  6726. void f(kwsys_stl::allocator::size_type const&) {}
  6727. int main() { return 0; }
  6728. #endif
  6729.  
  6730. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  6731. #include <memory>
  6732. template <class T, class Alloc>
  6733. void f(const T&, const Alloc&)
  6734. {
  6735. typedef typename Alloc::template rebind<T>::other alloc_type;
  6736. }
  6737. int main()
  6738. {
  6739. f(0, kwsys_stl::allocator<char>());
  6740. return 0;
  6741. }
  6742. #endif
  6743.  
  6744. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  6745. #include <memory>
  6746. void f(kwsys_stl::allocator<char> const& a)
  6747. {
  6748. a.max_size(sizeof(int));
  6749. }
  6750. int main()
  6751. {
  6752. f(kwsys_stl::allocator<char>());
  6753. return 0;
  6754. }
  6755. #endif
  6756.  
  6757. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  6758. #include <vector>
  6759. void f(kwsys_stl::vector<int> const& v1)
  6760. {
  6761. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  6762. }
  6763. int main()
  6764. {
  6765. f(kwsys_stl::vector<int>());
  6766. return 0;
  6767. }
  6768. #endif
  6769.  
  6770. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  6771. #include <sys/types.h>
  6772. #include <sys/stat.h>
  6773. #include <unistd.h>
  6774. int main()
  6775. {
  6776. struct stat stat1;
  6777. (void)stat1.st_mtim.tv_sec;
  6778. (void)stat1.st_mtim.tv_nsec;
  6779. return 0;
  6780. }
  6781. #endif
  6782.  
  6783. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  6784. void function(long**) {}
  6785. int main()
  6786. {
  6787. __int64** p = 0;
  6788. function(p);
  6789. return 0;
  6790. }
  6791. #endif
  6792.  
  6793. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  6794. void function(long long**) {}
  6795. int main()
  6796. {
  6797. __int64** p = 0;
  6798. function(p);
  6799. return 0;
  6800. }
  6801. #endif
  6802.  
  6803. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  6804. void function(double& l, unsigned __int64 const& r)
  6805. {
  6806. l = static_cast<double>(r);
  6807. }
  6808.  
  6809. int main()
  6810. {
  6811. double tTo = 0.0;
  6812. unsigned __int64 tFrom = 0;
  6813. function(tTo, tFrom);
  6814. return 0;
  6815. }
  6816. #endif
  6817.  
  6818. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  6819. int test_binary(int, ...)
  6820. {
  6821. return 0;
  6822. }
  6823. int main()
  6824. {
  6825. return test_binary(1, kwsys_ios::ios::binary);
  6826. }
  6827. #endif
  6828.  
  6829. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  6830. int test_istream(kwsys_ios::istream& is, long long& x)
  6831. {
  6832. return (is >> x)? 1:0;
  6833. }
  6834. int main()
  6835. {
  6836. long long x = 0;
  6837. return test_istream(kwsys_ios::cin, x);
  6838. }
  6839. #endif
  6840.  
  6841. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  6842. int test_ostream(kwsys_ios::ostream& os, long long x)
  6843. {
  6844. return (os << x)? 1:0;
  6845. }
  6846. int main()
  6847. {
  6848. long long x = 0;
  6849. return test_ostream(kwsys_ios::cout, x);
  6850. }
  6851. #endif
  6852.  
  6853. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  6854. /* Return 0 for char signed and 1 for char unsigned. */
  6855. int main()
  6856. {
  6857. unsigned char uc = 255;
  6858. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  6859. }
  6860. #endif
  6861.  
  6862. #ifdef TEST_KWSYS_LFS_WORKS
  6863. /* Return 0 when LFS is available and 1 otherwise. */
  6864. #define _LARGEFILE_SOURCE
  6865. #define _LARGEFILE64_SOURCE
  6866. #define _LARGE_FILES
  6867. #define _FILE_OFFSET_BITS 64
  6868. #include <sys/types.h>
  6869. #include <sys/stat.h>
  6870. #include <assert.h>
  6871. #if KWSYS_CXX_HAS_CSTDIO
  6872. # include <cstdio>
  6873. #endif
  6874. #include <stdio.h>
  6875.  
  6876. int main(int, char **argv)
  6877. {
  6878. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  6879. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  6880. if (OFF_T_64 % 2147483647 != 1)
  6881. return 1;
  6882.  
  6883. // stat breaks on SCO OpenServer
  6884. struct stat buf;
  6885. stat( argv[0], &buf );
  6886. if (!S_ISREG(buf.st_mode))
  6887. return 2;
  6888.  
  6889. FILE *file = fopen( argv[0], "r" );
  6890. off_t offset = ftello( file );
  6891. fseek( file, offset, SEEK_CUR );
  6892. fclose( file );
  6893. return 0;
  6894. }
  6895. #endif
  6896.  
  6897. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  6898. /* Collect fundamental type information and save it to a CMake script. */
  6899.  
  6900. /* Include limits.h to get macros indicating long long and __int64.
  6901. Note that certain compilers need special macros to define these
  6902. macros in limits.h. */
  6903. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  6904. # define _MSC_EXTENSIONS
  6905. #endif
  6906. #if defined(__GNUC__) && __GNUC__ < 3
  6907. # define _GNU_SOURCE
  6908. #endif
  6909. #include <limits.h>
  6910.  
  6911. #include <stdio.h>
  6912. #include <string.h>
  6913.  
  6914. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  6915. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  6916. and sometimes not. This macro will make sure the value is treated
  6917. as a double-quoted string. */
  6918. #define TO_STRING(x) TO_STRING0(x)
  6919. #define TO_STRING0(x) TO_STRING1(x)
  6920. #define TO_STRING1(x) #x
  6921.  
  6922. void f() {}
  6923.  
  6924. int main()
  6925. {
  6926. /* Construct the output file name. Some preprocessors will add an
  6927. extra level of double quotes, so strip them. */
  6928. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  6929. char* fname = fbuf;
  6930. if(fname[0] == '"')
  6931. {
  6932. ++fname;
  6933. int len = static_cast<int>(strlen(fname));
  6934. if(len > 0 && fname[len-1] == '"')
  6935. {
  6936. fname[len-1] = 0;
  6937. }
  6938. }
  6939.  
  6940. /* Try to open the output file. */
  6941. if(FILE* fout = fopen(fname, "w"))
  6942. {
  6943. /* Set the size of standard types. */
  6944. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  6945. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  6946. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  6947. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  6948.  
  6949. /* Set the size of some non-standard but common types. */
  6950. /* Check for a limits.h macro for long long to see if the type exists. */
  6951. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  6952. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  6953. #else
  6954. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  6955. #endif
  6956. /* Check for a limits.h macro for __int64 to see if the type exists. */
  6957. #if defined(_I64_MIN)
  6958. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  6959. #else
  6960. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  6961. #endif
  6962.  
  6963. /* Set the size of some pointer types. */
  6964. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  6965. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  6966.  
  6967. /* Set whether the native type "char" is signed or unsigned. */
  6968. unsigned char uc = 255;
  6969. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  6970. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  6971.  
  6972. fclose(fout);
  6973. return 0;
  6974. }
  6975. else
  6976. {
  6977. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  6978. fname);
  6979. return 1;
  6980. }
  6981. }
  6982. #endif
  6983. ------------------------------------------
  6984. Test succeded
  6985. Try: i686-pc-linux-gnu-g++
  6986. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  6987. ---------- file -----------------------
  6988. /*============================================================================
  6989. KWSys - Kitware System Library
  6990. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  6991.  
  6992. Distributed under the OSI-approved BSD License (the "License");
  6993. see accompanying file Copyright.txt for details.
  6994.  
  6995. This software is distributed WITHOUT ANY WARRANTY; without even the
  6996. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  6997. See the License for more information.
  6998. ============================================================================*/
  6999. // Setup for tests that use result of stl namespace test.
  7000. #if defined(KWSYS_STL_HAVE_STD)
  7001. # if KWSYS_STL_HAVE_STD
  7002. # define kwsys_stl std
  7003. # else
  7004. # define kwsys_stl
  7005. # endif
  7006. #endif
  7007.  
  7008. // Setup for tests that use iostreams.
  7009. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  7010. # if defined(_MSC_VER)
  7011. # pragma warning (push,1)
  7012. # endif
  7013. # if KWSYS_IOS_USE_ANSI
  7014. # include <iostream>
  7015. # else
  7016. # include <iostream.h>
  7017. # endif
  7018. # if defined(_MSC_VER)
  7019. # pragma warning (pop)
  7020. # endif
  7021. # if KWSYS_IOS_HAVE_STD
  7022. # define kwsys_ios std
  7023. # else
  7024. # define kwsys_ios
  7025. # endif
  7026. #endif
  7027.  
  7028. #ifdef TEST_KWSYS_STL_HAVE_STD
  7029. #include <list>
  7030. void f(std ::list<int>*) {}
  7031. int main() { return 0; }
  7032. #endif
  7033.  
  7034. #ifdef TEST_KWSYS_IOS_USE_ANSI
  7035. #include <iosfwd>
  7036. int main() { return 0; }
  7037. #endif
  7038.  
  7039. #ifdef TEST_KWSYS_LFS_SUPPORT
  7040. #define _LARGE_FILES
  7041. #include <iostream>
  7042. int main() { return 0; }
  7043. #endif
  7044.  
  7045.  
  7046. #ifdef TEST_KWSYS_IOS_HAVE_STD
  7047. #include <iosfwd>
  7048. void f(std ::ostream*) {}
  7049. int main() { return 0; }
  7050. #endif
  7051.  
  7052. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  7053. #include <sstream>
  7054. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  7055. # error "GCC 2.96 stringstream is buggy"
  7056. #endif
  7057. int main()
  7058. {
  7059. std ::ostringstream ostr;
  7060. ostr << "hello";
  7061. if(ostr.str().size() == 5)
  7062. {
  7063. return 0;
  7064. }
  7065. return -1;
  7066. }
  7067. #endif
  7068.  
  7069. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  7070. #include <strstream.h>
  7071. int main() { return 0; }
  7072. #endif
  7073.  
  7074. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  7075. #include <strstrea.h>
  7076. int main() { return 0; }
  7077. #endif
  7078.  
  7079. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  7080. # include <iostream.h>
  7081. # include <string>
  7082. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  7083. int main() { return 0; }
  7084. #endif
  7085.  
  7086. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  7087. # include <iostream.h>
  7088. # include <string>
  7089. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  7090. int main() { return 0; }
  7091. #endif
  7092.  
  7093. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  7094. # include <string>
  7095. bool f(const kwsys_stl::string& s) { return s != ""; }
  7096. int main() { return 0; }
  7097. #endif
  7098.  
  7099. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  7100. #include <cstdio>
  7101. int main() { return 0; }
  7102. #endif
  7103.  
  7104. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  7105. #include <cstddef>
  7106. void f(size_t) {}
  7107. int main() { return 0; }
  7108. #endif
  7109.  
  7110. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  7111. long long f(long long n) { return n; }
  7112. int main()
  7113. {
  7114. long long n = 0;
  7115. return static_cast<int>(f(n));
  7116. }
  7117. #endif
  7118.  
  7119. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  7120. template <class T> class A;
  7121. template <class T> int f(A<T>&);
  7122. template <class T> class A
  7123. {
  7124. public:
  7125. // "friend int f<>(A<T>&)" would conform
  7126. friend int f(A<T>&);
  7127. private:
  7128. int x;
  7129. };
  7130.  
  7131. template <class T> int f(A<T>& a) { return a.x = 0; }
  7132. template int f(A<int>&);
  7133.  
  7134. int main()
  7135. {
  7136. A<int> a;
  7137. return f(a);
  7138. }
  7139. #endif
  7140.  
  7141. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  7142. template <class U>
  7143. class A
  7144. {
  7145. public:
  7146. U u;
  7147. A(): u(0) {}
  7148. template <class V> V m(V* p) { return *p = u; }
  7149. };
  7150.  
  7151. int main()
  7152. {
  7153. A<short> a;
  7154. int s = 1;
  7155. return a.m(&s);
  7156. }
  7157. #endif
  7158.  
  7159. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  7160. template <class T> struct A {};
  7161. template <> struct A<int*>
  7162. {
  7163. static int f() { return 0; }
  7164. };
  7165. int main() { return A<int*>::f(); }
  7166. #endif
  7167.  
  7168. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  7169. namespace N
  7170. {
  7171. class A {};
  7172. int f(A*) { return 0; }
  7173. }
  7174. void f(void*);
  7175. int main()
  7176. {
  7177. N::A* a = 0;
  7178. return f(a);
  7179. }
  7180. #endif
  7181.  
  7182. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  7183. #include <iterator>
  7184. #include <list>
  7185. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  7186. int main() { return 0; }
  7187. #endif
  7188.  
  7189. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  7190. #include <iterator>
  7191. #include <list>
  7192. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  7193. int main() { return 0; }
  7194. #endif
  7195.  
  7196. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  7197. #include <iterator>
  7198. #include <list>
  7199. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  7200. int main() { return 0; }
  7201. #endif
  7202.  
  7203. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  7204. #include <memory>
  7205. template <class Alloc>
  7206. void f(const Alloc&)
  7207. {
  7208. typedef typename Alloc::size_type alloc_size_type;
  7209. }
  7210. int main()
  7211. {
  7212. f(kwsys_stl::allocator<char>());
  7213. return 0;
  7214. }
  7215. #endif
  7216.  
  7217. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  7218. #include <memory>
  7219. void f(kwsys_stl::allocator::size_type const&) {}
  7220. int main() { return 0; }
  7221. #endif
  7222.  
  7223. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  7224. #include <memory>
  7225. template <class T, class Alloc>
  7226. void f(const T&, const Alloc&)
  7227. {
  7228. typedef typename Alloc::template rebind<T>::other alloc_type;
  7229. }
  7230. int main()
  7231. {
  7232. f(0, kwsys_stl::allocator<char>());
  7233. return 0;
  7234. }
  7235. #endif
  7236.  
  7237. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  7238. #include <memory>
  7239. void f(kwsys_stl::allocator<char> const& a)
  7240. {
  7241. a.max_size(sizeof(int));
  7242. }
  7243. int main()
  7244. {
  7245. f(kwsys_stl::allocator<char>());
  7246. return 0;
  7247. }
  7248. #endif
  7249.  
  7250. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  7251. #include <vector>
  7252. void f(kwsys_stl::vector<int> const& v1)
  7253. {
  7254. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  7255. }
  7256. int main()
  7257. {
  7258. f(kwsys_stl::vector<int>());
  7259. return 0;
  7260. }
  7261. #endif
  7262.  
  7263. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  7264. #include <sys/types.h>
  7265. #include <sys/stat.h>
  7266. #include <unistd.h>
  7267. int main()
  7268. {
  7269. struct stat stat1;
  7270. (void)stat1.st_mtim.tv_sec;
  7271. (void)stat1.st_mtim.tv_nsec;
  7272. return 0;
  7273. }
  7274. #endif
  7275.  
  7276. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  7277. void function(long**) {}
  7278. int main()
  7279. {
  7280. __int64** p = 0;
  7281. function(p);
  7282. return 0;
  7283. }
  7284. #endif
  7285.  
  7286. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  7287. void function(long long**) {}
  7288. int main()
  7289. {
  7290. __int64** p = 0;
  7291. function(p);
  7292. return 0;
  7293. }
  7294. #endif
  7295.  
  7296. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  7297. void function(double& l, unsigned __int64 const& r)
  7298. {
  7299. l = static_cast<double>(r);
  7300. }
  7301.  
  7302. int main()
  7303. {
  7304. double tTo = 0.0;
  7305. unsigned __int64 tFrom = 0;
  7306. function(tTo, tFrom);
  7307. return 0;
  7308. }
  7309. #endif
  7310.  
  7311. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  7312. int test_binary(int, ...)
  7313. {
  7314. return 0;
  7315. }
  7316. int main()
  7317. {
  7318. return test_binary(1, kwsys_ios::ios::binary);
  7319. }
  7320. #endif
  7321.  
  7322. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  7323. int test_istream(kwsys_ios::istream& is, long long& x)
  7324. {
  7325. return (is >> x)? 1:0;
  7326. }
  7327. int main()
  7328. {
  7329. long long x = 0;
  7330. return test_istream(kwsys_ios::cin, x);
  7331. }
  7332. #endif
  7333.  
  7334. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  7335. int test_ostream(kwsys_ios::ostream& os, long long x)
  7336. {
  7337. return (os << x)? 1:0;
  7338. }
  7339. int main()
  7340. {
  7341. long long x = 0;
  7342. return test_ostream(kwsys_ios::cout, x);
  7343. }
  7344. #endif
  7345.  
  7346. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  7347. /* Return 0 for char signed and 1 for char unsigned. */
  7348. int main()
  7349. {
  7350. unsigned char uc = 255;
  7351. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  7352. }
  7353. #endif
  7354.  
  7355. #ifdef TEST_KWSYS_LFS_WORKS
  7356. /* Return 0 when LFS is available and 1 otherwise. */
  7357. #define _LARGEFILE_SOURCE
  7358. #define _LARGEFILE64_SOURCE
  7359. #define _LARGE_FILES
  7360. #define _FILE_OFFSET_BITS 64
  7361. #include <sys/types.h>
  7362. #include <sys/stat.h>
  7363. #include <assert.h>
  7364. #if KWSYS_CXX_HAS_CSTDIO
  7365. # include <cstdio>
  7366. #endif
  7367. #include <stdio.h>
  7368.  
  7369. int main(int, char **argv)
  7370. {
  7371. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  7372. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  7373. if (OFF_T_64 % 2147483647 != 1)
  7374. return 1;
  7375.  
  7376. // stat breaks on SCO OpenServer
  7377. struct stat buf;
  7378. stat( argv[0], &buf );
  7379. if (!S_ISREG(buf.st_mode))
  7380. return 2;
  7381.  
  7382. FILE *file = fopen( argv[0], "r" );
  7383. off_t offset = ftello( file );
  7384. fseek( file, offset, SEEK_CUR );
  7385. fclose( file );
  7386. return 0;
  7387. }
  7388. #endif
  7389.  
  7390. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  7391. /* Collect fundamental type information and save it to a CMake script. */
  7392.  
  7393. /* Include limits.h to get macros indicating long long and __int64.
  7394. Note that certain compilers need special macros to define these
  7395. macros in limits.h. */
  7396. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  7397. # define _MSC_EXTENSIONS
  7398. #endif
  7399. #if defined(__GNUC__) && __GNUC__ < 3
  7400. # define _GNU_SOURCE
  7401. #endif
  7402. #include <limits.h>
  7403.  
  7404. #include <stdio.h>
  7405. #include <string.h>
  7406.  
  7407. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  7408. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  7409. and sometimes not. This macro will make sure the value is treated
  7410. as a double-quoted string. */
  7411. #define TO_STRING(x) TO_STRING0(x)
  7412. #define TO_STRING0(x) TO_STRING1(x)
  7413. #define TO_STRING1(x) #x
  7414.  
  7415. void f() {}
  7416.  
  7417. int main()
  7418. {
  7419. /* Construct the output file name. Some preprocessors will add an
  7420. extra level of double quotes, so strip them. */
  7421. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  7422. char* fname = fbuf;
  7423. if(fname[0] == '"')
  7424. {
  7425. ++fname;
  7426. int len = static_cast<int>(strlen(fname));
  7427. if(len > 0 && fname[len-1] == '"')
  7428. {
  7429. fname[len-1] = 0;
  7430. }
  7431. }
  7432.  
  7433. /* Try to open the output file. */
  7434. if(FILE* fout = fopen(fname, "w"))
  7435. {
  7436. /* Set the size of standard types. */
  7437. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  7438. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  7439. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  7440. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  7441.  
  7442. /* Set the size of some non-standard but common types. */
  7443. /* Check for a limits.h macro for long long to see if the type exists. */
  7444. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  7445. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  7446. #else
  7447. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  7448. #endif
  7449. /* Check for a limits.h macro for __int64 to see if the type exists. */
  7450. #if defined(_I64_MIN)
  7451. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  7452. #else
  7453. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  7454. #endif
  7455.  
  7456. /* Set the size of some pointer types. */
  7457. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  7458. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  7459.  
  7460. /* Set whether the native type "char" is signed or unsigned. */
  7461. unsigned char uc = 255;
  7462. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  7463. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  7464.  
  7465. fclose(fout);
  7466. return 0;
  7467. }
  7468. else
  7469. {
  7470. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  7471. fname);
  7472. return 1;
  7473. }
  7474. }
  7475. #endif
  7476. ------------------------------------------
  7477. Test succeded
  7478. Try: i686-pc-linux-gnu-g++
  7479. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  7480. ---------- file -----------------------
  7481. /*============================================================================
  7482. KWSys - Kitware System Library
  7483. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  7484.  
  7485. Distributed under the OSI-approved BSD License (the "License");
  7486. see accompanying file Copyright.txt for details.
  7487.  
  7488. This software is distributed WITHOUT ANY WARRANTY; without even the
  7489. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  7490. See the License for more information.
  7491. ============================================================================*/
  7492. // Setup for tests that use result of stl namespace test.
  7493. #if defined(KWSYS_STL_HAVE_STD)
  7494. # if KWSYS_STL_HAVE_STD
  7495. # define kwsys_stl std
  7496. # else
  7497. # define kwsys_stl
  7498. # endif
  7499. #endif
  7500.  
  7501. // Setup for tests that use iostreams.
  7502. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  7503. # if defined(_MSC_VER)
  7504. # pragma warning (push,1)
  7505. # endif
  7506. # if KWSYS_IOS_USE_ANSI
  7507. # include <iostream>
  7508. # else
  7509. # include <iostream.h>
  7510. # endif
  7511. # if defined(_MSC_VER)
  7512. # pragma warning (pop)
  7513. # endif
  7514. # if KWSYS_IOS_HAVE_STD
  7515. # define kwsys_ios std
  7516. # else
  7517. # define kwsys_ios
  7518. # endif
  7519. #endif
  7520.  
  7521. #ifdef TEST_KWSYS_STL_HAVE_STD
  7522. #include <list>
  7523. void f(std ::list<int>*) {}
  7524. int main() { return 0; }
  7525. #endif
  7526.  
  7527. #ifdef TEST_KWSYS_IOS_USE_ANSI
  7528. #include <iosfwd>
  7529. int main() { return 0; }
  7530. #endif
  7531.  
  7532. #ifdef TEST_KWSYS_LFS_SUPPORT
  7533. #define _LARGE_FILES
  7534. #include <iostream>
  7535. int main() { return 0; }
  7536. #endif
  7537.  
  7538.  
  7539. #ifdef TEST_KWSYS_IOS_HAVE_STD
  7540. #include <iosfwd>
  7541. void f(std ::ostream*) {}
  7542. int main() { return 0; }
  7543. #endif
  7544.  
  7545. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  7546. #include <sstream>
  7547. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  7548. # error "GCC 2.96 stringstream is buggy"
  7549. #endif
  7550. int main()
  7551. {
  7552. std ::ostringstream ostr;
  7553. ostr << "hello";
  7554. if(ostr.str().size() == 5)
  7555. {
  7556. return 0;
  7557. }
  7558. return -1;
  7559. }
  7560. #endif
  7561.  
  7562. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  7563. #include <strstream.h>
  7564. int main() { return 0; }
  7565. #endif
  7566.  
  7567. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  7568. #include <strstrea.h>
  7569. int main() { return 0; }
  7570. #endif
  7571.  
  7572. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  7573. # include <iostream.h>
  7574. # include <string>
  7575. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  7576. int main() { return 0; }
  7577. #endif
  7578.  
  7579. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  7580. # include <iostream.h>
  7581. # include <string>
  7582. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  7583. int main() { return 0; }
  7584. #endif
  7585.  
  7586. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  7587. # include <string>
  7588. bool f(const kwsys_stl::string& s) { return s != ""; }
  7589. int main() { return 0; }
  7590. #endif
  7591.  
  7592. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  7593. #include <cstdio>
  7594. int main() { return 0; }
  7595. #endif
  7596.  
  7597. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  7598. #include <cstddef>
  7599. void f(size_t) {}
  7600. int main() { return 0; }
  7601. #endif
  7602.  
  7603. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  7604. long long f(long long n) { return n; }
  7605. int main()
  7606. {
  7607. long long n = 0;
  7608. return static_cast<int>(f(n));
  7609. }
  7610. #endif
  7611.  
  7612. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  7613. template <class T> class A;
  7614. template <class T> int f(A<T>&);
  7615. template <class T> class A
  7616. {
  7617. public:
  7618. // "friend int f<>(A<T>&)" would conform
  7619. friend int f(A<T>&);
  7620. private:
  7621. int x;
  7622. };
  7623.  
  7624. template <class T> int f(A<T>& a) { return a.x = 0; }
  7625. template int f(A<int>&);
  7626.  
  7627. int main()
  7628. {
  7629. A<int> a;
  7630. return f(a);
  7631. }
  7632. #endif
  7633.  
  7634. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  7635. template <class U>
  7636. class A
  7637. {
  7638. public:
  7639. U u;
  7640. A(): u(0) {}
  7641. template <class V> V m(V* p) { return *p = u; }
  7642. };
  7643.  
  7644. int main()
  7645. {
  7646. A<short> a;
  7647. int s = 1;
  7648. return a.m(&s);
  7649. }
  7650. #endif
  7651.  
  7652. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  7653. template <class T> struct A {};
  7654. template <> struct A<int*>
  7655. {
  7656. static int f() { return 0; }
  7657. };
  7658. int main() { return A<int*>::f(); }
  7659. #endif
  7660.  
  7661. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  7662. namespace N
  7663. {
  7664. class A {};
  7665. int f(A*) { return 0; }
  7666. }
  7667. void f(void*);
  7668. int main()
  7669. {
  7670. N::A* a = 0;
  7671. return f(a);
  7672. }
  7673. #endif
  7674.  
  7675. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  7676. #include <iterator>
  7677. #include <list>
  7678. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  7679. int main() { return 0; }
  7680. #endif
  7681.  
  7682. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  7683. #include <iterator>
  7684. #include <list>
  7685. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  7686. int main() { return 0; }
  7687. #endif
  7688.  
  7689. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  7690. #include <iterator>
  7691. #include <list>
  7692. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  7693. int main() { return 0; }
  7694. #endif
  7695.  
  7696. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  7697. #include <memory>
  7698. template <class Alloc>
  7699. void f(const Alloc&)
  7700. {
  7701. typedef typename Alloc::size_type alloc_size_type;
  7702. }
  7703. int main()
  7704. {
  7705. f(kwsys_stl::allocator<char>());
  7706. return 0;
  7707. }
  7708. #endif
  7709.  
  7710. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  7711. #include <memory>
  7712. void f(kwsys_stl::allocator::size_type const&) {}
  7713. int main() { return 0; }
  7714. #endif
  7715.  
  7716. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  7717. #include <memory>
  7718. template <class T, class Alloc>
  7719. void f(const T&, const Alloc&)
  7720. {
  7721. typedef typename Alloc::template rebind<T>::other alloc_type;
  7722. }
  7723. int main()
  7724. {
  7725. f(0, kwsys_stl::allocator<char>());
  7726. return 0;
  7727. }
  7728. #endif
  7729.  
  7730. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  7731. #include <memory>
  7732. void f(kwsys_stl::allocator<char> const& a)
  7733. {
  7734. a.max_size(sizeof(int));
  7735. }
  7736. int main()
  7737. {
  7738. f(kwsys_stl::allocator<char>());
  7739. return 0;
  7740. }
  7741. #endif
  7742.  
  7743. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  7744. #include <vector>
  7745. void f(kwsys_stl::vector<int> const& v1)
  7746. {
  7747. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  7748. }
  7749. int main()
  7750. {
  7751. f(kwsys_stl::vector<int>());
  7752. return 0;
  7753. }
  7754. #endif
  7755.  
  7756. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  7757. #include <sys/types.h>
  7758. #include <sys/stat.h>
  7759. #include <unistd.h>
  7760. int main()
  7761. {
  7762. struct stat stat1;
  7763. (void)stat1.st_mtim.tv_sec;
  7764. (void)stat1.st_mtim.tv_nsec;
  7765. return 0;
  7766. }
  7767. #endif
  7768.  
  7769. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  7770. void function(long**) {}
  7771. int main()
  7772. {
  7773. __int64** p = 0;
  7774. function(p);
  7775. return 0;
  7776. }
  7777. #endif
  7778.  
  7779. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  7780. void function(long long**) {}
  7781. int main()
  7782. {
  7783. __int64** p = 0;
  7784. function(p);
  7785. return 0;
  7786. }
  7787. #endif
  7788.  
  7789. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  7790. void function(double& l, unsigned __int64 const& r)
  7791. {
  7792. l = static_cast<double>(r);
  7793. }
  7794.  
  7795. int main()
  7796. {
  7797. double tTo = 0.0;
  7798. unsigned __int64 tFrom = 0;
  7799. function(tTo, tFrom);
  7800. return 0;
  7801. }
  7802. #endif
  7803.  
  7804. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  7805. int test_binary(int, ...)
  7806. {
  7807. return 0;
  7808. }
  7809. int main()
  7810. {
  7811. return test_binary(1, kwsys_ios::ios::binary);
  7812. }
  7813. #endif
  7814.  
  7815. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  7816. int test_istream(kwsys_ios::istream& is, long long& x)
  7817. {
  7818. return (is >> x)? 1:0;
  7819. }
  7820. int main()
  7821. {
  7822. long long x = 0;
  7823. return test_istream(kwsys_ios::cin, x);
  7824. }
  7825. #endif
  7826.  
  7827. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  7828. int test_ostream(kwsys_ios::ostream& os, long long x)
  7829. {
  7830. return (os << x)? 1:0;
  7831. }
  7832. int main()
  7833. {
  7834. long long x = 0;
  7835. return test_ostream(kwsys_ios::cout, x);
  7836. }
  7837. #endif
  7838.  
  7839. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  7840. /* Return 0 for char signed and 1 for char unsigned. */
  7841. int main()
  7842. {
  7843. unsigned char uc = 255;
  7844. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  7845. }
  7846. #endif
  7847.  
  7848. #ifdef TEST_KWSYS_LFS_WORKS
  7849. /* Return 0 when LFS is available and 1 otherwise. */
  7850. #define _LARGEFILE_SOURCE
  7851. #define _LARGEFILE64_SOURCE
  7852. #define _LARGE_FILES
  7853. #define _FILE_OFFSET_BITS 64
  7854. #include <sys/types.h>
  7855. #include <sys/stat.h>
  7856. #include <assert.h>
  7857. #if KWSYS_CXX_HAS_CSTDIO
  7858. # include <cstdio>
  7859. #endif
  7860. #include <stdio.h>
  7861.  
  7862. int main(int, char **argv)
  7863. {
  7864. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  7865. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  7866. if (OFF_T_64 % 2147483647 != 1)
  7867. return 1;
  7868.  
  7869. // stat breaks on SCO OpenServer
  7870. struct stat buf;
  7871. stat( argv[0], &buf );
  7872. if (!S_ISREG(buf.st_mode))
  7873. return 2;
  7874.  
  7875. FILE *file = fopen( argv[0], "r" );
  7876. off_t offset = ftello( file );
  7877. fseek( file, offset, SEEK_CUR );
  7878. fclose( file );
  7879. return 0;
  7880. }
  7881. #endif
  7882.  
  7883. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  7884. /* Collect fundamental type information and save it to a CMake script. */
  7885.  
  7886. /* Include limits.h to get macros indicating long long and __int64.
  7887. Note that certain compilers need special macros to define these
  7888. macros in limits.h. */
  7889. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  7890. # define _MSC_EXTENSIONS
  7891. #endif
  7892. #if defined(__GNUC__) && __GNUC__ < 3
  7893. # define _GNU_SOURCE
  7894. #endif
  7895. #include <limits.h>
  7896.  
  7897. #include <stdio.h>
  7898. #include <string.h>
  7899.  
  7900. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  7901. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  7902. and sometimes not. This macro will make sure the value is treated
  7903. as a double-quoted string. */
  7904. #define TO_STRING(x) TO_STRING0(x)
  7905. #define TO_STRING0(x) TO_STRING1(x)
  7906. #define TO_STRING1(x) #x
  7907.  
  7908. void f() {}
  7909.  
  7910. int main()
  7911. {
  7912. /* Construct the output file name. Some preprocessors will add an
  7913. extra level of double quotes, so strip them. */
  7914. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  7915. char* fname = fbuf;
  7916. if(fname[0] == '"')
  7917. {
  7918. ++fname;
  7919. int len = static_cast<int>(strlen(fname));
  7920. if(len > 0 && fname[len-1] == '"')
  7921. {
  7922. fname[len-1] = 0;
  7923. }
  7924. }
  7925.  
  7926. /* Try to open the output file. */
  7927. if(FILE* fout = fopen(fname, "w"))
  7928. {
  7929. /* Set the size of standard types. */
  7930. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  7931. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  7932. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  7933. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  7934.  
  7935. /* Set the size of some non-standard but common types. */
  7936. /* Check for a limits.h macro for long long to see if the type exists. */
  7937. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  7938. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  7939. #else
  7940. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  7941. #endif
  7942. /* Check for a limits.h macro for __int64 to see if the type exists. */
  7943. #if defined(_I64_MIN)
  7944. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  7945. #else
  7946. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  7947. #endif
  7948.  
  7949. /* Set the size of some pointer types. */
  7950. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  7951. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  7952.  
  7953. /* Set whether the native type "char" is signed or unsigned. */
  7954. unsigned char uc = 255;
  7955. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  7956. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  7957.  
  7958. fclose(fout);
  7959. return 0;
  7960. }
  7961. else
  7962. {
  7963. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  7964. fname);
  7965. return 1;
  7966. }
  7967. }
  7968. #endif
  7969. ------------------------------------------
  7970. Test succeded
  7971. Try: i686-pc-linux-gnu-g++
  7972. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_STAT_HAS_ST_MTIM /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  7973. ---------- file -----------------------
  7974. /*============================================================================
  7975. KWSys - Kitware System Library
  7976. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  7977.  
  7978. Distributed under the OSI-approved BSD License (the "License");
  7979. see accompanying file Copyright.txt for details.
  7980.  
  7981. This software is distributed WITHOUT ANY WARRANTY; without even the
  7982. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  7983. See the License for more information.
  7984. ============================================================================*/
  7985. // Setup for tests that use result of stl namespace test.
  7986. #if defined(KWSYS_STL_HAVE_STD)
  7987. # if KWSYS_STL_HAVE_STD
  7988. # define kwsys_stl std
  7989. # else
  7990. # define kwsys_stl
  7991. # endif
  7992. #endif
  7993.  
  7994. // Setup for tests that use iostreams.
  7995. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  7996. # if defined(_MSC_VER)
  7997. # pragma warning (push,1)
  7998. # endif
  7999. # if KWSYS_IOS_USE_ANSI
  8000. # include <iostream>
  8001. # else
  8002. # include <iostream.h>
  8003. # endif
  8004. # if defined(_MSC_VER)
  8005. # pragma warning (pop)
  8006. # endif
  8007. # if KWSYS_IOS_HAVE_STD
  8008. # define kwsys_ios std
  8009. # else
  8010. # define kwsys_ios
  8011. # endif
  8012. #endif
  8013.  
  8014. #ifdef TEST_KWSYS_STL_HAVE_STD
  8015. #include <list>
  8016. void f(std ::list<int>*) {}
  8017. int main() { return 0; }
  8018. #endif
  8019.  
  8020. #ifdef TEST_KWSYS_IOS_USE_ANSI
  8021. #include <iosfwd>
  8022. int main() { return 0; }
  8023. #endif
  8024.  
  8025. #ifdef TEST_KWSYS_LFS_SUPPORT
  8026. #define _LARGE_FILES
  8027. #include <iostream>
  8028. int main() { return 0; }
  8029. #endif
  8030.  
  8031.  
  8032. #ifdef TEST_KWSYS_IOS_HAVE_STD
  8033. #include <iosfwd>
  8034. void f(std ::ostream*) {}
  8035. int main() { return 0; }
  8036. #endif
  8037.  
  8038. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  8039. #include <sstream>
  8040. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  8041. # error "GCC 2.96 stringstream is buggy"
  8042. #endif
  8043. int main()
  8044. {
  8045. std ::ostringstream ostr;
  8046. ostr << "hello";
  8047. if(ostr.str().size() == 5)
  8048. {
  8049. return 0;
  8050. }
  8051. return -1;
  8052. }
  8053. #endif
  8054.  
  8055. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  8056. #include <strstream.h>
  8057. int main() { return 0; }
  8058. #endif
  8059.  
  8060. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  8061. #include <strstrea.h>
  8062. int main() { return 0; }
  8063. #endif
  8064.  
  8065. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  8066. # include <iostream.h>
  8067. # include <string>
  8068. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  8069. int main() { return 0; }
  8070. #endif
  8071.  
  8072. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  8073. # include <iostream.h>
  8074. # include <string>
  8075. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  8076. int main() { return 0; }
  8077. #endif
  8078.  
  8079. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  8080. # include <string>
  8081. bool f(const kwsys_stl::string& s) { return s != ""; }
  8082. int main() { return 0; }
  8083. #endif
  8084.  
  8085. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  8086. #include <cstdio>
  8087. int main() { return 0; }
  8088. #endif
  8089.  
  8090. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  8091. #include <cstddef>
  8092. void f(size_t) {}
  8093. int main() { return 0; }
  8094. #endif
  8095.  
  8096. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  8097. long long f(long long n) { return n; }
  8098. int main()
  8099. {
  8100. long long n = 0;
  8101. return static_cast<int>(f(n));
  8102. }
  8103. #endif
  8104.  
  8105. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  8106. template <class T> class A;
  8107. template <class T> int f(A<T>&);
  8108. template <class T> class A
  8109. {
  8110. public:
  8111. // "friend int f<>(A<T>&)" would conform
  8112. friend int f(A<T>&);
  8113. private:
  8114. int x;
  8115. };
  8116.  
  8117. template <class T> int f(A<T>& a) { return a.x = 0; }
  8118. template int f(A<int>&);
  8119.  
  8120. int main()
  8121. {
  8122. A<int> a;
  8123. return f(a);
  8124. }
  8125. #endif
  8126.  
  8127. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  8128. template <class U>
  8129. class A
  8130. {
  8131. public:
  8132. U u;
  8133. A(): u(0) {}
  8134. template <class V> V m(V* p) { return *p = u; }
  8135. };
  8136.  
  8137. int main()
  8138. {
  8139. A<short> a;
  8140. int s = 1;
  8141. return a.m(&s);
  8142. }
  8143. #endif
  8144.  
  8145. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  8146. template <class T> struct A {};
  8147. template <> struct A<int*>
  8148. {
  8149. static int f() { return 0; }
  8150. };
  8151. int main() { return A<int*>::f(); }
  8152. #endif
  8153.  
  8154. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  8155. namespace N
  8156. {
  8157. class A {};
  8158. int f(A*) { return 0; }
  8159. }
  8160. void f(void*);
  8161. int main()
  8162. {
  8163. N::A* a = 0;
  8164. return f(a);
  8165. }
  8166. #endif
  8167.  
  8168. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  8169. #include <iterator>
  8170. #include <list>
  8171. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  8172. int main() { return 0; }
  8173. #endif
  8174.  
  8175. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  8176. #include <iterator>
  8177. #include <list>
  8178. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  8179. int main() { return 0; }
  8180. #endif
  8181.  
  8182. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  8183. #include <iterator>
  8184. #include <list>
  8185. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  8186. int main() { return 0; }
  8187. #endif
  8188.  
  8189. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  8190. #include <memory>
  8191. template <class Alloc>
  8192. void f(const Alloc&)
  8193. {
  8194. typedef typename Alloc::size_type alloc_size_type;
  8195. }
  8196. int main()
  8197. {
  8198. f(kwsys_stl::allocator<char>());
  8199. return 0;
  8200. }
  8201. #endif
  8202.  
  8203. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  8204. #include <memory>
  8205. void f(kwsys_stl::allocator::size_type const&) {}
  8206. int main() { return 0; }
  8207. #endif
  8208.  
  8209. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  8210. #include <memory>
  8211. template <class T, class Alloc>
  8212. void f(const T&, const Alloc&)
  8213. {
  8214. typedef typename Alloc::template rebind<T>::other alloc_type;
  8215. }
  8216. int main()
  8217. {
  8218. f(0, kwsys_stl::allocator<char>());
  8219. return 0;
  8220. }
  8221. #endif
  8222.  
  8223. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  8224. #include <memory>
  8225. void f(kwsys_stl::allocator<char> const& a)
  8226. {
  8227. a.max_size(sizeof(int));
  8228. }
  8229. int main()
  8230. {
  8231. f(kwsys_stl::allocator<char>());
  8232. return 0;
  8233. }
  8234. #endif
  8235.  
  8236. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  8237. #include <vector>
  8238. void f(kwsys_stl::vector<int> const& v1)
  8239. {
  8240. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  8241. }
  8242. int main()
  8243. {
  8244. f(kwsys_stl::vector<int>());
  8245. return 0;
  8246. }
  8247. #endif
  8248.  
  8249. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  8250. #include <sys/types.h>
  8251. #include <sys/stat.h>
  8252. #include <unistd.h>
  8253. int main()
  8254. {
  8255. struct stat stat1;
  8256. (void)stat1.st_mtim.tv_sec;
  8257. (void)stat1.st_mtim.tv_nsec;
  8258. return 0;
  8259. }
  8260. #endif
  8261.  
  8262. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  8263. void function(long**) {}
  8264. int main()
  8265. {
  8266. __int64** p = 0;
  8267. function(p);
  8268. return 0;
  8269. }
  8270. #endif
  8271.  
  8272. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  8273. void function(long long**) {}
  8274. int main()
  8275. {
  8276. __int64** p = 0;
  8277. function(p);
  8278. return 0;
  8279. }
  8280. #endif
  8281.  
  8282. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  8283. void function(double& l, unsigned __int64 const& r)
  8284. {
  8285. l = static_cast<double>(r);
  8286. }
  8287.  
  8288. int main()
  8289. {
  8290. double tTo = 0.0;
  8291. unsigned __int64 tFrom = 0;
  8292. function(tTo, tFrom);
  8293. return 0;
  8294. }
  8295. #endif
  8296.  
  8297. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  8298. int test_binary(int, ...)
  8299. {
  8300. return 0;
  8301. }
  8302. int main()
  8303. {
  8304. return test_binary(1, kwsys_ios::ios::binary);
  8305. }
  8306. #endif
  8307.  
  8308. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  8309. int test_istream(kwsys_ios::istream& is, long long& x)
  8310. {
  8311. return (is >> x)? 1:0;
  8312. }
  8313. int main()
  8314. {
  8315. long long x = 0;
  8316. return test_istream(kwsys_ios::cin, x);
  8317. }
  8318. #endif
  8319.  
  8320. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  8321. int test_ostream(kwsys_ios::ostream& os, long long x)
  8322. {
  8323. return (os << x)? 1:0;
  8324. }
  8325. int main()
  8326. {
  8327. long long x = 0;
  8328. return test_ostream(kwsys_ios::cout, x);
  8329. }
  8330. #endif
  8331.  
  8332. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  8333. /* Return 0 for char signed and 1 for char unsigned. */
  8334. int main()
  8335. {
  8336. unsigned char uc = 255;
  8337. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  8338. }
  8339. #endif
  8340.  
  8341. #ifdef TEST_KWSYS_LFS_WORKS
  8342. /* Return 0 when LFS is available and 1 otherwise. */
  8343. #define _LARGEFILE_SOURCE
  8344. #define _LARGEFILE64_SOURCE
  8345. #define _LARGE_FILES
  8346. #define _FILE_OFFSET_BITS 64
  8347. #include <sys/types.h>
  8348. #include <sys/stat.h>
  8349. #include <assert.h>
  8350. #if KWSYS_CXX_HAS_CSTDIO
  8351. # include <cstdio>
  8352. #endif
  8353. #include <stdio.h>
  8354.  
  8355. int main(int, char **argv)
  8356. {
  8357. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  8358. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  8359. if (OFF_T_64 % 2147483647 != 1)
  8360. return 1;
  8361.  
  8362. // stat breaks on SCO OpenServer
  8363. struct stat buf;
  8364. stat( argv[0], &buf );
  8365. if (!S_ISREG(buf.st_mode))
  8366. return 2;
  8367.  
  8368. FILE *file = fopen( argv[0], "r" );
  8369. off_t offset = ftello( file );
  8370. fseek( file, offset, SEEK_CUR );
  8371. fclose( file );
  8372. return 0;
  8373. }
  8374. #endif
  8375.  
  8376. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  8377. /* Collect fundamental type information and save it to a CMake script. */
  8378.  
  8379. /* Include limits.h to get macros indicating long long and __int64.
  8380. Note that certain compilers need special macros to define these
  8381. macros in limits.h. */
  8382. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  8383. # define _MSC_EXTENSIONS
  8384. #endif
  8385. #if defined(__GNUC__) && __GNUC__ < 3
  8386. # define _GNU_SOURCE
  8387. #endif
  8388. #include <limits.h>
  8389.  
  8390. #include <stdio.h>
  8391. #include <string.h>
  8392.  
  8393. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  8394. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  8395. and sometimes not. This macro will make sure the value is treated
  8396. as a double-quoted string. */
  8397. #define TO_STRING(x) TO_STRING0(x)
  8398. #define TO_STRING0(x) TO_STRING1(x)
  8399. #define TO_STRING1(x) #x
  8400.  
  8401. void f() {}
  8402.  
  8403. int main()
  8404. {
  8405. /* Construct the output file name. Some preprocessors will add an
  8406. extra level of double quotes, so strip them. */
  8407. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  8408. char* fname = fbuf;
  8409. if(fname[0] == '"')
  8410. {
  8411. ++fname;
  8412. int len = static_cast<int>(strlen(fname));
  8413. if(len > 0 && fname[len-1] == '"')
  8414. {
  8415. fname[len-1] = 0;
  8416. }
  8417. }
  8418.  
  8419. /* Try to open the output file. */
  8420. if(FILE* fout = fopen(fname, "w"))
  8421. {
  8422. /* Set the size of standard types. */
  8423. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  8424. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  8425. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  8426. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  8427.  
  8428. /* Set the size of some non-standard but common types. */
  8429. /* Check for a limits.h macro for long long to see if the type exists. */
  8430. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  8431. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  8432. #else
  8433. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  8434. #endif
  8435. /* Check for a limits.h macro for __int64 to see if the type exists. */
  8436. #if defined(_I64_MIN)
  8437. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  8438. #else
  8439. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  8440. #endif
  8441.  
  8442. /* Set the size of some pointer types. */
  8443. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  8444. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  8445.  
  8446. /* Set whether the native type "char" is signed or unsigned. */
  8447. unsigned char uc = 255;
  8448. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  8449. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  8450.  
  8451. fclose(fout);
  8452. return 0;
  8453. }
  8454. else
  8455. {
  8456. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  8457. fname);
  8458. return 1;
  8459. }
  8460. }
  8461. #endif
  8462. ------------------------------------------
  8463. Test succeded
  8464. Try: i686-pc-linux-gnu-g++
  8465. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe -DTEST_KWSYS_IOS_HAVE_BINARY -DKWSYS_IOS_USE_ANSI=1 -DKWSYS_IOS_HAVE_STD=1 /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_655_test
  8466. ---------- file -----------------------
  8467. /*============================================================================
  8468. KWSys - Kitware System Library
  8469. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  8470.  
  8471. Distributed under the OSI-approved BSD License (the "License");
  8472. see accompanying file Copyright.txt for details.
  8473.  
  8474. This software is distributed WITHOUT ANY WARRANTY; without even the
  8475. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8476. See the License for more information.
  8477. ============================================================================*/
  8478. // Setup for tests that use result of stl namespace test.
  8479. #if defined(KWSYS_STL_HAVE_STD)
  8480. # if KWSYS_STL_HAVE_STD
  8481. # define kwsys_stl std
  8482. # else
  8483. # define kwsys_stl
  8484. # endif
  8485. #endif
  8486.  
  8487. // Setup for tests that use iostreams.
  8488. #if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
  8489. # if defined(_MSC_VER)
  8490. # pragma warning (push,1)
  8491. # endif
  8492. # if KWSYS_IOS_USE_ANSI
  8493. # include <iostream>
  8494. # else
  8495. # include <iostream.h>
  8496. # endif
  8497. # if defined(_MSC_VER)
  8498. # pragma warning (pop)
  8499. # endif
  8500. # if KWSYS_IOS_HAVE_STD
  8501. # define kwsys_ios std
  8502. # else
  8503. # define kwsys_ios
  8504. # endif
  8505. #endif
  8506.  
  8507. #ifdef TEST_KWSYS_STL_HAVE_STD
  8508. #include <list>
  8509. void f(std ::list<int>*) {}
  8510. int main() { return 0; }
  8511. #endif
  8512.  
  8513. #ifdef TEST_KWSYS_IOS_USE_ANSI
  8514. #include <iosfwd>
  8515. int main() { return 0; }
  8516. #endif
  8517.  
  8518. #ifdef TEST_KWSYS_LFS_SUPPORT
  8519. #define _LARGE_FILES
  8520. #include <iostream>
  8521. int main() { return 0; }
  8522. #endif
  8523.  
  8524.  
  8525. #ifdef TEST_KWSYS_IOS_HAVE_STD
  8526. #include <iosfwd>
  8527. void f(std ::ostream*) {}
  8528. int main() { return 0; }
  8529. #endif
  8530.  
  8531. #ifdef TEST_KWSYS_IOS_USE_SSTREAM
  8532. #include <sstream>
  8533. #if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
  8534. # error "GCC 2.96 stringstream is buggy"
  8535. #endif
  8536. int main()
  8537. {
  8538. std ::ostringstream ostr;
  8539. ostr << "hello";
  8540. if(ostr.str().size() == 5)
  8541. {
  8542. return 0;
  8543. }
  8544. return -1;
  8545. }
  8546. #endif
  8547.  
  8548. #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
  8549. #include <strstream.h>
  8550. int main() { return 0; }
  8551. #endif
  8552.  
  8553. #ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
  8554. #include <strstrea.h>
  8555. int main() { return 0; }
  8556. #endif
  8557.  
  8558. #ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
  8559. # include <iostream.h>
  8560. # include <string>
  8561. void f(ostream& os, const kwsys_stl::string& s) { os << s; }
  8562. int main() { return 0; }
  8563. #endif
  8564.  
  8565. #ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
  8566. # include <iostream.h>
  8567. # include <string>
  8568. void f(istream& is, kwsys_stl::string& s) { is >> s; }
  8569. int main() { return 0; }
  8570. #endif
  8571.  
  8572. #ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
  8573. # include <string>
  8574. bool f(const kwsys_stl::string& s) { return s != ""; }
  8575. int main() { return 0; }
  8576. #endif
  8577.  
  8578. #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
  8579. #include <cstdio>
  8580. int main() { return 0; }
  8581. #endif
  8582.  
  8583. #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
  8584. #include <cstddef>
  8585. void f(size_t) {}
  8586. int main() { return 0; }
  8587. #endif
  8588.  
  8589. #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
  8590. long long f(long long n) { return n; }
  8591. int main()
  8592. {
  8593. long long n = 0;
  8594. return static_cast<int>(f(n));
  8595. }
  8596. #endif
  8597.  
  8598. #ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
  8599. template <class T> class A;
  8600. template <class T> int f(A<T>&);
  8601. template <class T> class A
  8602. {
  8603. public:
  8604. // "friend int f<>(A<T>&)" would conform
  8605. friend int f(A<T>&);
  8606. private:
  8607. int x;
  8608. };
  8609.  
  8610. template <class T> int f(A<T>& a) { return a.x = 0; }
  8611. template int f(A<int>&);
  8612.  
  8613. int main()
  8614. {
  8615. A<int> a;
  8616. return f(a);
  8617. }
  8618. #endif
  8619.  
  8620. #ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
  8621. template <class U>
  8622. class A
  8623. {
  8624. public:
  8625. U u;
  8626. A(): u(0) {}
  8627. template <class V> V m(V* p) { return *p = u; }
  8628. };
  8629.  
  8630. int main()
  8631. {
  8632. A<short> a;
  8633. int s = 1;
  8634. return a.m(&s);
  8635. }
  8636. #endif
  8637.  
  8638. #ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
  8639. template <class T> struct A {};
  8640. template <> struct A<int*>
  8641. {
  8642. static int f() { return 0; }
  8643. };
  8644. int main() { return A<int*>::f(); }
  8645. #endif
  8646.  
  8647. #ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
  8648. namespace N
  8649. {
  8650. class A {};
  8651. int f(A*) { return 0; }
  8652. }
  8653. void f(void*);
  8654. int main()
  8655. {
  8656. N::A* a = 0;
  8657. return f(a);
  8658. }
  8659. #endif
  8660.  
  8661. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
  8662. #include <iterator>
  8663. #include <list>
  8664. void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
  8665. int main() { return 0; }
  8666. #endif
  8667.  
  8668. #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
  8669. #include <iterator>
  8670. #include <list>
  8671. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
  8672. int main() { return 0; }
  8673. #endif
  8674.  
  8675. #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
  8676. #include <iterator>
  8677. #include <list>
  8678. void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
  8679. int main() { return 0; }
  8680. #endif
  8681.  
  8682. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
  8683. #include <memory>
  8684. template <class Alloc>
  8685. void f(const Alloc&)
  8686. {
  8687. typedef typename Alloc::size_type alloc_size_type;
  8688. }
  8689. int main()
  8690. {
  8691. f(kwsys_stl::allocator<char>());
  8692. return 0;
  8693. }
  8694. #endif
  8695.  
  8696. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
  8697. #include <memory>
  8698. void f(kwsys_stl::allocator::size_type const&) {}
  8699. int main() { return 0; }
  8700. #endif
  8701.  
  8702. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
  8703. #include <memory>
  8704. template <class T, class Alloc>
  8705. void f(const T&, const Alloc&)
  8706. {
  8707. typedef typename Alloc::template rebind<T>::other alloc_type;
  8708. }
  8709. int main()
  8710. {
  8711. f(0, kwsys_stl::allocator<char>());
  8712. return 0;
  8713. }
  8714. #endif
  8715.  
  8716. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
  8717. #include <memory>
  8718. void f(kwsys_stl::allocator<char> const& a)
  8719. {
  8720. a.max_size(sizeof(int));
  8721. }
  8722. int main()
  8723. {
  8724. f(kwsys_stl::allocator<char>());
  8725. return 0;
  8726. }
  8727. #endif
  8728.  
  8729. #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
  8730. #include <vector>
  8731. void f(kwsys_stl::vector<int> const& v1)
  8732. {
  8733. kwsys_stl::vector<int>(1, 1, v1.get_allocator());
  8734. }
  8735. int main()
  8736. {
  8737. f(kwsys_stl::vector<int>());
  8738. return 0;
  8739. }
  8740. #endif
  8741.  
  8742. #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
  8743. #include <sys/types.h>
  8744. #include <sys/stat.h>
  8745. #include <unistd.h>
  8746. int main()
  8747. {
  8748. struct stat stat1;
  8749. (void)stat1.st_mtim.tv_sec;
  8750. (void)stat1.st_mtim.tv_nsec;
  8751. return 0;
  8752. }
  8753. #endif
  8754.  
  8755. #ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
  8756. void function(long**) {}
  8757. int main()
  8758. {
  8759. __int64** p = 0;
  8760. function(p);
  8761. return 0;
  8762. }
  8763. #endif
  8764.  
  8765. #ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
  8766. void function(long long**) {}
  8767. int main()
  8768. {
  8769. __int64** p = 0;
  8770. function(p);
  8771. return 0;
  8772. }
  8773. #endif
  8774.  
  8775. #ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
  8776. void function(double& l, unsigned __int64 const& r)
  8777. {
  8778. l = static_cast<double>(r);
  8779. }
  8780.  
  8781. int main()
  8782. {
  8783. double tTo = 0.0;
  8784. unsigned __int64 tFrom = 0;
  8785. function(tTo, tFrom);
  8786. return 0;
  8787. }
  8788. #endif
  8789.  
  8790. #ifdef TEST_KWSYS_IOS_HAVE_BINARY
  8791. int test_binary(int, ...)
  8792. {
  8793. return 0;
  8794. }
  8795. int main()
  8796. {
  8797. return test_binary(1, kwsys_ios::ios::binary);
  8798. }
  8799. #endif
  8800.  
  8801. #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
  8802. int test_istream(kwsys_ios::istream& is, long long& x)
  8803. {
  8804. return (is >> x)? 1:0;
  8805. }
  8806. int main()
  8807. {
  8808. long long x = 0;
  8809. return test_istream(kwsys_ios::cin, x);
  8810. }
  8811. #endif
  8812.  
  8813. #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
  8814. int test_ostream(kwsys_ios::ostream& os, long long x)
  8815. {
  8816. return (os << x)? 1:0;
  8817. }
  8818. int main()
  8819. {
  8820. long long x = 0;
  8821. return test_ostream(kwsys_ios::cout, x);
  8822. }
  8823. #endif
  8824.  
  8825. #ifdef TEST_KWSYS_CHAR_IS_SIGNED
  8826. /* Return 0 for char signed and 1 for char unsigned. */
  8827. int main()
  8828. {
  8829. unsigned char uc = 255;
  8830. return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
  8831. }
  8832. #endif
  8833.  
  8834. #ifdef TEST_KWSYS_LFS_WORKS
  8835. /* Return 0 when LFS is available and 1 otherwise. */
  8836. #define _LARGEFILE_SOURCE
  8837. #define _LARGEFILE64_SOURCE
  8838. #define _LARGE_FILES
  8839. #define _FILE_OFFSET_BITS 64
  8840. #include <sys/types.h>
  8841. #include <sys/stat.h>
  8842. #include <assert.h>
  8843. #if KWSYS_CXX_HAS_CSTDIO
  8844. # include <cstdio>
  8845. #endif
  8846. #include <stdio.h>
  8847.  
  8848. int main(int, char **argv)
  8849. {
  8850. /* check that off_t can hold 2^63 - 1 and perform basic operations... */
  8851. #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  8852. if (OFF_T_64 % 2147483647 != 1)
  8853. return 1;
  8854.  
  8855. // stat breaks on SCO OpenServer
  8856. struct stat buf;
  8857. stat( argv[0], &buf );
  8858. if (!S_ISREG(buf.st_mode))
  8859. return 2;
  8860.  
  8861. FILE *file = fopen( argv[0], "r" );
  8862. off_t offset = ftello( file );
  8863. fseek( file, offset, SEEK_CUR );
  8864. fclose( file );
  8865. return 0;
  8866. }
  8867. #endif
  8868.  
  8869. #ifdef TEST_KWSYS_CXX_TYPE_INFO
  8870. /* Collect fundamental type information and save it to a CMake script. */
  8871.  
  8872. /* Include limits.h to get macros indicating long long and __int64.
  8873. Note that certain compilers need special macros to define these
  8874. macros in limits.h. */
  8875. #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
  8876. # define _MSC_EXTENSIONS
  8877. #endif
  8878. #if defined(__GNUC__) && __GNUC__ < 3
  8879. # define _GNU_SOURCE
  8880. #endif
  8881. #include <limits.h>
  8882.  
  8883. #include <stdio.h>
  8884. #include <string.h>
  8885.  
  8886. /* Due to shell differences and limitations of ADD_DEFINITIONS the
  8887. KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
  8888. and sometimes not. This macro will make sure the value is treated
  8889. as a double-quoted string. */
  8890. #define TO_STRING(x) TO_STRING0(x)
  8891. #define TO_STRING0(x) TO_STRING1(x)
  8892. #define TO_STRING1(x) #x
  8893.  
  8894. void f() {}
  8895.  
  8896. int main()
  8897. {
  8898. /* Construct the output file name. Some preprocessors will add an
  8899. extra level of double quotes, so strip them. */
  8900. char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
  8901. char* fname = fbuf;
  8902. if(fname[0] == '"')
  8903. {
  8904. ++fname;
  8905. int len = static_cast<int>(strlen(fname));
  8906. if(len > 0 && fname[len-1] == '"')
  8907. {
  8908. fname[len-1] = 0;
  8909. }
  8910. }
  8911.  
  8912. /* Try to open the output file. */
  8913. if(FILE* fout = fopen(fname, "w"))
  8914. {
  8915. /* Set the size of standard types. */
  8916. fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
  8917. fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
  8918. fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
  8919. fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
  8920.  
  8921. /* Set the size of some non-standard but common types. */
  8922. /* Check for a limits.h macro for long long to see if the type exists. */
  8923. #if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
  8924. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
  8925. #else
  8926. fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
  8927. #endif
  8928. /* Check for a limits.h macro for __int64 to see if the type exists. */
  8929. #if defined(_I64_MIN)
  8930. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
  8931. #else
  8932. fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
  8933. #endif
  8934.  
  8935. /* Set the size of some pointer types. */
  8936. fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
  8937. fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
  8938.  
  8939. /* Set whether the native type "char" is signed or unsigned. */
  8940. unsigned char uc = 255;
  8941. fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
  8942. (*reinterpret_cast<char*>(&uc) < 0)?1:0);
  8943.  
  8944. fclose(fout);
  8945. return 0;
  8946. }
  8947. else
  8948. {
  8949. fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
  8950. fname);
  8951. return 1;
  8952. }
  8953. }
  8954. #endif
  8955. ------------------------------------------
  8956. Test succeded
  8957. Try: i686-pc-linux-gnu-g++
  8958. Line: i686-pc-linux-gnu-g++ -O2 -march=i686 -pipe /var/tmp/portage/dev-util/cmake-2.8.6-r4/work/cmake-2.8.6/Modules/TestForAnsiForScope.cxx -o cmake_bootstrap_655_test
  8959. ---------- file -----------------------
  8960. int main(int, char*[])
  8961. {
  8962. int i;
  8963. for(int i=0; i < 1; ++i);
  8964. (void)i;
  8965. return 0;
  8966. }
  8967. ------------------------------------------
  8968. Test succeded
Advertisement
Add Comment
Please, Sign In to add comment