Bug 9546 - Configure does not reliably detect aio_suspend on FreeBSD
Summary: Configure does not reliably detect aio_suspend on FreeBSD
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Build environment (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
: 9547 (view as bug list)
Depends on:
Blocks: 9547
  Show dependency treegraph
 
Reported: 2013-01-07 17:13 UTC by Richard Sharpe
Modified: 2013-02-09 01:51 UTC (History)
1 user (show)

See Also:


Attachments
Patch (927 bytes, patch)
2013-01-07 18:56 UTC, Volker Lendecke
rsharpe: review+
jra: review+
Details
git-am fix for master and 4.0.x. (2.04 KB, patch)
2013-01-07 20:54 UTC, Jeremy Allison
vl: review+
Details
Patch (2.02 KB, patch)
2013-01-09 09:19 UTC, Volker Lendecke
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sharpe 2013-01-07 17:13:38 UTC
I am finding this problem with configure.in on FreeBSD 8.0

configure:82175: checking for aio_suspend
configure:82187: gcc -o conftest -I/usr/include  -O0 -g -I/home/rsharpe/dev-src/
buildroot/tools/x86_gcc4.2.4/usr/include -DPANZURA_DEV -I/usr/include  -I/home/r
sharpe/dev-src/buildroot/../pixel8/replock -I/home/rsharpe/dev-src/buildroot/bui
ld/cloudcc/build_x86_64/samba-3.6.6/lib/tdb/include -I/home/rsharpe/dev-src/buil
droot/build/cloudcc/build_x86_64/root/usr/include -I/home/rsharpe/dev-src/buildr
oot/build/cloudcc/build_x86_64/tools/x86_gcc4.2.4/usr/include -I/home/rsharpe/de
v-src/buildroot/../pixel8/pz_cifsaudit -Iinclude -I./include  -I. -I. -I./../lib
/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt -I/usr/include -DLD
AP_DEPRECATED   --sysroot /home/rsharpe/dev-src/buildroot/tools/x86_gcc4.2.4 -L/
home/rsharpe/dev-src/buildroot/tools/x86_gcc4.2.4/lib -L/home/rsharpe/dev-src/bu
ildroot/tools/x86_gcc4.2.4/usr/lib -g -L/home/rsharpe/dev-src/buildroot/build/cl
oudcc/build_x86_64/root/lib -L/home/rsharpe/dev-src/buildroot/build/cloudcc/buil
d_x86_64/samba-3.6.6/source3 -L/home/rsharpe/dev-src/buildroot/build/cloudcc/bui
ld_x86_64/samba-3.6.6/source3/bin -L/home/rsharpe/dev-src/buildroot/build/cloudc
c/build_x86_64/pz_cifsaudit -L/home/rsharpe/dev-src/buildroot/build/cloudcc/buil
d_x86_64/licd/build/FreeBSD/export/dist/lib -rpath /home/rsharpe/dev-src/buildro
ot/tools/x86_gcc4.2.4/lib -rpath /home/rsharpe/dev-src/buildroot/tools/x86_gcc4.
2.4/usr/lib -L./bin -L/usr/lib conftest.c  -lexecinfo -liconv -lrt >&5
conftest.c: In function 'main':
conftest.c:2: error: 'NULL' undeclared (first use in this function)
conftest.c:2: error: (Each undeclared identifier is reported only once
conftest.c:2: error: for each function it appears in.)
conftest.c:2: warning: passing argument 1 of 'aio_suspend' from incompatible poi
nter type
configure:82194: $? = 1
configure: failed program was:
| #include <aio.h>
| int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }
configure:82212: result: no
Comment 1 Richard Sharpe 2013-01-07 17:25:15 UTC
The following patch fixes this problem:

From 57c6874ad1a742c5d50bb133f16b7b8a8b9f6faf Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 7 Jan 2013 11:06:15 +0100
Subject: [PATCH] configure: Fix aio_suspend detection on FreeBSD

NULL is not defined without some includes
---
 source3/configure.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/configure.in b/source3/configure.in
index d8d3a1f..7266000 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -5826,7 +5826,7 @@ int main() { struct aiocb a; return aio_cancel(1, &a); }],
 
 			AC_MSG_CHECKING(for aio_suspend)
 			AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
+int main() { struct aiocb a; struct timespec t; return aio_suspend(&a, 1, &t); }],
 [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 		fi
-- 
1.7.9.5


However, that should be const struct timespec t; to avoid a warning :-)
Comment 2 Volker Lendecke 2013-01-07 18:56:05 UTC
Created attachment 8387 [details]
Patch

Same patch in a more digestable format. Jeremy, as Richard can't ack patches, can you put your +1 to this?

Thanks,

Volker
Comment 3 Volker Lendecke 2013-01-07 18:57:15 UTC
(In reply to comment #1)

> However, that should be const struct timespec t; to avoid a warning :-)

The warning was for argument 1 of aio_suspend. Not sure how to fix that. I did try some variations, but I failed.
Comment 4 Richard Sharpe 2013-01-07 19:09:01 UTC
Comment on attachment 8387 [details]
Patch

I think I can review bugs now that I am using the correct account.
Comment 5 Jeremy Allison 2013-01-07 20:23:49 UTC
Comment on attachment 8387 [details]
Patch

Looks good to me !

Jeremy.
Comment 6 Volker Lendecke 2013-01-07 20:32:14 UTC
Karo, please pick for v3-6-test and -stable.

Thanks,

Volker
Comment 7 Jeremy Allison 2013-01-07 20:54:36 UTC
Created attachment 8388 [details]
git-am fix for master and 4.0.x.

Same fix applied to the WAF build also.

Jeremy.
Comment 8 Karolin Seeger 2013-01-09 08:38:28 UTC
*** Bug 9547 has been marked as a duplicate of this bug. ***
Comment 9 Karolin Seeger 2013-01-09 08:44:10 UTC
Pushed to autobuild-master.
Comment 10 Karolin Seeger 2013-01-09 08:51:01 UTC
(In reply to comment #9)
> Pushed to autobuild-master.

Failing with:

/usr/bin/m4:configure.in:5388: ERROR: end of file in string
autom4te: /usr/bin/m4 failed with exit status: 1
autoheader2.50: '/usr/bin/autom4te' failed with exit status: 1
ERROR running autoheader
Comment 11 Volker Lendecke 2013-01-09 09:19:18 UTC
Created attachment 8397 [details]
Patch

Jeremy, please push to master if you're okay with this. Note the missing ])
Comment 12 Volker Lendecke 2013-01-14 20:58:20 UTC
Comment on attachment 8397 [details]
Patch

Jeremy, ping :-)
Comment 13 Jeremy Allison 2013-01-14 21:34:19 UTC
Comment on attachment 8397 [details]
Patch

Pushed to master.
Comment 14 Jeremy Allison 2013-01-14 21:35:07 UTC
Re-assigned to Karolin for inclusion in 3.6.next, 4.0.next.
Jeremy.
Comment 15 Karolin Seeger 2013-01-16 09:06:16 UTC
Pushed to v3-6-test and autobuild-v4-0-test.
Comment 16 Karolin Seeger 2013-01-17 08:01:36 UTC
Pushed to v4-0-test.
Closing out bug report.

Thanks!
Comment 17 Timur Bakeyev 2013-02-09 00:52:35 UTC
Volker, can we change this test for more more compliant port version:

- conf.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt')
+ conf.CHECK_CODE('const struct aiocb * const a[1]; struct timespec t; return aio_suspend(a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt')
Comment 18 Richard Sharpe 2013-02-09 01:09:24 UTC
(In reply to comment #17)
> Volker, can we change this test for more more compliant port version:
> 
> - conf.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1,
> &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h',
> lib='aio rt')
> + conf.CHECK_CODE('const struct aiocb * const a[1]; struct timespec t; return
> aio_suspend(a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend',
> headers='aio.h', lib='aio rt')

This bug has been closed out, so you will have to create a new bug.

What problems does it cause?

When we looked at the original patch there were still some warning, and it looks like maybe your fix fixes those warnings as well.
Comment 19 Timur Bakeyev 2013-02-09 01:41:40 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > Volker, can we change this test for more more compliant port version:
> > 
> > - conf.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1,
> > &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h',
> > lib='aio rt')
> > + conf.CHECK_CODE('const struct aiocb * const a[1]; struct timespec t; return
> > aio_suspend(a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend',
> > headers='aio.h', lib='aio rt')
> 
> This bug has been closed out, so you will have to create a new bug.
> 
> What problems does it cause?
> 
> When we looked at the original patch there were still some warning, and it
> looks like maybe your fix fixes those warnings as well.

It does, that what ACTUALLY expected by the function.

I was just curios, can I reopen the bug with replying on it, but seems you right, have to file a new one.
Comment 20 Richard Sharpe 2013-02-09 01:51:03 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > (In reply to comment #17)
> > > Volker, can we change this test for more more compliant port version:
> > > 
> > > - conf.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1,
> > > &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h',
> > > lib='aio rt')
> > > + conf.CHECK_CODE('const struct aiocb * const a[1]; struct timespec t; return
> > > aio_suspend(a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend',
> > > headers='aio.h', lib='aio rt')
> > 
> > This bug has been closed out, so you will have to create a new bug.
> > 
> > What problems does it cause?
> > 
> > When we looked at the original patch there were still some warning, and it
> > looks like maybe your fix fixes those warnings as well.
> 
> It does, that what ACTUALLY expected by the function.
> 
> I was just curios, can I reopen the bug with replying on it, but seems you
> right, have to file a new one.

I will submit this patch as coming from you ...