Simplify autoconfiguration for Windows
Checking Windows libraries with autoconf is cumbersome, because linking often fails unless you include the header, and AC_SEARCH_LIBS doesn't permit that. Just detect the Windows API instead, with new MY_WINDOWS_API.
This commit is contained in:
parent
c3d2786f1a
commit
c02468fd69
3 changed files with 34 additions and 30 deletions
18
m4/my_windows_api.m4
Normal file
18
m4/my_windows_api.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
AC_DEFUN([MY_WINDOWS_API],
|
||||
[
|
||||
AC_MSG_CHECKING([whether compiling for Windows API])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE([[#ifdef _WIN32
|
||||
#Here's a nickel, kid
|
||||
#endif]])],
|
||||
[Windows_API=no],
|
||||
[Windows_API=yes])
|
||||
AC_MSG_RESULT([$Windows_API])
|
||||
if test $Windows_API = yes; then
|
||||
AC_DEFINE([WINDOWS], 1, [Define if compiling for Windows API])
|
||||
LIBS_SOCKETS="-lws2_32"
|
||||
else
|
||||
LIBS_SOCKETS=
|
||||
fi
|
||||
AC_SUBST([LIBS_SOCKETS])
|
||||
])
|
Loading…
Add table
Add a link
Reference in a new issue