Mercurial > irccd
diff cmake/IrccdSystem.cmake @ 507:65e80d258b34
Irccd: use system username, closes #562
Use the system user login name as both nickname and username to avoid
having collision with possible existing irccd.
This is currently only possible if the system has `getlogin` function
which targets primarily unix platforms. Windows support will be added
later.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 16 Oct 2017 12:54:01 +0200 |
parents | 0b156b82b8c1 |
children | 27587ff92a64 |
line wrap: on
line diff
--- a/cmake/IrccdSystem.cmake Mon Oct 16 12:43:48 2017 +0200 +++ b/cmake/IrccdSystem.cmake Mon Oct 16 12:54:01 2017 +0200 @@ -118,6 +118,7 @@ # # HAVE_ACCESS True if has access(2) function (and sys/types.h and sys/stat.h), # HAVE_DAEMON True if daemon(3), +# HAVE_GETLOGIN True if getlogin(3) function (and unistd.h) # HAVE_GETPID True if has getpid(2) function (and sys/types.h and unistd.h and grp.h), # HAVE_POPEN True if has popen(3) function (in stdio.h) # HAVE_SETGID True if has setgid(2) function and getgrnam(3) (and sys/types.h and unistd.h and pwd.h), @@ -165,6 +166,17 @@ set(HAVE_ACCESS FALSE) endif () +# getlogin() function +# +# If HAVE_GETLOGIN is defined, include: +# +# #include <unistd.h> +check_function_exists(getlogin HAVE_GETLOGIN) + +if (NOT HAVE_UNISTD_H) + set(HAVE_GETLOGIN FALSE) +endif () + # getpid() function # # If HAVE_GETPID is defined, include: