[CMake] build.h instead of config.h

luxInteg lux-integ at btconnect.com
Tue Jan 18 13:18:56 EST 2011


On Tuesday 18 January 2011 08:23:49 Eric Noulard wrote:

> May be you can post your CMakeLists.txt here if it's not too big?
> What is your platform/compiler target?
> Linux/gcc, Windows/Visual etc...
> I bet the " -MT  -MD -MP" options are specific to the compiler use, did you


Thanks for your kind response.


Rhe  package in question is gsl 
( http://www.gnu.org/software/gsl/ ) 
and the platform is linux; compiler gcc

I have generated a config.h   of sorts  ( I was looking at the wrong source 
directory.  build.h is  there alright as  an integral part thereof).  
CMake did generate Makefiles and  a config.h.  The make fails not long after 
starting  with  the following:-

###########
~/sys/infnan.c:98:3: error: #error "cannot define gsl_finite without 
HAVE_DECL_FINITE or HAVE_IEEE_COMPARISONS"
~/sys/infnan.c:115:3: error: #error "cannot define gsl_isnan without 
HAVE_DECL_ISNAN or HAVE_IEEE_COMPARISONS"
##########

The problem seems to revolve around    the scope/ of the functions used  to 
mimic   the config.h (aoto-tools).
:-

----------------Here is the relevant  configure output

checking for ieeefp.h... no
checking for vprintf... yes
checking for _doprnt... no
checking for memcpy... yes
checking for memmove... yes
checking for strdup... yes
checking for strtol... yes
checking for strtoul... yes
checking for EXIT_SUCCESS and EXIT_FAILURE... yes
checking for cos in -lm... yes
checking whether feenableexcept is declared... yes
checking whether fesettrapenable is declared... no
checking whether hypot is declared... yes
checking whether expm1 is declared... yes
checking whether acosh is declared... yes
checking whether asinh is declared... yes
checking whether atanh is declared... yes
checking whether ldexp is declared... yes
checking whether frexp is declared... yes
checking whether isinf is declared... yes
checking whether isfinite is declared... yes
checking whether finite is declared... yes
checking whether isnan is declared... yes
checking whether log1p is declared... yes
checking for long double stdio... yes
checking for extended floating point registers... yes
checking for IEEE arithmetic interface type... gnux86
checking for FPU_SETCW... yes
checking for SSE extensions... yes
checking for IEEE compiler flags... none
checking for IEEE comparisons... yes
checking for IEEE denormalized values... yes

------------------ and the relevant section from config.log

configure:11068: checking whether hypot is declared
configure:11068: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11068: $? = 0
configure:11068: result: yes
configure:11080: checking whether expm1 is declared
configure:11080: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11080: $? = 0
configure:11080: result: yes
configure:11092: checking whether acosh is declared
configure:11092: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11092: $? = 0
configure:11092: result: yes
configure:11104: checking whether asinh is declared
configure:11104: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11104: $? = 0
configure:11104: result: yes
configure:11116: checking whether atanh is declared
configure:11116: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11116: $? = 0
configure:11116: result: yes
configure:11128: checking whether ldexp is declared
configure:11128: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11128: $? = 0
configure:11128: result: yes
configure:11140: checking whether frexp is declared
configure:11140: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11140: $? = 0
configure:11140: result: yes
configure:11152: checking whether isinf is declared
configure:11152: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11152: $? = 0
configure:11152: result: yes
configure:11164: checking whether isfinite is declared
configure:11164: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11164: $? = 0
configure:11164: result: yes
configure:11176: checking whether finite is declared
configure:11176: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11176: $? = 0
configure:11176: result: yes
configure:11191: checking whether isnan is declared
configure:11191: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11191: $? = 0
configure:11191: result: yes
configure:11210: checking whether log1p is declared
configure:11210: gcc -c -O3 -fexceptions -m64 -fPIC  conftest.c >&5
configure:11210: $? = 0
configure:11210: result: yes

-------------and here   it is  in cmake (using the config.h.cmake (below)

-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for acosh
-- Looking for acosh - not found.
-- Looking for asinh
-- Looking for asinh - not found.
-- Looking for atanh
-- Looking for atanh - not found.
-- Looking for expm1
-- Looking for expm1 - not found
-- Looking for feenableexcept
-- Looking for feenableexcept - not found
-- Looking for finite
-- Looking for finite - found
-- Looking for frexp
-- Looking for frexp - found
-- Looking for hypot
-- Looking for hypot - not found
-- Looking for isfinite
-- Looking for isfinite - not found
-- Looking for isinf
-- Looking for isinf - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for ldexp
-- Looking for ldexp - found
-- Looking for log1p
-- Looking for log1p - not found
-- Looking for fpu_x86_sse
-- Looking for fpu_x86_sse - not found
-- Looking for ieee_comparisons
-- Looking for ieee_comparisons - not found
-- Looking for ieee_dnormals
-- Looking for ieee_dnormals - not found
-- Looking for inline
-- Looking for inline - not found
-- Looking for memcpy
-- Looking for memcpy - found
-- Looking for memmoven
-- Looking for memmoven - not found
-- Looking for strdup
-- Looking for strdup - found
-- Looking for strtol
-- Looking for strtol - found
-- Looking for strtoul
-- Looking for strtoul - found
-- Looking for vprintf
-- Looking for vprintf - found
-- Looking for ieee_gnux86_interface
-- Looking for ieee_gnux86_interface - not found
-- Looking for printf_longdouble
-- Looking for printf_longdouble - not found
-- Looking for exit_success_and_failure
-- Looking for exit_success_and_failure - not found
-- Looking for extended_precision_registers
-- Looking for extended_precision_registers - not found
-- Looking for pow in m
-- Looking for pow in m - found
-- Configuring done
-- Generating done



########### here is my config.h.cmake ##############

INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckCSourceCompiles.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
#INCLUDE (${CMAKE_ROOT}/Modules/CheckPrototypeExists.cmake )

 INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake )

#---------------------------------------------------------
CHECK_LIBRARY_EXISTS(m   pow "" 	HAVE_LIBM     )
if (HAVE_LIBM)
    set (LIB_M "m")
endif (HAVE_LIBM)


CHECK_INCLUDE_FILE("dlfcn.h"		HAVE_DLFCN_H     )
CHECK_INCLUDE_FILE("inttypes.h"   	HAVE_INTTYPES_H     )
CHECK_INCLUDE_FILE("memory.h"       	HAVE_MEMORY_H     )
CHECK_INCLUDE_FILE("stdint.h"  		HAVE_STDINT_H     )
CHECK_INCLUDE_FILE("stdlib.h"  		HAVE_STDLIB_H     )
CHECK_INCLUDE_FILE("strings.h"  	HAVE_STRINGS_H     )
CHECK_INCLUDE_FILE("string.h"  		HAVE_STRING_H     )
CHECK_INCLUDE_FILE("sys/stat.h"  	HAVE_SYS_STAT_H     )
CHECK_INCLUDE_FILE("sys/types.h" 	HAVE_SYS_TYPES_H     )
CHECK_INCLUDE_FILE("unistd.h" 		HAVE_UNISTD_H     )



#CHECK_FUNCTION_EXISTS(decl_acosh 	HAVE_DECL_ACOSH     ) **see below 
CHECK_FUNCTION_EXISTS(decl_asinh  	HAVE_DECL_ASINH     )
CHECK_FUNCTION_EXISTS(decl_atanh  	HAVE_DECL_ATANH     )
CHECK_FUNCTION_EXISTS(expm1   		HAVE_DECL_EXPM1     )
CHECK_FUNCTION_EXISTS(feenableexcept   	HAVE_DECL_FEENABLEEXCEPT     )



CHECK_FUNCTION_EXISTS(finite		HAVE_DECL_FINITE     ) 
CHECK_FUNCTION_EXISTS(frexp		HAVE_DECL_FREXP     )
CHECK_FUNCTION_EXISTS(hypot 		HAVE_DECL_HYPOT     )
CHECK_FUNCTION_EXISTS(isfinite 		HAVE_DECL_ISFINITE     )
CHECK_FUNCTION_EXISTS(isinf   		HAVE_DECL_ISINF     )
CHECK_FUNCTION_EXISTS(isnan   		HAVE_DECL_ISNAN     )
CHECK_FUNCTION_EXISTS(ldexp   		HAVE_DECL_LDEXP     )
CHECK_FUNCTION_EXISTS(log1p  		HAVE_DECL_LOG1P     )
CHECK_FUNCTION_EXISTS(fpu_x86_sse 	HAVE_FPU_X86_SSE     )
CHECK_FUNCTION_EXISTS(ieee_comparisons 	HAVE_IEEE_COMPARISONS     )
CHECK_FUNCTION_EXISTS(ieee_dnormals  	HAVE_IEEE_DENORMALS     )
CHECK_FUNCTION_EXISTS(inline  		HAVE_INLINE     )
CHECK_FUNCTION_EXISTS(memcpy    	HAVE_MEMCPY     )
CHECK_FUNCTION_EXISTS(memmoven   	HAVE_MEMMOVE     )
CHECK_FUNCTION_EXISTS(strdup    	HAVE_STRDUP     )
CHECK_FUNCTION_EXISTS(strtol  		HAVE_STRTOL     )
CHECK_FUNCTION_EXISTS(strtoul     	HAVE_STRTOUL     )
CHECK_FUNCTION_EXISTS(vprintf   	HAVE_VPRINTF     )

CHECK_FUNCTION_EXISTS(ieee_gnux86_interface  		
HAVE_GNUX86_IEEE_INTERFACE     )
CHECK_FUNCTION_EXISTS(printf_longdouble  		HAVE_PRINTF_LONGDOUBLE     )
CHECK_FUNCTION_EXISTS(exit_success_and_failure  	HAVE_EXIT_SUCCESS_AND_FAILURE     
)  
CHECK_FUNCTION_EXISTS(extended_precision_registers  	
HAVE_EXTENDED_PRECISION_REGISTERS     )

configure_file( config.h.in   ${CMAKE_SOURCE_DIR}/config.h @ONLY  )

#----------------------------------------------------------


** fiddles (I tried )  with HAVE_DECL_ACOSH 
# first did 
find_package(Boost REQUIRED)
then  
CHECK_SYMBOL_EXISTS(decl_acosh  "acosh" 	HAVE_DECL_ACOSH    )   # ------this 
returns notfound 
## so abandoned the boost approach  
then   tried respectively
CHECK_LIBRARY_EXISTS(m   acosh "" 	        HAVE_DECL_ACOSH    )  '# ------this 
eturns found 
CHECK_C_SOURCE_COMPILES( ${CMAKE_SOURCE_DIR}/sys/infnan.c   HAVE_DECL_ACOSH  ) 
#---- this returns not found

like so:-
-- Looking for unistd.h - found
-- Performing Test HAVE_DECL_ACOSH
-- Performing Test HAVE_DECL_ACOSH - Failed
-- Looking for decl_asinh
-- Looking for decl_asinh - not found
-- Looking for decl_atanh
-- Looking for decl_atanh - not found


-----------------
To a cmake ignoramus like me, it would appear that more   is needed   to do  
----maths/capability checks 
----cpu checks 

for this type of package.

Advice would be appreciated.


Sincerely
LuxInteg


More information about the CMake mailing list