[Openvpn-devel] CMake: fix HAVE_DAEMON detection on Linux

Message ID 20230922103900.37205-1-frank@lichtenheld.com
State Accepted
Headers show
Series [Openvpn-devel] CMake: fix HAVE_DAEMON detection on Linux | expand

Commit Message

Frank Lichtenheld Sept. 22, 2023, 10:39 a.m. UTC
From: Lev Stipakov <lev@openvpn.net>

On Linux, daemon() is defined in unistd.h, not in
stdlib.h like in MacOS or FreeBSD.

Change-Id: I30f4ea502a36eca155cbc79b89c0d18ee3419877
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/362
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
cron2 <cron2>

Comments

Gert Doering Sept. 22, 2023, 12:16 p.m. UTC | #1
As discussed on IRC - the previous "cmake related" patch related to
"compat-daemon.c" was triggered by cmake not finding daemon() on Linux,
and this is fixing it.

Your patch has been applied to the master branch.

commit e363b393f2d1b72590666554e17d928c1603f8d5 (master)
Author: Lev Stipakov
Date:   Fri Sep 22 12:39:00 2023 +0200

     CMake: fix HAVE_DAEMON detection on Linux

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20230922103900.37205-1-frank@lichtenheld.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27058.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9de6aba..76351c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,7 +158,7 @@ 
 check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
 check_symbol_exists(basename libgen.h HAVE_BASENAME)
 check_symbol_exists(chsize io.h HAVE_CHSIZE)
-check_symbol_exists(daemon stdlib.h HAVE_DAEMON)
+check_symbol_exists(daemon "unistd.h;stdlib.h" HAVE_DAEMON)
 check_symbol_exists(dirname libgen.h HAVE_DIRNAME)
 check_symbol_exists(getrlimit sys/resource.h HAVE_GETRLIMIT)
 check_symbol_exists(mlockall sys/mman.h HAVE_MLOCKALL)