[CMake] Autotools-cmake: Are these checks really needed anymore?
In the project I'm converting to cmake there are a lot of checks for headers and functions I've reimplemented in cmake, but it seems a lot of autotools based programs do a lot of excessive checking and I don't want to implement stuff that can be safely assumed on most systems. Here's a snippet of the checks in question: # Checks for typedefs, structures, and compiler characteristics. #AC_C_CONST #AC_C_INLINE #AC_TYPE_INT16_T #AC_TYPE_INT32_T #AC_TYPE_INT64_T #AC_TYPE_INT8_T #AC_C_RESTRICT #AC_TYPE_SIZE_T #AC_HEADER_TIME #AC_STRUCT_TM #AC_TYPE_UINT16_T #AC_TYPE_UINT32_T #AC_TYPE_UINT64_T #AC_TYPE_UINT8_T #AC_C_VOLATILE Are they safe to skip? Thanks, Richard -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Autotools-cmake: Are these checks really needed anymore?
Am Samstag, 30. August 2014, 09:18:26 schrieb Richard Shaw: In the project I'm converting to cmake there are a lot of checks for headers and functions I've reimplemented in cmake, but it seems a lot of autotools based programs do a lot of excessive checking and I don't want to implement stuff that can be safely assumed on most systems. Here's a snippet of the checks in question: Just my personal view, YMMV # Checks for typedefs, structures, and compiler characteristics. #AC_C_CONST #AC_C_INLINE I don't think you will find a compiler these days crappy enough to _not_ support them. #AC_TYPE_INT16_T #AC_TYPE_INT32_T #AC_TYPE_INT64_T #AC_TYPE_INT8_T #AC_TYPE_UINT16_T #AC_TYPE_UINT32_T #AC_TYPE_UINT64_T #AC_TYPE_UINT8_T This is basically is there a usable stdint.h or cstdint. The latter you will find in newer versions of MSVC and everything else that understands recent C++, the former in every compiler supporting at least a decent level of C99, which _excludes_ MSVC for policy reasons that even MS will probably find hard to explain. So you usually don't check for these types but for the header. #AC_STRUCT_TM #AC_HEADER_TIME This should be safe on every Un*x-like system and even Windows IIRC. #AC_TYPE_SIZE_T Should be there everywhere. #AC_C_RESTRICT #AC_C_VOLATILE I'm not sure if you should even think of using them. Especially volatile is often something that means you are doing something scary. Eike signature.asc Description: This is a digitally signed message part. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Autotools-cmake: Are these checks really needed anymore?
On Sat, Aug 30, 2014 at 10:30 AM, Rolf Eike Beer e...@sf-mail.de wrote: # Checks for typedefs, structures, and compiler characteristics. #AC_C_CONST #AC_C_INLINE ... #AC_TYPE_SIZE_T ... #AC_C_RESTRICT #AC_C_VOLATILE These should be generally safe to assume #AC_STRUCT_TM #AC_HEADER_TIME Unless you're targeting embedded systems and / or microcontrollors then you shouldn't have a problem with these either, even still there's a good chance you'd have it. #AC_TYPE_INT16_T #AC_TYPE_INT32_T #AC_TYPE_INT64_T #AC_TYPE_INT8_T #AC_TYPE_UINT16_T #AC_TYPE_UINT32_T #AC_TYPE_UINT64_T #AC_TYPE_UINT8_T This is basically is there a usable stdint.h or cstdint. The latter you will find in newer versions of MSVC and everything else that understands recent C++, the former in every compiler supporting at least a decent level of C99, which _excludes_ MSVC for policy reasons that even MS will probably find hard to explain. So you usually don't check for these types but for the header. Ugh, this is definitely one of those irritating Windows-isms. cstdint is guaranteed available in C++11, so if you require that then most of this goes away. stdint.h, as Rolf mentioned, wasn't available until VS2010, so if you can place that as a requirement then you're all set. You can restrict this in your top level cmake with something like this: if(MSVC_VERSION LESS 1700) message(FATAL_ERROR Only Visual C++ 2010 or greater is supported) endif() However, if you do have to support older MSVC versions then this is a problem and you will need to either redefine the types or include your own stdint.h (bringing the header is usally easier), a commonly used one by numerous projects for porting unix - windows can be found here: https://code.google.com/p/msinttypes/source/browse/trunk/stdint.h. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Autotools-cmake: Are these checks really needed anymore?
On 30. August 2014 16:18:26 MESZ, Richard Shaw hobbes1...@gmail.com wrote: In the project I'm converting to cmake there are a lot of checks for headers and functions I've reimplemented in cmake, but it seems a lot of autotools based programs do a lot of excessive checking and I don't want to implement stuff that can be safely assumed on most systems. They actually do this checking because they are part of some standard macros. You should ask yourself if you actually use this information anywhere. I never check for header files that are usually part of the compiler or base system. The corner cases can often be easier handled in other ways than some strange checking in the build system. And this is still one of the most annoying thing about autotools. HS -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Autotools-cmake: Are these checks really needed anymore?
Thanks for the responses everyone. I'm just volunteering to change the build system on one of my favorite pieces of software so I don't know the code inside and out. As far as I know linux, windows, freebsd and OSX are supported for *running* but I believe the windows version is cross-compiled from Linux so no need to worry about MSVC. Thanks, Richard -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Autotools-cmake: Are these checks really needed anymore?
On Sat, Aug 30, 2014 at 04:30:15PM +0200, Rolf Eike Beer wrote: Am Samstag, 30. August 2014, 09:18:26 schrieb Richard Shaw: #AC_C_RESTRICT #AC_C_VOLATILE I'm not sure if you should even think of using them. Especially volatile is often something that means you are doing something scary. If you're a strict C99 programmer, you might well be using restrict routinely. I certainly did before I migrated to mainly using C++, and if you look at the prototypes used by e.g. glibc you'll see restrict is used throughout. volatile is a little more scary, but you might well find you need it e.g. in signal handlers. The merits of either aside, these are standard language features and like all the other features in the list, they will be present if you're using a conforming compiler. As someone who made the same switch from autotools to cmake last year (and who wrote some of the C99 checks for autoconf in the first place!), I can't help but feel that autoconf is still trying to solve portability problems from two decades ago which have now been long solved. I stopped worrying about these details--all current compilers (modulo MSVC and C99 support) support all these features, so unless you really care about some long obsolete unsupported system, all this stuff is wasted effort except for maybe cstdint/stdint.h in which case you can do something like: https://github.com/openmicroscopy/bioformats/blob/develop/cpp/lib/ome/compat/cstdint.h https://github.com/openmicroscopy/bioformats/blob/develop/cpp/lib/ome/compat/config.h.in https://github.com/openmicroscopy/bioformats/blob/develop/cpp/cmake/CompilerChecks.cmake Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linuxhttp://people.debian.org/~rleigh/ `. `' schroot and sbuild http://alioth.debian.org/projects/buildd-tools `-GPG Public Key F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake