Problems detecting aio_suspend on FreeBSD

Richard Sharpe realrichardsharpe at gmail.com
Thu Jan 3 14:35:15 MST 2013


Hi folks,

I found some problems detecting aio_suspend in our builds, so I went
looking in the ports collection and found a potential fix, but the fix
was not quite correct.

We are using autoconf 2.62.

Here we the initial fix:

@@ -5859,9 +5900,17 @@
 [AC_MSG_RESULT(no)])

                        AC_MSG_CHECKING(for aio_suspend)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
-[AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
+                       AC_LINK_IFELSE([
+                               #include <aio.h>
+                               #if STDC_HEADERS
+                               #include <stdlib.h>
+                               #include <stddef.h>
+                               #endif
+                               int main() {
+                                       struct aiocb *a[1];
+                                       return aio_suspend((const
struct aiocb**)&a, 1, NULL);
+                               }
+                       ], [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have
aio_suspend]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
                fi

However, the problem seems to be that AC_LINK_IFELSE does not include
confdefs.h by default, and I found I had to use the following (note
the addition of AC_LANGUAGE_SOURCE():

@@ -5833,10 +5833,19 @@
 [AC_MSG_RESULT(no)])

                        AC_MSG_CHECKING(for aio_suspend)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
-[AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
-[AC_MSG_RESULT(no)])
+                       AC_LINK_IFELSE([
+                               AC_LANG_SOURCE()
+                               #include <aio.h>
+                               #if STDC_HEADERS
+                               #include <stdlib.h>
+                               #include <stddef.h>
+                               #endif
+                               int main() {
+                                       struct aiocb a;
+                                       return aio_suspend((const
struct aiocb**)&a, 1, NULL);
+                               }
+                       ], [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have
aio_suspend]) AC_MSG_RESULT(yes)],
+                       [AC_MSG_RESULT(no)])
                fi

                if test x"$samba_cv_HAVE_AIO64" = x"yes"; then

Does anyone have any comments?

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list