1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-13 21:15:08 -05:00
Commit Graph

36 Commits

Author SHA1 Message Date
Brad King
a9c97fba81 cmake: Fix CurlTests check for gethostbyname_r with 5 arguments
Fix the check code to pass 5 arguments instead of 6.  This typo was
introduced by commit aebfd4cfbf (cmake: fix gethostby{addr,name}_r in
CurlTests, 2014-10-31).
2015-08-14 16:12:27 +02:00
Sergei Nikulov
ec80b1f414 CMake: fix winsock2 detection on windows
Set CMAKE_REQUIRED_DEFINITIONS to include definitions needed to get
the winsock2 API from windows.h.  Simplify the order of checks to
avoid extra conditions.

Use check_include_file instead of check_include_file_concat to look
for OpenSSL headers.  They do not need to participate in a sequence
of dependent system headers.  Also they may cause winsock.h to be
included before ws2tcpip.h, causing the latter to not be detected
in the sequence.

Reviewed-by: Brad King <brad.king@kitware.com>
2015-02-19 20:11:04 +01:00
Brad King
fba9f41b84 CMake: Simplify if() conditions on check result variables
Remove use of an old hack that takes advantage of the auto-dereference
behavior of the if() command to detect if a variable is defined.  The
hack has the form:

 if("${VAR} MATCHES "^${VAR}$")

where "${VAR}" is a macro argument reference.  Use if(DEFINED) instead.
This also avoids warnings for CMake Policy CMP0054 in CMake 3.1.
2014-11-19 11:35:15 +01:00
Brad King
5f3824a5aa CMake: Restore order-dependent library checks
Revert commit 2257deb502 (Cmake: Avoid cycle directory dependencies,
2014-08-22) and add a comment explaining the purpose of the original
code.

The check_library_exists_concat macro is intended to be called multiple
times on a sequence of possibly dependent libraries.  Later libraries
may depend on earlier libraries when they are static.  They cannot be
safely linked in reverse order on some platforms.

Signed-off-by: Brad King <brad.king@kitware.com>
2014-11-13 23:42:35 +01:00
Brad King
1ae06e002d CMake: Restore order-dependent header checks
Revert commit 1269df2e3b (Cmake: Don't check for all headers each
time, 2014-08-15) and add a comment explaining the purpose of the
original code.

The check_include_file_concat macro is intended to be called multiple
times on a sequence of possibly dependent headers.  Later headers
may depend on earlier headers to provide declarations.  They cannot
be safely included independently on some platforms.

For example, many POSIX APIs document including sys/types.h before some
other headers.  Also on some OS X versions sys/socket.h must be included
before net/if.h or the check for the latter will fail.

Signed-off-by: Brad King <brad.king@kitware.com>
2014-11-13 23:42:35 +01:00
Peter Wu
10286f45e7 cmake: fix HAVE_GETHOSTNAME definition
Otherwise Curl_gethostname always fails. Windows has gethostname
since Vista according to
http://msdn.microsoft.com/en-us/library/ms738527%28VS.85%29.aspx, but
accordings to byte_bucket's VC 2005 documentation, it is available even
in Windows 95. (possibly after installing a Platform SDK, the
Windows Server 2003 SP1 Platform SDK should be sufficient).

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-10 09:07:50 +01:00
Peter Wu
5565d0ab07 cmake: fix struct sockaddr_storage check
CHECK_TYPE_SIZE_PREINCLUDE is an internal, undocumented variable which
was removed in cmake 2.8.1. According to the MSDN docs[1], inclusion
of winsock2.h is sufficient. WIN32_LEAN_AND_MEAN does not really seem
to affect the tests, so remove it too[2].

For the non-windows case, remove inet headers as POSIX only requires
sys/socket.h.

 [1]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740504%28v=vs.85%29.aspx
 [2]: http://stackoverflow.com/questions/11040133/what-does-defining-win32-lean-and-mean-exclude-exactly

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-03 09:10:54 +01:00
Peter Wu
8cb0101449 cmake: clean OtherTests, fixing -Werror
There were several -Wunused warnings and one duplicate macro definition.
The EXTRA_DEFINES variable of the CurlCheckCSources macro was being
abused ("__unused1\n#undef inline\n#define __unused2", seriously?) to
insert extra C code. Avoid this broken abstraction and use cmake's
check_c_source_compiles directly (works fine with CMake 2.8, maybe
even cmake 2.6).

After cleaning up all related variables (EXTRA_DEFINES,
HEADER_INCLUDES, auxiliary headers_hack), also remove a duplicate
add_headers_include macro and remove duplicate header additions before
the struct timeval check.

Oh, and now the code is converted to use CheckCSourceRuns and
CheckCSourceCompiles, the two curl-specific helpers can be removed.
Unfortunately, the cmake output is now slightly more verbose. Before:

    Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test)
    Performing Test int send(int, const void *, size_t, int) (curl_cv_func_send_test) - Failed

Since check_c_source_compiles prints the varname, now you see:

    Performing Test curl_cv_func_send_test
    Performing Test curl_cv_func_send_test - Failed
    Tested: int send(int, const void *, size_t, int)

Compared cmake output with each other using vimdiff, no functional
differences were found. Tested with GCC 4.9.1 and Clang 3.5.0.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-03 09:10:54 +01:00
Peter Wu
aebfd4cfbf cmake: fix gethostby{addr,name}_r in CurlTests
This patch cleans up the automatically-generated (?) code and fixes one
case that will always fail due to syntax error.

HAVE_GETHOSTBYADDR_R_5_REENTRANT always failed because of a trailing
character ("int length;q"). Several parameter type and unused variable
warnings popped up. This causes a detection failure with -Werror.

Observe that the REENTRANT cases are exactly the same as their
non-REENTRANT cases except for a `_REENTRANT` macro definition.
Merge all these pieces and build one big main function with different
cases, but reusing variables where logical.

For the cases where the parameters where NULL, I looked at
lib/hostip4.c to get an idea of the parameters types.

void-cast variables such as 'rc' to avoid -Wuninitialized errors.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-03 09:10:54 +01:00
Peter Wu
b2bb51f339 cmake: drop _BSD_SOURCE macro usage
autotools does not use features.h nor _BSD_SOURCE. As this macro
triggers warnings since glibc 2.20, remove it. It should not have
functional differences.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-03 09:10:54 +01:00
Jakub Zakrzewski
558814e16d Cmake: Build with GSSAPI (MIT or Heimdal)
It tries hard to recognise SDK's on different platforms. On windows MIT
Kerberos installs SDK with other things and puts path into registry.
Heimdal have separate zip archive. On linux pkg-config is tried, then
krb5-config script and finally old-style libs and headers detection.

Command line args:
* CMAKE_USE_GSSAPI - enables GSSAPI detection
* GSS_ROOT_DIR - if set, should point to the root of GSSAPI installation
                 (the one with include and lib directories)
2014-10-09 13:48:31 +02:00
Jakub Zakrzewski
2257deb502 Cmake: Avoid cycle directory dependencies.
Because we prepended libraries to list, CMake had troubles resolving
link directory order as it detected some cycles. Appending to list ensures
that dependencies will preceed dependees.
2014-10-09 13:48:30 +02:00
Jakub Zakrzewski
f646e9075f Cmake: Possibility to use OpenLDAP, OpenSSL, LibSSH2 on windows
At this point I can build libcurl on windows. It provides at least the same
list of protocols as for linux build and works with our software.
2014-08-25 12:44:24 +02:00
Jakub Zakrzewski
ba8795083f Cmake: Removed repeated content from ending blocks
They are unnecesary in modern CMake and removing them improves readability.
2014-08-25 12:44:24 +02:00
Jakub Zakrzewski
06de7d6936 Cmake: Removed some useless empty SET statements.
Undefined variables resolve to empty strings and we do not ever test if
the variable is defined thus those SETs are superfluous.
2014-08-25 12:44:24 +02:00
Jakub Zakrzewski
1269df2e3b Cmake: Don't check for all headers each time
One header at a time is the right way. Apart from that the output on
windows goes from:
...
-- Looking for include files I:/src/libssh2-1.4.3/include/libssh2.h, ws2tcpip.h
-- Looking for include files I:/src/libssh2-1.4.3/include/libssh2.h, ws2tcpip.h
- found
-- Looking for 3 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., wins
ock2.h
-- Looking for 3 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., wins
ock2.h - found
-- Looking for 4 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., stdi
o.h
-- Looking for 4 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., stdi
o.h - found
-- Looking for 5 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., wind
ows.h
-- Looking for 5 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., wind
ows.h - found
-- Looking for 6 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., wins
ock.h
-- Looking for 6 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., wins
ock.h - found
-- Looking for 7 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., sys/
filio.h
-- Looking for 7 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., sys/
filio.h - not found
-- Looking for 7 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., sys/
ioctl.h
-- Looking for 7 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., sys/
ioctl.h - not found
-- Looking for 7 include files I:/src/libssh2-1.4.3/include/libssh2.h, ..., sys/
resource.h
...

To much nicer:
...
-- Looking for ws2tcpip.h
-- Looking for ws2tcpip.h - found
-- Looking for winsock2.h
-- Looking for winsock2.h - found
-- Looking for stdio.h
-- Looking for stdio.h - found
-- Looking for windows.h
-- Looking for windows.h - found
-- Looking for winsock.h
-- Looking for winsock.h - found
-- Looking for sys/filio.h
-- Looking for sys/filio.h - not found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - not found
-- Looking for sys/resource.h
2014-08-25 12:44:24 +02:00
Jakub Zakrzewski
118977f19d Cmake: LibSSH2 detection and use. 2014-08-25 12:44:24 +02:00
Jakub Zakrzewski
88c17d5587 Cmake: Moved macros out of the main CMakeLists.txt 2014-08-25 12:44:24 +02:00
Jakub Zakrzewski
14aa8f0c11 Cmake: Require at least CMake 2.8.
CMake 2.6 is already a bit old. Many bugs have been fixed since
its release. We use 2.8 in our company and we have no intention
of polluting our environment with old software, so 2.6 would
not be tested. This shouldn't be a problem since all one need
to build CMake from source is C and C++ compiler.
2014-08-25 12:44:24 +02:00
Daniel Stenberg
d08ee3c83d cmake: fix Windows build with IPv6 support
Patch-by: "Z98"
2013-11-09 00:07:32 +01:00
Sergei Nikulov
c1400f6f12 cmake: use standard findxxx modules for cmake v2.8+ 2012-09-17 23:22:09 +02:00
Yang Tse
e63c9f8ff3 removed execute file permission 2011-12-30 03:53:25 +01:00
Yang Tse
ed0364343d removed trailing whitespace 2011-12-30 03:36:18 +01:00
Daniel Stenberg
1aeb635cdd sources: update source headers
All C and H files now (should) feature the proper project curl source
code header, which includes basic info, a copyright statement and some
basic disclaimers.
2011-03-10 12:04:33 +01:00
Brad King
651c0bcdf2 CMake: Use upstream CheckTypeSize module
The CheckTypeSize module that comes with CMake 2.6.2 and above does
everything we need and also supports cross-compiling.  Avoid duplicating
an older version of it here.  This also fixes a cross-compiling error
because the old line

  include ("${CMAKE_MODULE_PATH}/CheckTypeSize.cmake")

failed because CMAKE_MODULE_PATH is a search path and not a directory.

Signed-off-by: Brad King <brad.king@kitware.com>
2011-01-06 00:06:29 +01:00
Bill Hoffman
5709a0dca2 CMake fixes for Linux.
Make sure <sys/socket.h> is included if around when testing/using
socklen_t.  Also, disable LDAP if LDAP_H is not found on the system.
2010-03-24 14:07:18 -04:00
Yang Tse
46b112bcd4 replaced tabs with spaces 2010-02-16 13:32:45 +00:00
Yang Tse
a07bc79117 removed trailing whitespace 2010-02-14 19:40:18 +00:00
Bill Hoffman
fb08218a04 BUG: curl did not build with cmake with VS 2005 for two reasons, ws2tcpip.h requires winsock2.h to be included before it with that compiler, and wldap32 is not available with the default install of the compiler, so disable ldap support if that is not found 2009-07-15 19:25:22 +00:00
Bill Hoffman
a8ea1e9ef4 ENH: add optional support for c-ares 2009-07-14 19:03:31 +00:00
Bill Hoffman
744dceaffe ENH: lower case cmake functions and remove tabs and re-indent cmake code 2009-06-09 17:29:16 +00:00
Bill Hoffman
15be673054 ENH: add some cmake docs and fix build with socklen_t 2009-06-06 13:18:01 +00:00
Daniel Stenberg
1272621ebc removed pointless file 2009-04-25 21:01:28 +00:00
Benoit Neil
7e9f7659b3 (Minor update) Moved some utilities to a separate file. 2009-04-09 21:16:28 +00:00
Benoit Neil
9a184e0bb1 Added basic OpenSSL support in CMake scripts (Thanks to Bill Hoffman) 2009-04-02 23:12:22 +00:00
Benoit Neil
4c5307b456 Initial CMake scripts (libcurl only), based on the merge of tetest scripts and mine. These are far to be functionnal yet.
PS: Hello world :)
2009-04-02 13:14:53 +00:00