m4: Remove assignment of otherwise unused variable RESOLVER_LIBS.
[sliver-openvswitch.git] / m4 / openvswitch.m4
1 # -*- autoconf -*-
2
3 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at:
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 dnl Checks for --enable-coverage and updates CFLAGS and LDFLAGS appropriately.
18 AC_DEFUN([OVS_CHECK_COVERAGE],
19   [AC_REQUIRE([AC_PROG_CC])
20    AC_ARG_ENABLE(
21      [coverage],
22      [AC_HELP_STRING([--enable-coverage],
23                      [Enable gcov coverage tool.])],
24      [case "${enableval}" in
25         (yes) coverage=true ;;
26         (no)  coverage=false ;;
27         (*) AC_MSG_ERROR([bad value ${enableval} for --enable-coverage]) ;;
28       esac],
29      [coverage=false])
30    if $coverage; then
31      CFLAGS="$CFLAGS -O0 --coverage"
32      LDFLAGS="$LDFLAGS --coverage"
33    fi])
34
35 dnl Checks for --enable-ndebug and defines NDEBUG if it is specified.
36 AC_DEFUN([OVS_CHECK_NDEBUG],
37   [AC_ARG_ENABLE(
38      [ndebug],
39      [AC_HELP_STRING([--enable-ndebug],
40                      [Disable debugging features for max performance])],
41      [case "${enableval}" in
42         (yes) ndebug=true ;;
43         (no)  ndebug=false ;;
44         (*) AC_MSG_ERROR([bad value ${enableval} for --enable-ndebug]) ;;
45       esac],
46      [ndebug=false])
47    AM_CONDITIONAL([NDEBUG], [test x$ndebug = xtrue])])
48
49 dnl Checks for ESX.
50 AC_DEFUN([OVS_CHECK_ESX],
51   [AC_CHECK_HEADER([vmware.h],
52                    [ESX=yes],
53                    [ESX=no])
54    AM_CONDITIONAL([ESX], [test "$ESX" = yes])
55    if test "$ESX" = yes; then
56       AC_DEFINE([ESX], [1], [Define to 1 if building on ESX.])
57    fi])
58
59 dnl Checks for WINDOWS.
60 AC_DEFUN([OVS_CHECK_WIN32],
61   [AC_CHECK_HEADER([windows.h],
62                    [WIN32=yes],
63                    [WIN32=no])
64    AM_CONDITIONAL([WIN32], [test "$WIN32" = yes])
65    if test "$WIN32" = yes; then
66       AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
67    fi])
68
69 dnl Checks for Netlink support.
70 AC_DEFUN([OVS_CHECK_NETLINK],
71   [AC_CHECK_HEADER([linux/netlink.h],
72                    [HAVE_NETLINK=yes],
73                    [HAVE_NETLINK=no],
74                    [#include <sys/socket.h>
75    #include <linux/types.h>
76    ])
77    AM_CONDITIONAL([HAVE_NETLINK], [test "$HAVE_NETLINK" = yes])
78    if test "$HAVE_NETLINK" = yes; then
79       AC_DEFINE([HAVE_NETLINK], [1],
80                 [Define to 1 if Netlink protocol is available.])
81    fi])
82
83 dnl Checks for OpenSSL.
84 AC_DEFUN([OVS_CHECK_OPENSSL],
85   [AC_ARG_ENABLE(
86      [ssl],
87      [AC_HELP_STRING([--disable-ssl], [Disable OpenSSL support])],
88      [case "${enableval}" in
89         (yes) ssl=true ;;
90         (no)  ssl=false ;;
91         (*) AC_MSG_ERROR([bad value ${enableval} for --enable-ssl]) ;;
92       esac],
93      [ssl=check])
94
95    if test "$ssl" != false; then
96        AX_CHECK_OPENSSL(
97          [HAVE_OPENSSL=yes],
98          [HAVE_OPENSSL=no
99           if test "$ssl" = check; then
100             AC_MSG_WARN([Cannot find openssl:
101
102 $SSL_PKG_ERRORS
103
104 OpenFlow connections over SSL will not be supported.
105 (You may use --disable-ssl to suppress this warning.)])
106           else
107             AC_MSG_ERROR([Cannot find openssl (use --disable-ssl to configure without SSL support)])
108           fi])
109    else
110        HAVE_OPENSSL=no
111    fi
112    AC_SUBST([HAVE_OPENSSL])
113    AM_CONDITIONAL([HAVE_OPENSSL], [test "$HAVE_OPENSSL" = yes])
114    if test "$HAVE_OPENSSL" = yes; then
115       AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.])
116    fi])
117
118 dnl Checks for libraries needed by lib/socket-util.c.
119 AC_DEFUN([OVS_CHECK_SOCKET_LIBS],
120   [AC_CHECK_LIB([socket], [connect])
121    AC_SEARCH_LIBS([gethostbyname], [resolv])])
122
123 dnl Checks for the directory in which to store the PKI.
124 AC_DEFUN([OVS_CHECK_PKIDIR],
125   [AC_ARG_WITH(
126      [pkidir],
127      AC_HELP_STRING([--with-pkidir=DIR],
128                     [PKI hierarchy directory [[LOCALSTATEDIR/lib/openvswitch/pki]]]),
129      [PKIDIR=$withval],
130      [PKIDIR='${localstatedir}/lib/openvswitch/pki'])
131    AC_SUBST([PKIDIR])])
132
133 dnl Checks for the directory in which to store pidfiles.
134 AC_DEFUN([OVS_CHECK_RUNDIR],
135   [AC_ARG_WITH(
136      [rundir],
137      AC_HELP_STRING([--with-rundir=DIR],
138                     [directory used for pidfiles
139                     [[LOCALSTATEDIR/run/openvswitch]]]),
140      [RUNDIR=$withval],
141      [RUNDIR='${localstatedir}/run/openvswitch'])
142    AC_SUBST([RUNDIR])])
143
144 dnl Checks for the directory in which to store logs.
145 AC_DEFUN([OVS_CHECK_LOGDIR],
146   [AC_ARG_WITH(
147      [logdir],
148      AC_HELP_STRING([--with-logdir=DIR],
149                     [directory used for logs [[LOCALSTATEDIR/log/PACKAGE]]]),
150      [LOGDIR=$withval],
151      [LOGDIR='${localstatedir}/log/${PACKAGE}'])
152    AC_SUBST([LOGDIR])])
153
154 dnl Checks for the directory in which to store the Open vSwitch database.
155 AC_DEFUN([OVS_CHECK_DBDIR],
156   [AC_ARG_WITH(
157      [dbdir],
158      AC_HELP_STRING([--with-dbdir=DIR],
159                     [directory used for conf.db [[SYSCONFDIR/PACKAGE]]]),
160      [DBDIR=$withval],
161      [DBDIR='${sysconfdir}/${PACKAGE}'])
162    AC_SUBST([DBDIR])])
163
164 dnl Defines HAVE_BACKTRACE if backtrace() is found.
165 AC_DEFUN([OVS_CHECK_BACKTRACE],
166   [AC_SEARCH_LIBS([backtrace], [execinfo ubacktrace],
167                   [AC_DEFINE([HAVE_BACKTRACE], [1],
168                              [Define to 1 if you have backtrace(3).])])])
169
170 dnl Checks for __malloc_hook, etc., supported by glibc.
171 AC_DEFUN([OVS_CHECK_MALLOC_HOOKS],
172   [AC_CACHE_CHECK(
173     [whether libc supports hooks for malloc and related functions],
174     [ovs_cv_malloc_hooks],
175     [AC_COMPILE_IFELSE(
176       [AC_LANG_PROGRAM(
177          [#include <malloc.h>
178          ],
179          [(void) __malloc_hook;
180           (void) __realloc_hook;
181           (void) __free_hook;])],
182       [ovs_cv_malloc_hooks=yes],
183       [ovs_cv_malloc_hooks=no])])
184    if test $ovs_cv_malloc_hooks = yes; then
185      AC_DEFINE([HAVE_MALLOC_HOOKS], [1],
186                [Define to 1 if you have __malloc_hook, __realloc_hook, and
187                 __free_hook in <malloc.h>.])
188    fi])
189
190 dnl Checks for valgrind/valgrind.h.
191 AC_DEFUN([OVS_CHECK_VALGRIND],
192   [AC_CHECK_HEADERS([valgrind/valgrind.h])])
193
194 dnl Checks for Python 2.x, x >= 4.
195 AC_DEFUN([OVS_CHECK_PYTHON],
196   [AC_CACHE_CHECK(
197      [for Python 2.x for x >= 4],
198      [ovs_cv_python],
199      [if test -n "$PYTHON"; then
200         ovs_cv_python=$PYTHON
201       else
202         ovs_cv_python=no
203         for binary in python python2.4 python2.5; do
204           ovs_save_IFS=$IFS; IFS=$PATH_SEPARATOR
205           for dir in $PATH; do
206             IFS=$ovs_save_IFS
207             test -z "$dir" && dir=.
208             if test -x "$dir"/"$binary" && "$dir"/"$binary" -c 'import sys
209 if sys.hexversion >= 0x02040000 and sys.hexversion < 0x03000000:
210     sys.exit(0)
211 else:
212     sys.exit(1)'; then
213               ovs_cv_python=$dir/$binary
214               break 2
215             fi
216           done
217         done
218       fi])
219    AC_SUBST([HAVE_PYTHON])
220    AM_MISSING_PROG([PYTHON], [python])
221    if test $ovs_cv_python != no; then
222      PYTHON=$ovs_cv_python
223      HAVE_PYTHON=yes
224    else
225      HAVE_PYTHON=no
226    fi
227    AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
228
229 dnl Checks for dot.
230 AC_DEFUN([OVS_CHECK_DOT],
231   [AC_CACHE_CHECK(
232     [for dot],
233     [ovs_cv_dot],
234     [dnl "dot" writes -V output to stderr:
235      if (dot -V) 2>&1 | grep '^dot - [[gG]]raphviz version' >/dev/null 2>&1; then
236        ovs_cv_dot=yes
237      else
238        ovs_cv_dot=no
239      fi])
240    AM_CONDITIONAL([HAVE_DOT], [test "$ovs_cv_dot" = yes])])
241
242 dnl Checks for pyuic4.
243 AC_DEFUN([OVS_CHECK_PYUIC4],
244   [AC_CACHE_CHECK(
245     [for pyuic4],
246     [ovs_cv_pyuic4],
247     [if (pyuic4 --version) >/dev/null 2>&1; then
248        ovs_cv_pyuic4=pyuic4
249      else
250        ovs_cv_pyuic4=no
251      fi])
252    AM_MISSING_PROG([PYUIC4], [pyuic4])
253    if test $ovs_cv_pyuic4 != no; then
254      PYUIC4=$ovs_cv_pyuic4
255    fi])
256
257 dnl Checks whether $PYTHON supports the module given as $1
258 AC_DEFUN([OVS_CHECK_PYTHON_MODULE],
259   [AC_REQUIRE([OVS_CHECK_PYTHON])
260    AC_CACHE_CHECK(
261      [for $1 Python module],
262      [ovs_cv_py_[]AS_TR_SH([$1])],
263      [ovs_cv_py_[]AS_TR_SH([$1])=no
264       if test $HAVE_PYTHON = yes; then
265         AS_ECHO(["running $PYTHON -c 'import $1
266 import sys
267 sys.exit(0)'..."]) >&AS_MESSAGE_LOG_FD 2>&1
268         if $PYTHON -c 'import $1
269 import sys
270 sys.exit(0)' >&AS_MESSAGE_LOG_FD 2>&1; then
271           ovs_cv_py_[]AS_TR_SH([$1])=yes
272         fi
273       fi])])
274
275 dnl Checks for Python modules needed by ovsdbmonitor.
276 AC_DEFUN([OVS_CHECK_OVSDBMONITOR],
277   [OVS_CHECK_PYTHON_MODULE([PySide.QtCore])
278    OVS_CHECK_PYTHON_MODULE([PyQt4.QtCore])
279    OVS_CHECK_PYTHON_MODULE([twisted.conch.ssh])
280    OVS_CHECK_PYTHON_MODULE([twisted.internet])
281    OVS_CHECK_PYTHON_MODULE([twisted.application])
282    OVS_CHECK_PYTHON_MODULE([json])
283    OVS_CHECK_PYTHON_MODULE([zope.interface])
284    if (test $ovs_cv_py_PySide_QtCore = yes \
285        || test $ovs_cv_py_PyQt4_QtCore = yes) \
286       && test $ovs_cv_py_twisted_conch_ssh = yes \
287       && test $ovs_cv_py_twisted_internet = yes \
288       && test $ovs_cv_py_twisted_application = yes \
289       && test $ovs_cv_py_json = yes \
290       && test $ovs_cv_py_zope_interface = yes; then
291      BUILD_OVSDBMONITOR=yes
292    else
293      BUILD_OVSDBMONITOR=no
294    fi
295    AC_MSG_CHECKING([whether to build ovsdbmonitor])
296    AC_MSG_RESULT([$BUILD_OVSDBMONITOR])
297    AM_CONDITIONAL([BUILD_OVSDBMONITOR], [test $BUILD_OVSDBMONITOR = yes])])
298
299 dnl Checks for missing python modules at build time
300 AC_DEFUN([OVS_CHECK_PYTHON_COMPAT],
301   [OVS_CHECK_PYTHON_MODULE([uuid])
302    if test $ovs_cv_py_uuid = yes; then
303      INCLUDE_PYTHON_COMPAT=no
304    else
305      INCLUDE_PYTHON_COMPAT=yes
306    fi
307    AC_MSG_CHECKING([whether to add python/compat to PYTHONPATH])
308    AC_MSG_RESULT([$INCLUDE_PYTHON_COMPAT])
309    AM_CONDITIONAL([INCLUDE_PYTHON_COMPAT], [test $INCLUDE_PYTHON_COMPAT = yes])])
310
311 # OVS_LINK2_IFELSE(SOURCE1, SOURCE2, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
312 # -------------------------------------------------------------
313 # Based on AC_LINK_IFELSE, but tries to link both SOURCE1 and SOURCE2
314 # into a program.
315 #
316 # This macro is borrowed from acinclude.m4 in GNU PSPP, which has the
317 # following license:
318 #
319 #     Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
320 #     This file is free software; the Free Software Foundation
321 #     gives unlimited permission to copy and/or distribute it,
322 #     with or without modifications, as long as this notice is preserved.
323 #
324 m4_define([OVS_LINK2_IFELSE],
325 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
326 mv conftest.$ac_ext conftest1.$ac_ext
327 m4_ifvaln([$2], [AC_LANG_CONFTEST([$2])])dnl
328 mv conftest.$ac_ext conftest2.$ac_ext
329 rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
330 ovs_link2='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest1.$ac_ext conftest2.$ac_ext $LIBS >&5'
331 AS_IF([_AC_DO_STDERR($ovs_link2) && {
332          test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
333          test ! -s conftest.err
334        } && test -s conftest$ac_exeext && {
335          test "$cross_compiling" = yes ||
336          AS_TEST_X([conftest$ac_exeext])
337        }],
338       [$3],
339       [echo "$as_me: failed source file 1 of 2 was:" >&5
340 sed 's/^/| /' conftest1.$ac_ext >&5
341 echo "$as_me: failed source file 2 of 2 was:" >&5
342 sed 's/^/| /' conftest2.$ac_ext >&5
343         $4])
344 dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
345 dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
346 dnl as it would interfere with the next link command.
347 rm -rf conftest.dSYM conftest1.dSYM conftest2.dSYM
348 rm -f core conftest.err conftest1.err conftest2.err
349 rm -f conftest1.$ac_objext conftest2.$ac_objext conftest*_ipa8_conftest*.oo
350 rm -f conftest$ac_exeext
351 rm -f m4_ifval([$1], [conftest1.$ac_ext]) m4_ifval([$2], [conftest1.$ac_ext])[]dnl
352 ])# OVS_LINK2_IFELSE
353
354 dnl Defines USE_LINKER_SECTIONS to 1 if the compiler supports putting
355 dnl variables in sections with user-defined names and the linker
356 dnl automatically defines __start_SECNAME and __stop_SECNAME symbols
357 dnl that designate the start and end of the sections.
358 AC_DEFUN([OVS_CHECK_LINKER_SECTIONS],
359   [AC_CACHE_CHECK(
360     [for user-defined linker section support],
361     [ovs_cv_use_linker_sections],
362     [OVS_LINK2_IFELSE(
363       [AC_LANG_SOURCE(
364         [int a __attribute__((__section__("mysection"))) = 1;
365          int b __attribute__((__section__("mysection"))) = 2;
366          int c __attribute__((__section__("mysection"))) = 3;])],
367       [AC_LANG_PROGRAM(
368         [#include <stdio.h>
369          extern int __start_mysection;
370          extern int __stop_mysection;],
371         [int n_ints = &__stop_mysection - &__start_mysection;
372          int *i;
373          for (i = &__start_mysection; i < &__start_mysection + n_ints; i++) {
374              printf("%d\n", *i);
375          }])],
376       [ovs_cv_use_linker_sections=yes],
377       [ovs_cv_use_linker_sections=no])])
378    if test $ovs_cv_use_linker_sections = yes; then
379      AC_DEFINE([USE_LINKER_SECTIONS], [1],
380                [Define to 1 if the compiler support putting variables
381                 into sections with user-defined names and the linker
382                 automatically defines __start_SECNAME and __stop_SECNAME
383                 symbols that designate the start and end of the section.])
384    fi
385    AM_CONDITIONAL(
386      [USE_LINKER_SECTIONS], [test $ovs_cv_use_linker_sections = yes])])
387
388 dnl Checks for groff.
389 AC_DEFUN([OVS_CHECK_GROFF],
390   [AC_CACHE_CHECK(
391     [for groff],
392     [ovs_cv_groff],
393     [if (groff -v) >/dev/null 2>&1; then
394        ovs_cv_groff=yes
395      else
396        ovs_cv_groff=no
397      fi])
398    AM_CONDITIONAL([HAVE_GROFF], [test "$ovs_cv_groff" = yes])])
399
400 dnl Checks for thread-local storage support.
401 dnl
402 dnl Checks whether the compiler and linker support the C11
403 dnl thread_local macro from <threads.h>, and if so defines
404 dnl HAVE_THREAD_LOCAL.  If not, checks whether the compiler and linker
405 dnl support the GCC __thread extension, and if so defines
406 dnl HAVE___THREAD.
407 AC_DEFUN([OVS_CHECK_TLS],
408   [AC_CACHE_CHECK(
409      [whether $CC has <threads.h> that supports thread_local],
410      [ovs_cv_thread_local],
411      [AC_LINK_IFELSE(
412         [AC_LANG_PROGRAM([#include <threads.h>
413 static thread_local int var;], [return var;])],
414         [ovs_cv_thread_local=yes],
415         [ovs_cv_thread_local=no])])
416    if test $ovs_cv_thread_local = yes; then
417      AC_DEFINE([HAVE_THREAD_LOCAL], [1],
418                [Define to 1 if the C compiler and linker supports the C11
419                 thread_local matcro defined in <threads.h>.])
420    else
421      AC_CACHE_CHECK(
422        [whether $CC supports __thread],
423        [ovs_cv___thread],
424        [AC_LINK_IFELSE(
425           [AC_LANG_PROGRAM([static __thread int var;], [return var;])],
426           [ovs_cv___thread=yes],
427           [ovs_cv___thread=no])])
428      if test $ovs_cv___thread = yes; then
429        AC_DEFINE([HAVE___THREAD], [1],
430                  [Define to 1 if the C compiler and linker supports the
431                   GCC __thread extenions.])
432      fi
433    fi])
434
435 dnl OVS_CHECK_ATOMIC_LIBS
436 dnl
437 dnl Check to see if -latomic is need for GCC atomic built-ins.
438 AC_DEFUN([OVS_CHECK_ATOMIC_LIBS],
439    [AC_SEARCH_LIBS([__atomic_load_8], [atomic])])
440
441 dnl OVS_CHECK_GCC4_ATOMICS
442 dnl
443 dnl Checks whether the compiler and linker support GCC 4.0+ atomic built-ins.
444 dnl A compile-time only check is not enough because the compiler defers
445 dnl unimplemented built-ins to libgcc, which sometimes also lacks
446 dnl implementations.
447 AC_DEFUN([OVS_CHECK_GCC4_ATOMICS],
448   [AC_CACHE_CHECK(
449      [whether $CC supports GCC 4.0+ atomic built-ins],
450      [ovs_cv_gcc4_atomics],
451      [AC_LINK_IFELSE(
452         [AC_LANG_PROGRAM([[#include <stdlib.h>
453
454 #define ovs_assert(expr) if (!(expr)) abort();
455 #define TEST_ATOMIC_TYPE(TYPE)                  \
456     {                                           \
457         TYPE x = 1;                             \
458         TYPE orig;                              \
459                                                 \
460         __sync_synchronize();                   \
461         ovs_assert(x == 1);                     \
462                                                 \
463         __sync_synchronize();                   \
464         x = 3;                                  \
465         __sync_synchronize();                   \
466         ovs_assert(x == 3);                     \
467                                                 \
468         orig = __sync_fetch_and_add(&x, 1);     \
469         ovs_assert(orig == 3);                  \
470         __sync_synchronize();                   \
471         ovs_assert(x == 4);                     \
472                                                 \
473         orig = __sync_fetch_and_sub(&x, 2);     \
474         ovs_assert(orig == 4);                  \
475         __sync_synchronize();                   \
476         ovs_assert(x == 2);                     \
477                                                 \
478         orig = __sync_fetch_and_or(&x, 6);      \
479         ovs_assert(orig == 2);                  \
480         __sync_synchronize();                   \
481         ovs_assert(x == 6);                     \
482                                                 \
483         orig = __sync_fetch_and_and(&x, 10);    \
484         ovs_assert(orig == 6);                  \
485         __sync_synchronize();                   \
486         ovs_assert(x == 2);                     \
487                                                 \
488         orig = __sync_fetch_and_xor(&x, 10);    \
489         ovs_assert(orig == 2);                  \
490         __sync_synchronize();                   \
491         ovs_assert(x == 8);                     \
492     }]], [dnl
493 TEST_ATOMIC_TYPE(char);
494 TEST_ATOMIC_TYPE(unsigned char);
495 TEST_ATOMIC_TYPE(signed char);
496 TEST_ATOMIC_TYPE(short);
497 TEST_ATOMIC_TYPE(unsigned short);
498 TEST_ATOMIC_TYPE(int);
499 TEST_ATOMIC_TYPE(unsigned int);
500 TEST_ATOMIC_TYPE(long int);
501 TEST_ATOMIC_TYPE(unsigned long int);
502 TEST_ATOMIC_TYPE(long long int);
503 TEST_ATOMIC_TYPE(unsigned long long int);
504 ])],
505         [ovs_cv_gcc4_atomics=yes],
506         [ovs_cv_gcc4_atomics=no])])
507    if test $ovs_cv_gcc4_atomics = yes; then
508      AC_DEFINE([HAVE_GCC4_ATOMICS], [1],
509                [Define to 1 if the C compiler and linker supports the GCC 4.0+
510                 atomic built-ins.])
511    fi])
512
513 dnl OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(SIZE)
514 dnl
515 dnl Checks __atomic_always_lock_free(SIZE, 0)
516 AC_DEFUN([OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE], 
517   [AC_CACHE_CHECK(
518     [value of __atomic_always_lock_free($1)],
519     [ovs_cv_atomic_always_lock_free_$1],
520     [AC_COMPUTE_INT(
521         [ovs_cv_atomic_always_lock_free_$1],
522         [__atomic_always_lock_free($1, 0)],
523         [],
524         [ovs_cv_atomic_always_lock_free_$1=unsupported])])
525    if test ovs_cv_atomic_always_lock_free_$1 != unsupported; then
526      AC_DEFINE_UNQUOTED(
527        [ATOMIC_ALWAYS_LOCK_FREE_$1B],
528        [$ovs_cv_atomic_always_lock_free_$1],
529        [If the C compiler is GCC 4.7 or later, define to the return value of
530         __atomic_always_lock_free($1, 0).  If the C compiler is not GCC or is
531         an older version of GCC, the value does not matter.])
532    fi])
533
534 dnl OVS_CHECK_POSIX_AIO
535 AC_DEFUN([OVS_CHECK_POSIX_AIO],
536   [AC_SEARCH_LIBS([aio_write], [rt])
537    AM_CONDITIONAL([HAVE_POSIX_AIO], [test "$ac_cv_search_aio_write" != no])])