How to test for gnu extensions
Alexander Neundorf
neundorf at kde.org
Thu Feb 9 21:58:19 CET 2006
On Thursday 09 February 2006 21:25, David Faure wrote:
...
> I tried porting the check from acinclude.m4.in to define _GNU_SOURCE, which
> gives something like:
>
> --- ConfigureChecks.cmake (revision 507577)
> +++ ConfigureChecks.cmake (working copy)
> @@ -5,6 +5,7 @@ include(CheckFunctionExists)
> include(CheckLibraryExists)
> include(CheckPrototypeExists)
> include(CheckTypeSize)
> +include(CheckCSourceCompiles)
>
> #check for libz using the cmake supplied FindZLIB.cmake
> if(ZLIB_FOUND)
> @@ -148,6 +149,13 @@ check_include_files( "X11/Xlib.h;X11/ext
> check_include_files( X11/ICE/ICElib.h HAVE_X11_ICE_ICELIB_H)
> check_include_files( X11/extensions/Xrender.h HAVE_XRENDER)
>
> +# Check if we need GNU extensions. E.g. for S_ISSOCK etc.
> +CheckCSourceCompiles("
> +#include <features.h>
> +#ifndef __GNU_LIBRARY__
> +#error no gnu here
> +#endif
> +" _GNU_SOURCE)
>
> #check_symbol_exists(sockaddr_in6 "netinet/in.h" HAVE_STRUCT_SOCKADDR_IN6)
> check_symbol_exists(LC_MESSAGES "locale.h" HAVE_LC_MESSAGES)
>
>
> But this gives me:
>
> CMake Error: Error in cmake code at
> /devel/kde/src/4/kdelibs/ConfigureChecks.cmake:153:
> Unknown CMake command "CheckCSourceCompiles".
I guess you already found out, the name of the command is
"check_c_source_compiles(), see CheckCSourceCompiles.cmake .
Bye
Alex
--
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org - http://www.kde.org
alex AT neundorf.net - http://www.neundorf.net
More information about the Kde-buildsystem
mailing list