File: gethostname.m4

package info (click to toggle)
log4c 1.2.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,872 kB
  • sloc: sh: 11,246; ansic: 8,645; makefile: 682; lex: 134; cpp: 6
file content (24 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
AC_DEFUN([LOG4C_FUNC_GETHOSTNAME],
[
	GETHOSTNAME_LIB=
	AC_CHECK_FUNCS([gethostname], , [
		AC_CACHE_CHECK([for gethostname in winsock.h and -lws2_32],
			[l4_cv_w32_gethostname],
			[l4_cv_w32_gethostname=no
			 ac_save_LIBS="$LIBS"
			 LIBS="$LIBS -lws2_32"
			 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef _WIN32
#include <winsock.h>
#endif
#include <unistd.h>
#include <stddef.h>
]], [[gethostname(NULL, 0);]])], [l4_cv_w32_gethostname=yes])
			 LIBS="$ac_save_LIBS"
			])
		if test "x$l4_cv_w32_gethostname" = "xyes"; then
			GETHOSTNAME_LIB="-lws2_32"
		fi
	])
	AC_SUBST([GETHOSTNAME_LIB])
])