2016-11-19 07:56:43 +08:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2015-09-06 05:47:32 +08:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# configure
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# FUNCTION check_includes
|
|
|
|
########################################
|
|
|
|
function(check_includes files)
|
|
|
|
foreach(F ${${files}})
|
|
|
|
set(name ${F})
|
|
|
|
string(REPLACE "-" "_" name ${name})
|
|
|
|
string(REPLACE "." "_" name ${name})
|
|
|
|
string(REPLACE "/" "_" name ${name})
|
|
|
|
string(TOUPPER ${name} name)
|
|
|
|
check_include_files(${F} HAVE_${name})
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the <${F}> header file. */\n")
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "\n")
|
|
|
|
endforeach()
|
|
|
|
endfunction(check_includes)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# FUNCTION check_functions
|
|
|
|
########################################
|
|
|
|
function(check_functions functions)
|
|
|
|
foreach(F ${${functions}})
|
|
|
|
set(name ${F})
|
|
|
|
string(TOUPPER ${name} name)
|
|
|
|
check_function_exists(${F} HAVE_${name})
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if you have the `${F}' function. */\n")
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "\n")
|
|
|
|
endforeach()
|
|
|
|
endfunction(check_functions)
|
|
|
|
|
2015-09-07 01:43:28 +08:00
|
|
|
########################################
|
|
|
|
# FUNCTION check_types
|
|
|
|
########################################
|
|
|
|
function(check_types types)
|
|
|
|
foreach(T ${${types}})
|
|
|
|
set(name ${T})
|
|
|
|
string(REPLACE " " "_" name ${name})
|
|
|
|
string(REPLACE "-" "_" name ${name})
|
|
|
|
string(REPLACE "." "_" name ${name})
|
|
|
|
string(REPLACE "/" "_" name ${name})
|
|
|
|
string(TOUPPER ${name} name)
|
|
|
|
check_type_size(${T} HAVE_${name})
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "/* Define to 1 if the system has the type `${T}'. */\n")
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "#cmakedefine HAVE_${name} 1\n")
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "\n")
|
|
|
|
endforeach()
|
|
|
|
endfunction(check_types)
|
|
|
|
|
2015-09-06 05:47:32 +08:00
|
|
|
########################################
|
|
|
|
|
|
|
|
file(WRITE ${AUTOCONFIG_SRC})
|
|
|
|
|
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
include(CheckCSourceRuns)
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
include(CheckCXXSourceRuns)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckPrototypeDefinition)
|
|
|
|
include(CheckStructHasMember)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckTypeSize)
|
|
|
|
include(TestBigEndian)
|
|
|
|
|
|
|
|
set(include_files_list
|
|
|
|
dlfcn.h
|
|
|
|
inttypes.h
|
2015-09-07 01:43:28 +08:00
|
|
|
limits.h
|
|
|
|
malloc.h
|
2015-09-06 05:47:32 +08:00
|
|
|
memory.h
|
2015-09-07 01:43:28 +08:00
|
|
|
stdbool.h
|
2015-09-06 05:47:32 +08:00
|
|
|
stdint.h
|
|
|
|
stdlib.h
|
|
|
|
strings.h
|
|
|
|
string.h
|
2015-09-07 01:43:28 +08:00
|
|
|
sys/ipc.h
|
|
|
|
sys/shm.h
|
2015-09-06 05:47:32 +08:00
|
|
|
sys/stat.h
|
|
|
|
sys/types.h
|
2015-09-07 01:43:28 +08:00
|
|
|
sys/wait.h
|
2015-09-06 05:47:32 +08:00
|
|
|
unistd.h
|
2016-07-04 04:34:14 +08:00
|
|
|
|
2015-09-07 01:43:28 +08:00
|
|
|
cairo/cairo-version.h
|
|
|
|
CL/cl.h
|
|
|
|
OpenCL/cl.h
|
|
|
|
pango-1.0/pango/pango-features.h
|
2016-07-17 18:58:33 +08:00
|
|
|
tiffio.h
|
2015-09-07 01:43:28 +08:00
|
|
|
unicode/uchar.h
|
2015-09-06 05:47:32 +08:00
|
|
|
)
|
|
|
|
check_includes(include_files_list)
|
|
|
|
|
|
|
|
set(functions_list
|
2015-09-07 01:43:28 +08:00
|
|
|
getline
|
|
|
|
snprintf
|
2015-09-06 05:47:32 +08:00
|
|
|
)
|
|
|
|
check_functions(functions_list)
|
|
|
|
|
2015-09-07 01:43:28 +08:00
|
|
|
set(types_list
|
|
|
|
"long long int"
|
2015-10-31 18:54:37 +08:00
|
|
|
off_t
|
2015-09-07 01:43:28 +08:00
|
|
|
mbstate_t
|
|
|
|
wchar_t
|
|
|
|
_Bool
|
|
|
|
)
|
|
|
|
check_types(types_list)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
2015-09-07 01:43:28 +08:00
|
|
|
test_big_endian(WORDS_BIGENDIAN)
|
2015-09-06 05:47:32 +08:00
|
|
|
|
|
|
|
file(APPEND ${AUTOCONFIG_SRC} "
|
|
|
|
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
|
|
significant byte first (like Motorola and SPARC, unlike Intel). */
|
|
|
|
#cmakedefine WORDS_BIGENDIAN 1
|
|
|
|
")
|
|
|
|
|
|
|
|
########################################
|
|
|
|
|
|
|
|
################################################################################
|