summaryrefslogtreecommitdiffstats
path: root/config.tests
diff options
context:
space:
mode:
authorgregory guy <gregory-tde@laposte.net>2021-03-15 15:32:40 +0100
committerSlávek Banko <slavek.banko@axis.cz>2024-03-02 18:52:12 +0100
commit12bd9b6b2bba50da9c3444dfb42b985ed2a6a7c1 (patch)
tree8319b9e98b3fa1f2a2a61d7719eb9a714c7ad66a /config.tests
parent34587584ab80fd696cc9d73dda1326f175125ddf (diff)
downloadtqt3-12bd9b6b2bba50da9c3444dfb42b985ed2a6a7c1.tar.gz
tqt3-12bd9b6b2bba50da9c3444dfb42b985ed2a6a7c1.zip
Conversion to the cmake building system.feat/cmakeConv
Signed-off-by: gregory guy <gregory-tde@laposte.net> Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'config.tests')
-rw-r--r--config.tests/unix/endian/ConfigureChecks.cmake19
-rw-r--r--config.tests/unix/ipv6/ConfigureChecks.cmake33
-rw-r--r--config.tests/unix/largefile/ConfigureChecks.cmake42
-rw-r--r--config.tests/unix/stl/ConfigureChecks.cmake103
4 files changed, 197 insertions, 0 deletions
diff --git a/config.tests/unix/endian/ConfigureChecks.cmake b/config.tests/unix/endian/ConfigureChecks.cmake
new file mode 100644
index 000000000..4fe0006c6
--- /dev/null
+++ b/config.tests/unix/endian/ConfigureChecks.cmake
@@ -0,0 +1,19 @@
+###########################################
+# #
+# Improvements and feedback are welcome #
+# #
+# This file is released under GPL >= 3 #
+# #
+###########################################
+
+
+##### test big/little endian
+
+include(TestBigEndian)
+test_big_endian(WORDS_BIGENDIAN)
+
+if( ${WORDS_BIGENDIAN} )
+ set( _ENDIAN "Q_BIG_ENDIAN" )
+ else()
+ set( _ENDIAN "Q_LITTLE_ENDIAN" )
+endif()
diff --git a/config.tests/unix/ipv6/ConfigureChecks.cmake b/config.tests/unix/ipv6/ConfigureChecks.cmake
new file mode 100644
index 000000000..ca0bbddf0
--- /dev/null
+++ b/config.tests/unix/ipv6/ConfigureChecks.cmake
@@ -0,0 +1,33 @@
+###########################################
+# #
+# Improvements and feedback are welcome #
+# #
+# This file is released under GPL >= 3 #
+# #
+###########################################
+
+
+##### check for IPv6 support
+
+if( NOT WITH_IPV6)
+ set( TQT_NO_IPV6 1 )
+ else()
+ check_cxx_source_compiles("
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+
+ int main()
+ {
+ sockaddr_in6 tmp;
+ sockaddr_storage tmp2;
+ (void)tmp;
+ (void)tmp2;
+ return 0;
+ }"
+ IPV6_SUPPORT)
+
+ if( NOT IPV6_SUPPORT )
+ set( NO_IPV6 TQT_NO_IPV6 )
+ endif()
+endif( NOT WITH_IPV6 )
diff --git a/config.tests/unix/largefile/ConfigureChecks.cmake b/config.tests/unix/largefile/ConfigureChecks.cmake
new file mode 100644
index 000000000..4e0cc4c5d
--- /dev/null
+++ b/config.tests/unix/largefile/ConfigureChecks.cmake
@@ -0,0 +1,42 @@
+###########################################
+# #
+# Improvements and feedback are welcome #
+# #
+# This file is released under GPL >= 3 #
+# #
+###########################################
+
+
+##### check for large file support
+
+check_cxx_source_compiles("
+#define _LARGEFILE_SOURCE
+#define _LARGE_FILES
+#define _FILE_OFFSET_BITS 64
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdio.h>
+
+int main( int, char **argv )
+{
+// check that off_t can hold 2^63 - 1 and perform basic operations...
+#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ if (OFF_T_64 % 2147483647 != 1)
+ return 1;
+
+ // stat breaks on SCO OpenServer
+ struct stat buf;
+ stat( argv[0], &buf );
+ if (!S_ISREG(buf.st_mode))
+ return 2;
+
+ FILE *file = fopen( argv[0], \"r\" );
+ off_t offset = ftello( file );
+ fseek( file, offset, SEEK_CUR );
+ fclose( file );
+ return 0;
+}"
+QT_LARGEFILE_SUPPORT)
diff --git a/config.tests/unix/stl/ConfigureChecks.cmake b/config.tests/unix/stl/ConfigureChecks.cmake
new file mode 100644
index 000000000..7176813b7
--- /dev/null
+++ b/config.tests/unix/stl/ConfigureChecks.cmake
@@ -0,0 +1,103 @@
+###########################################
+# #
+# Improvements and feedback are welcome #
+# #
+# This file is released under GPL >= 3 #
+# #
+###########################################
+
+
+##### check for STL support
+
+if( NOT WITH_STL )
+ set( TQT_NO_STL 1 )
+ else()
+ check_cxx_source_compiles("
+ #include <iterator>
+ #include <map>
+ #include <vector>
+ #include <algorithm>
+ #include <iostream>
+
+ int main()
+ {
+ int rval(0);
+ std::vector<int> v1;
+ v1.push_back(0);
+ v1.push_back(1);
+ v1.push_back(2);
+ v1.push_back(3);
+ v1.push_back(4);
+
+ if ( v1.size() != 5 )
+ {
+ std::cout << \"stltest: vector failed size check, expected 5, got \" << v1.size();
+ ++rval;
+ }
+ if ( v1.capacity() < 5 )
+ {
+ std::cout << \"stltest: vector failed capacity check, expected >= 5, got \" << v1.capacity();
+ ++rval;
+ }
+ std::vector<int>::iterator v1it = std::find( v1.begin(), v1.end(), 99 );
+ if ( v1it != v1.end() )
+ {
+ std::cout << \"stltest: find failed, expected end(), got \" << *v1it;
+ ++rval;
+ }
+ v1it = std::find( v1.begin(), v1.end(), 3 );
+ if ( v1it == v1.end() )
+ {
+ std::cout << \"stltest: find failed, expected to find element, got end()\";
+ ++rval;
+ }
+ std::vector<int> v2;
+ std::copy( v1.begin(), v1it, std::back_inserter( v2 ) );
+ if ( v2.size() != 3 )
+ {
+ std::cout << \"stltest: copy failed, expected 3 elements, got \" << v2.size();
+ ++rval;
+ }
+ std::map<int, double> m1;
+ m1.insert( std::make_pair( 1, 2.0 ) );
+ m1.insert( std::make_pair( 3, 2.0 ) );
+ m1.insert( std::make_pair( 5, 2.0 ) );
+ m1.insert( std::make_pair( 7, 2.0 ) );
+ if ( m1.size() != 4 )
+ {
+ std::cout << \"stltest: map failed size check, expected 4, got \" << m1.size();
+ ++rval;
+ }
+ std::map<int,double>::iterator m1it = m1.begin();
+ for ( ; m1it != m1.end(); ++m1it )
+ {
+ if ( (*m1it).second != 2 )
+ {
+ std::cout << \"stltest: iterator failed, expected 2, got \" << (*m1it).second;
+ ++rval;
+ }
+ }
+ std::map< int, double > m2( m1 );
+ if ( m2.size() != m1.size() )
+ {
+ std::cout << \"stltest: map copy failed, expected \" << m1.size() << \" elements, got \" << m2.size();
+ ++rval;
+ }
+ return 0;
+ }
+ // something mean to see if the compiler and C++ standard lib are good enough
+ template<class K, class T>
+ class DummyClass
+ {
+ // everything in std namespace ?
+ typedef std::bidirectional_iterator_tag i;
+ typedef std::ptrdiff_t d;
+ // typename implemented ?
+ typedef typename std::map<K,T>::iterator MyIterator;
+ };"
+ STL_SUPPORT)
+
+ if( NOT STL_SUPPORT )
+ set( TQT_NO_STL false )
+ endif()
+endif(NOT WITH_STL)