compile++
[kdeartwork.git] / ConfigureChecks.cmake
blobd6921509e920b275c62696f470ff03b7a3656160
1 include(CheckIncludeFile)
2 include(CheckIncludeFiles)
3 include(CheckSymbolExists)
4 include(CheckFunctionExists)
5 include(CheckLibraryExists)
6 include(CheckPrototypeExists)
7 include(CheckTypeSize)
9 # The FindKDE4.cmake module sets _KDE4_PLATFORM_DEFINITIONS with
10 # definitions like _GNU_SOURCE that are needed on each platform.
11 set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
13 #check for libz using the cmake supplied FindZLIB.cmake
14 if(ZLIB_FOUND)
15    set(HAVE_LIBZ 1)
16 else(ZLIB_FOUND)
17    set(HAVE_LIBZ 0)
18 endif(ZLIB_FOUND)
20 if(JPEG_FOUND)
21    set(HAVE_LIBJPEG 1)
22 else(JPEG_FOUND)
23    set(HAVE_LIBJPEG 0)
24 endif(JPEG_FOUND)
26 #check for png
27 if(PNG_FOUND)
28    set(HAVE_LIBPNG 1)
29 else(PNG_FOUND)
30    set(HAVE_LIBPNG 0)
31 endif(PNG_FOUND)
33 if(BZIP2_FOUND)
34    set(HAVE_BZIP2_SUPPORT 1)
35    if(BZIP2_NEED_PREFIX)
36       set(NEED_BZ2_PREFIX 1)
37    endif(BZIP2_NEED_PREFIX)
38 else(BZIP2_FOUND)
39    set(HAVE_BZIP2_SUPPORT 0)
40 endif(BZIP2_FOUND)
42 if(LIBART_FOUND)
43    set(HAVE_LIBART 1)
44 else(LIBART_FOUND)
45    set(HAVE_LIBART 0)
46 endif(LIBART_FOUND)
48 if(CARBON_FOUND)
49         set(HAVE_CARBON 1)
50 else(CARBON_FOUND)
51         set(HAVE_CARBON 0)
52 endif(CARBON_FOUND)
54 #now check for dlfcn.h using the cmake supplied CHECK_include_FILE() macro
55 # If definitions like -D_GNU_SOURCE are needed for these checks they
56 # should be added to _KDE4_PLATFORM_DEFINITIONS when it is originally
57 # defined outside this file.  Here we include these definitions in
58 # CMAKE_REQUIRED_DEFINITIONS so they will be included in the build of
59 # checks below.
60 set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
61 if (WIN32)
62    set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES} )
63    set(CMAKE_REQUIRED_INCLUDES  ${KDEWIN32_INCLUDES} )
64 endif (WIN32)
66 check_include_files(dlfcn.h HAVE_DLFCN_H)
67 check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H)
68 check_include_files(inttypes.h HAVE_INTTYPES_H)
69 check_include_files(memory.h HAVE_MEMORY_H)
70 check_include_files(stdint.h HAVE_STDINT_H)
71 check_include_files(stdlib.h HAVE_STDLIB_H)
72 check_include_files(strings.h HAVE_STRINGS_H)
73 check_include_files(string.h HAVE_STRING_H)
74 check_include_files(sys/bitypes.h HAVE_SYS_BITYPES_H)
75 check_include_files(sys/stat.h HAVE_SYS_STAT_H)
76 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
77 check_include_files(unistd.h HAVE_UNISTD_H)
79 check_function_exists(_NSGetEnviron   HAVE_NSGETENVIRON)
80 check_function_exists(initgroups HAVE_INITGROUPS)
81 check_function_exists(setenv     HAVE_SETENV)
82 check_function_exists(gettimeofday    HAVE_GETTIMEOFDAY)
83 check_function_exists(strlcat    HAVE_STRLCAT)
84 check_function_exists(strlcpy    HAVE_STRLCPY)
86 check_symbol_exists(res_init        "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT)
87 check_symbol_exists(snprintf        "stdio.h"                  HAVE_SNPRINTF)
88 check_symbol_exists(vsnprintf       "stdio.h"                  HAVE_VSNPRINTF)
90 check_prototype_exists(res_init "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT_PROTO)
91 check_prototype_exists(initgroups "unistd.h;sys/types.h;unistd.h;grp.h" HAVE_INITGROUPS_PROTO)
92 check_prototype_exists(setenv stdlib.h HAVE_SETENV_PROTO)
93 check_prototype_exists(strlcat string.h HAVE_STRLCAT_PROTO)
94 check_prototype_exists(strlcpy string.h HAVE_STRLCPY_PROTO)
97 check_type_size("int" SIZEOF_INT)
98 check_type_size("char *"  SIZEOF_CHAR_P)
99 check_type_size("long" SIZEOF_LONG)
100 check_type_size("short" SIZEOF_SHORT)
101 check_type_size("size_t" SIZEOF_SIZE_T)
102 check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)