~imalinovskiy/rdm/0.8

« back to all changes in this revision

Viewing changes to 3rdparty/qredisclient/3rdparty/libssh2/acinclude.m4

  • Committer: RDM Bot
  • Date: 2016-02-04 11:29:17 UTC
  • Revision ID: git-v1:92436de8ed24fe0a57651f4a61caba27995ad55b
Pull updates from https://github.com/uglide/RedisDesktopManager

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
dnl **********************************************************************
 
3
dnl CURL_DETECT_ICC ([ACTION-IF-YES])
 
4
dnl
 
5
dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
 
6
dnl sets the $ICC variable to "yes" or "no"
 
7
dnl **********************************************************************
 
8
AC_DEFUN([CURL_DETECT_ICC],
 
9
[
 
10
    ICC="no"
 
11
    AC_MSG_CHECKING([for icc in use])
 
12
    if test "$GCC" = "yes"; then
 
13
       dnl check if this is icc acting as gcc in disguise
 
14
       AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
 
15
         dnl action if the text is found, this it has not been replaced by the
 
16
         dnl cpp
 
17
         ICC="no",
 
18
         dnl the text was not found, it was replaced by the cpp
 
19
         ICC="yes"
 
20
         AC_MSG_RESULT([yes])
 
21
         [$1]
 
22
       )
 
23
    fi
 
24
    if test "$ICC" = "no"; then
 
25
        # this is not ICC
 
26
        AC_MSG_RESULT([no])
 
27
    fi
 
28
])
 
29
 
 
30
dnl We create a function for detecting which compiler we use and then set as
 
31
dnl pendantic compiler options as possible for that particular compiler. The
 
32
dnl options are only used for debug-builds.
 
33
 
 
34
AC_DEFUN([CURL_CC_DEBUG_OPTS],
 
35
[
 
36
    if test "z$ICC" = "z"; then
 
37
      CURL_DETECT_ICC
 
38
    fi
 
39
 
 
40
    if test "$GCC" = "yes"; then
 
41
 
 
42
       dnl figure out gcc version!
 
43
       AC_MSG_CHECKING([gcc version])
 
44
       gccver=`$CC -dumpversion`
 
45
       num1=`echo $gccver | cut -d . -f1`
 
46
       num2=`echo $gccver | cut -d . -f2`
 
47
       gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
 
48
       AC_MSG_RESULT($gccver)
 
49
 
 
50
       if test "$ICC" = "yes"; then
 
51
         dnl this is icc, not gcc.
 
52
 
 
53
         dnl ICC warnings we ignore:
 
54
         dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
 
55
         dnl   "invalid format string conversion"
 
56
         dnl * 279 warns on static conditions in while expressions
 
57
         dnl * 981 warns on "operands are evaluated in unspecified order"
 
58
         dnl * 1418 "external definition with no prior declaration"
 
59
         dnl * 1419 warns on "external declaration in primary source file"
 
60
         dnl   which we know and do on purpose.
 
61
 
 
62
         WARN="-wd279,269,981,1418,1419"
 
63
 
 
64
         if test "$gccnum" -gt "600"; then
 
65
            dnl icc 6.0 and older doesn't have the -Wall flag
 
66
            WARN="-Wall $WARN"
 
67
         fi
 
68
       else dnl $ICC = yes
 
69
         dnl this is a set of options we believe *ALL* gcc versions support:
 
70
         WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
 
71
 
 
72
         dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
 
73
 
 
74
         if test "$gccnum" -ge "207"; then
 
75
           dnl gcc 2.7 or later
 
76
           WARN="$WARN -Wmissing-declarations"
 
77
         fi
 
78
 
 
79
         if test "$gccnum" -gt "295"; then
 
80
           dnl only if the compiler is newer than 2.95 since we got lots of
 
81
           dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
 
82
           dnl gcc 2.95.4 on FreeBSD 4.9!
 
83
           WARN="$WARN -Wundef -Wno-long-long -Wsign-compare"
 
84
         fi
 
85
 
 
86
         if test "$gccnum" -ge "296"; then
 
87
           dnl gcc 2.96 or later
 
88
           WARN="$WARN -Wfloat-equal"
 
89
         fi
 
90
 
 
91
         if test "$gccnum" -gt "296"; then
 
92
           dnl this option does not exist in 2.96
 
93
           WARN="$WARN -Wno-format-nonliteral"
 
94
         fi
 
95
 
 
96
         dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
 
97
         dnl on i686-Linux as it gives us heaps with false positives.
 
98
         dnl Also, on gcc 4.0.X it is totally unbearable and complains all
 
99
         dnl over making it unusable for generic purposes. Let's not use it.
 
100
 
 
101
         if test "$gccnum" -ge "303"; then
 
102
           dnl gcc 3.3 and later
 
103
           WARN="$WARN -Wendif-labels -Wstrict-prototypes"
 
104
         fi
 
105
 
 
106
         if test "$gccnum" -ge "304"; then
 
107
           # try these on gcc 3.4
 
108
           WARN="$WARN -Wdeclaration-after-statement"
 
109
         fi
 
110
 
 
111
         for flag in $CPPFLAGS; do
 
112
           case "$flag" in
 
113
            -I*)
 
114
              dnl Include path, provide a -isystem option for the same dir
 
115
              dnl to prevent warnings in those dirs. The -isystem was not very
 
116
              dnl reliable on earlier gcc versions.
 
117
              add=`echo $flag | sed 's/^-I/-isystem /g'`
 
118
              WARN="$WARN $add"
 
119
              ;;
 
120
           esac
 
121
         done
 
122
 
 
123
       fi dnl $ICC = no
 
124
 
 
125
       CFLAGS="$CFLAGS $WARN"
 
126
 
 
127
      AC_MSG_NOTICE([Added this set of compiler options: $WARN])
 
128
 
 
129
    else dnl $GCC = yes
 
130
 
 
131
      AC_MSG_NOTICE([Added no extra compiler options])
 
132
 
 
133
    fi dnl $GCC = yes
 
134
 
 
135
    dnl strip off optimizer flags
 
136
    NEWFLAGS=""
 
137
    for flag in $CFLAGS; do
 
138
      case "$flag" in
 
139
      -O*)
 
140
        dnl echo "cut off $flag"
 
141
        ;;
 
142
      *)
 
143
        NEWFLAGS="$NEWFLAGS $flag"
 
144
        ;;
 
145
      esac
 
146
    done
 
147
    CFLAGS=$NEWFLAGS
 
148
 
 
149
]) dnl end of AC_DEFUN()
 
150
 
 
151
dnl CURL_CHECK_NONBLOCKING_SOCKET
 
152
dnl -------------------------------------------------
 
153
dnl Check for how to set a socket to non-blocking state. There seems to exist
 
154
dnl four known different ways, with the one used almost everywhere being POSIX
 
155
dnl and XPG3, while the other different ways for different systems (old BSD,
 
156
dnl Windows and Amiga).
 
157
dnl
 
158
dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
 
159
dnl O_NONBLOCK define is found but does not work. This condition is attempted
 
160
dnl to get caught in this script by using an excessive number of #ifdefs...
 
161
dnl
 
162
AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
 
163
[
 
164
  AC_MSG_CHECKING([non-blocking sockets style])
 
165
 
 
166
  AC_TRY_COMPILE([
 
167
/* headers for O_NONBLOCK test */
 
168
#include <sys/types.h>
 
169
#include <unistd.h>
 
170
#include <fcntl.h>
 
171
],[
 
172
/* try to compile O_NONBLOCK */
 
173
 
 
174
#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 
175
# if defined(__SVR4) || defined(__srv4__)
 
176
#  define PLATFORM_SOLARIS
 
177
# else
 
178
#  define PLATFORM_SUNOS4
 
179
# endif
 
180
#endif
 
181
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
 
182
# define PLATFORM_AIX_V3
 
183
#endif
 
184
 
 
185
#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
 
186
#error "O_NONBLOCK does not work on this platform"
 
187
#endif
 
188
  int socket;
 
189
  int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
 
190
],[
 
191
dnl the O_NONBLOCK test was fine
 
192
nonblock="O_NONBLOCK"
 
193
AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets])
 
194
],[
 
195
dnl the code was bad, try a different program now, test 2
 
196
 
 
197
  AC_TRY_COMPILE([
 
198
/* headers for FIONBIO test */
 
199
#include <unistd.h>
 
200
#include <stropts.h>
 
201
],[
 
202
/* FIONBIO source test (old-style unix) */
 
203
 int socket;
 
204
 int flags = ioctl(socket, FIONBIO, &flags);
 
205
],[
 
206
dnl FIONBIO test was good
 
207
nonblock="FIONBIO"
 
208
AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
 
209
],[
 
210
dnl FIONBIO test was also bad
 
211
dnl the code was bad, try a different program now, test 3
 
212
 
 
213
  AC_TRY_COMPILE([
 
214
/* headers for ioctlsocket test (Windows) */
 
215
#undef inline
 
216
#ifdef HAVE_WINDOWS_H
 
217
#ifndef WIN32_LEAN_AND_MEAN
 
218
#define WIN32_LEAN_AND_MEAN
 
219
#endif
 
220
#include <windows.h>
 
221
#ifdef HAVE_WINSOCK2_H
 
222
#include <winsock2.h>
 
223
#else
 
224
#ifdef HAVE_WINSOCK_H
 
225
#include <winsock.h>
 
226
#endif
 
227
#endif
 
228
#endif
 
229
],[
 
230
/* ioctlsocket source code */
 
231
 SOCKET sd;
 
232
 unsigned long flags = 0;
 
233
 sd = socket(0, 0, 0);
 
234
 ioctlsocket(sd, FIONBIO, &flags);
 
235
],[
 
236
dnl ioctlsocket test was good
 
237
nonblock="ioctlsocket"
 
238
AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets])
 
239
],[
 
240
dnl ioctlsocket didnt compile!, go to test 4
 
241
 
 
242
  AC_TRY_LINK([
 
243
/* headers for IoctlSocket test (Amiga?) */
 
244
#include <sys/ioctl.h>
 
245
],[
 
246
/* IoctlSocket source code */
 
247
 int socket;
 
248
 int flags = IoctlSocket(socket, FIONBIO, (long)1);
 
249
],[
 
250
dnl ioctlsocket test was good
 
251
nonblock="IoctlSocket"
 
252
AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets])
 
253
],[
 
254
dnl Ioctlsocket didnt compile, do test 5!
 
255
  AC_TRY_COMPILE([
 
256
/* headers for SO_NONBLOCK test (BeOS) */
 
257
#include <socket.h>
 
258
],[
 
259
/* SO_NONBLOCK source code */
 
260
 long b = 1;
 
261
 int socket;
 
262
 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
 
263
],[
 
264
dnl the SO_NONBLOCK test was good
 
265
nonblock="SO_NONBLOCK"
 
266
AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets])
 
267
],[
 
268
dnl test 5 didnt compile!
 
269
nonblock="nada"
 
270
AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets])
 
271
])
 
272
dnl end of fifth test
 
273
 
 
274
])
 
275
dnl end of forth test
 
276
 
 
277
])
 
278
dnl end of third test
 
279
 
 
280
])
 
281
dnl end of second test
 
282
 
 
283
])
 
284
dnl end of non-blocking try-compile test
 
285
  AC_MSG_RESULT($nonblock)
 
286
 
 
287
  if test "$nonblock" = "nada"; then
 
288
    AC_MSG_WARN([non-block sockets disabled])
 
289
  fi
 
290
])
 
291
 
 
292
dnl CURL_CHECK_NEED_REENTRANT_SYSTEM
 
293
dnl -------------------------------------------------
 
294
dnl Checks if the preprocessor _REENTRANT definition
 
295
dnl must be unconditionally done for this platform.
 
296
dnl Internal macro for CURL_CONFIGURE_REENTRANT.
 
297
 
 
298
AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [
 
299
  case $host in
 
300
    *-*-solaris* | *-*-hpux*)
 
301
      tmp_need_reentrant="yes"
 
302
      ;;
 
303
    *)
 
304
      tmp_need_reentrant="no"
 
305
      ;;
 
306
  esac
 
307
])
 
308
 
 
309
 
 
310
dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
 
311
dnl -------------------------------------------------
 
312
dnl This macro ensures that configuration tests done
 
313
dnl after this will execute with preprocessor symbol
 
314
dnl _REENTRANT defined. This macro also ensures that
 
315
dnl the generated config file defines NEED_REENTRANT
 
316
dnl and that in turn setup.h will define _REENTRANT.
 
317
dnl Internal macro for CURL_CONFIGURE_REENTRANT.
 
318
 
 
319
AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
 
320
AC_DEFINE(NEED_REENTRANT, 1,
 
321
  [Define to 1 if _REENTRANT preprocessor symbol must be defined.])
 
322
cat >>confdefs.h <<_EOF
 
323
#ifndef _REENTRANT
 
324
#  define _REENTRANT
 
325
#endif
 
326
_EOF
 
327
])
 
328
 
 
329
 
 
330
dnl CURL_CONFIGURE_REENTRANT
 
331
dnl -------------------------------------------------
 
332
dnl This first checks if the preprocessor _REENTRANT
 
333
dnl symbol is already defined. If it isn't currently
 
334
dnl defined a set of checks are performed to verify
 
335
dnl if its definition is required to make visible to
 
336
dnl the compiler a set of *_r functions. Finally, if
 
337
dnl _REENTRANT is already defined or needed it takes
 
338
dnl care of making adjustments necessary to ensure
 
339
dnl that it is defined equally for further configure
 
340
dnl tests and generated config file.
 
341
 
 
342
AC_DEFUN([CURL_CONFIGURE_REENTRANT], [
 
343
  AC_PREREQ([2.50])dnl
 
344
  #
 
345
  AC_MSG_CHECKING([if _REENTRANT is already defined])
 
346
  AC_COMPILE_IFELSE([
 
347
    AC_LANG_PROGRAM([[
 
348
    ]],[[
 
349
#ifdef _REENTRANT
 
350
      int dummy=1;
 
351
#else
 
352
      force compilation error
 
353
#endif
 
354
    ]])
 
355
  ],[
 
356
    AC_MSG_RESULT([yes])
 
357
    tmp_reentrant_initially_defined="yes"
 
358
  ],[
 
359
    AC_MSG_RESULT([no])
 
360
    tmp_reentrant_initially_defined="no"
 
361
  ])
 
362
  #
 
363
  if test "$tmp_reentrant_initially_defined" = "no"; then
 
364
    AC_MSG_CHECKING([if _REENTRANT is actually needed])
 
365
    CURL_CHECK_NEED_REENTRANT_SYSTEM
 
366
 
 
367
    if test "$tmp_need_reentrant" = "yes"; then
 
368
      AC_MSG_RESULT([yes])
 
369
    else
 
370
      AC_MSG_RESULT([no])
 
371
    fi
 
372
  fi
 
373
  #
 
374
  AC_MSG_CHECKING([if _REENTRANT is onwards defined])
 
375
  if test "$tmp_reentrant_initially_defined" = "yes" ||
 
376
    test "$tmp_need_reentrant" = "yes"; then
 
377
    CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
 
378
    AC_MSG_RESULT([yes])
 
379
  else
 
380
    AC_MSG_RESULT([no])
 
381
  fi
 
382
  #
 
383
])
 
384