| 1 |
# sethostname.m4 |
| 2 |
# serial 3 |
| 3 |
dnl Copyright (C) 2011-2026 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
# Ensure |
| 10 |
# - the sethostname() function, |
| 11 |
# - the HOST_NAME_MAX macro in <limits.h>. |
| 12 |
AC_DEFUN([gl_FUNC_SETHOSTNAME], |
| 13 |
[ |
| 14 |
AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
| 15 |
|
| 16 |
gl_PREREQ_HOST_NAME_MAX |
| 17 |
|
| 18 |
gl_CHECK_FUNCS_ANDROID([sethostname], [[#include <unistd.h>]]) |
| 19 |
if test $ac_cv_func_sethostname = no; then |
| 20 |
HAVE_SETHOSTNAME=0 |
| 21 |
case "$gl_cv_onwards_func_sethostname" in |
| 22 |
future*) REPLACE_SETHOSTNAME=1 ;; |
| 23 |
esac |
| 24 |
fi |
| 25 |
|
| 26 |
AC_CHECK_DECLS([sethostname]) |
| 27 |
if test $ac_cv_have_decl_sethostname = no; then |
| 28 |
HAVE_DECL_SETHOSTNAME=0 |
| 29 |
fi |
| 30 |
]) |