comparison mupdf-source/thirdparty/leptonica/cmake/Configure.cmake @ 3:2c135c81b16c

MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:44:09 +0200
parents b50eed0cc0ef
children
comparison
equal deleted inserted replaced
0:6015a75abc2d 3:2c135c81b16c
1 ################################################################################
2 #
3 # configure
4 #
5 ################################################################################
6
7 ########################################
8 # FUNCTION check_includes
9 ########################################
10 function(check_includes files)
11 foreach(F ${${files}})
12 set(name ${F})
13 string(REPLACE "-" "_" name ${name})
14 string(REPLACE "." "_" name ${name})
15 string(REPLACE "/" "_" name ${name})
16 string(TOUPPER ${name} name)
17 check_include_files(${F} HAVE_${name})
18 file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the <${F}> header file. */\n")
19 file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
20 file(APPEND ${AUTOCONFIG_SRC} "\n")
21 endforeach()
22 endfunction(check_includes)
23
24 ########################################
25 # FUNCTION check_functions
26 ########################################
27 function(check_functions functions)
28 foreach(F ${${functions}})
29 set(name ${F})
30 string(TOUPPER ${name} name)
31 check_function_exists(${F} HAVE_${name})
32 file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the `${F}' function. */\n")
33 file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
34 file(APPEND ${AUTOCONFIG_SRC} "\n")
35 endforeach()
36 endfunction(check_functions)
37
38 ########################################
39
40 file(WRITE ${AUTOCONFIG_SRC})
41
42 include(CheckCSourceCompiles)
43 include(CheckCSourceRuns)
44 include(CheckCXXSourceCompiles)
45 include(CheckCXXSourceRuns)
46 include(CheckFunctionExists)
47 include(CheckIncludeFiles)
48 include(CheckLibraryExists)
49 include(CheckPrototypeDefinition)
50 include(CheckStructHasMember)
51 include(CheckSymbolExists)
52 include(CheckTypeSize)
53 include(TestBigEndian)
54
55 set(include_files_list
56 dlfcn.h
57 inttypes.h
58 memory.h
59 stdint.h
60 stdlib.h
61 strings.h
62 string.h
63 sys/stat.h
64 sys/types.h
65 unistd.h
66 )
67 check_includes(include_files_list)
68
69 set(functions_list
70 fmemopen
71 fstatat
72 )
73 check_functions(functions_list)
74
75 test_big_endian(BIG_ENDIAN)
76
77 if(BIG_ENDIAN)
78 set(ENDIANNESS L_BIG_ENDIAN)
79 else()
80 set(ENDIANNESS L_LITTLE_ENDIAN)
81 endif()
82
83 set(APPLE_UNIVERSAL_BUILD "defined (__APPLE_CC__)")
84 configure_file(
85 ${PROJECT_SOURCE_DIR}/src/endianness.h.in
86 ${PROJECT_BINARY_DIR}/src/endianness.h
87 @ONLY)
88
89 if (GIF_FOUND)
90 set(HAVE_LIBGIF 1)
91 endif()
92
93 if (JPEG_FOUND)
94 set(HAVE_LIBJPEG 1)
95 endif()
96
97 if (OPENJPEG_SUPPORT)
98 set(HAVE_LIBJP2K 1)
99 endif()
100
101 if (PNG_FOUND)
102 set(HAVE_LIBPNG 1)
103 endif()
104
105 if (TIFF_FOUND)
106 set(HAVE_LIBTIFF 1)
107 endif()
108
109 if (LIBWEBP_SUPPORT)
110 set(HAVE_LIBWEBP 1)
111 set(HAVE_LIBWEBP_ANIM 1)
112 endif()
113
114 if (ZLIB_FOUND)
115 set(HAVE_LIBZ 1)
116 endif()
117
118 file(APPEND ${AUTOCONFIG_SRC} "
119 /* Define to 1 if you have giflib. */
120 #cmakedefine HAVE_LIBGIF 1
121
122 /* Define to 1 if you have libopenjp2. */
123 #cmakedefine HAVE_LIBJP2K 1
124
125 /* Define to 1 if you have jpeg. */
126 #cmakedefine HAVE_LIBJPEG 1
127
128 /* Define to 1 if you have libpng. */
129 #cmakedefine HAVE_LIBPNG 1
130
131 /* Define to 1 if you have libtiff. */
132 #cmakedefine HAVE_LIBTIFF 1
133
134 /* Define to 1 if you have libwebp. */
135 #cmakedefine HAVE_LIBWEBP 1
136
137 /* Define to 1 if you have libwebpmux. */
138 #cmakedefine HAVE_LIBWEBP_ANIM 1
139
140 /* Define to 1 if you have zlib. */
141 #cmakedefine HAVE_LIBZ 1
142 ")
143
144 ########################################
145
146 ################################################################################