#551

'configure' should detect need for linking with "-lrt" rather than basing it on platform

Opendavmac314opened 4mo ago

Currently "configure" adds -lrt to the link options if building for the FreeBSD platform (only). This is contrary to the spirit of having an automated build configuration: it should detect what build options are actually required, not base this assumption on the platform. I.e. if a small program using appropriate Dasynq functionality can be linked without -lrt then it should be assumed that -lrt isn't needed.

Activity

5
mobin-20081mo ago

using appropriate Dasynq functionality

I think a test program with a simple timer_create() and timer_delete() would be enough.

davmac3141mo ago

That's only an appropriate test if Dasynq will actually use those functions - it doesn't on every platform. Better to test by actually creating a Dasynq timer.

(Edit: eg older versions of Linux required -lrt for timer_create, but Dasynq doesn't use timer_create on Linux by default. But also the Dasynq implementation may change down the line. For instance it might be possible to use kqueue timers when kqueue is available, and so there'd be no need for timer_create on some additional systems. But if you just check for timer_create then you don't capture that, and might end up linking against librt when it's not necessary).

mobin-200825d ago

After checking Dasynq timers, it looks like that Dasynq timers use timerfd on Linux and not POSIX timers. I think I can optimize the check to skip the check entirely when on Linux. Does this break anything?

davmac31425d ago

POSIX timers are used on Linux if built with DASYNQ_HAVE_EPOLL=0.

mobin-200825d ago

POSIX timers are used on Linux if built with DASYNQ_HAVE_EPOLL=0.

Right