From ff9e4b5ea470da321174221a6da2eb24045f302c Mon Sep 17 00:00:00 2001 From: "Eric J. Korpela" Date: Fri, 16 Dec 2005 03:20:01 +0000 Subject: [PATCH] Added autoconf macro AX_WINSOCK for identifying winsock libs and headers for support of command line compiles. Adds new configure command line option --with-winsock to enable winsock if necessary where alternative socket libraries exist. Modified BOINC_CHECK_CYGWIN to call AX_WINSOCK. Modified boinc_getsockopt.m4 to get correct type when winsock is used. Modified AX_CHECK_GLUT to find correct libraries when compiling under windows from command line. svn path=/trunk/boinc/; revision=9072 --- m4/ax_check_glut.m4 | 2 +- m4/ax_winsock.m4 | 13 +++++++++++++ m4/boinc_check_cygwin.m4 | 6 ++++++ m4/boinc_getsockopt.m4 | 6 ++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 m4/ax_winsock.m4 diff --git a/m4/ax_check_glut.m4 b/m4/ax_check_glut.m4 index ed2f8a18fc..f883833084 100644 --- a/m4/ax_check_glut.m4 +++ b/m4/ax_check_glut.m4 @@ -38,7 +38,7 @@ else LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ -# if HAVE_WINDOWS_H && defined(_WIN32) +# if HAVE_WINDOWS_H && (defined(_WIN32) || defined(CYGWIN_USE_WIN32)) # include # endif # include ]], diff --git a/m4/ax_winsock.m4 b/m4/ax_winsock.m4 new file mode 100644 index 0000000000..fbe16215f8 --- /dev/null +++ b/m4/ax_winsock.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([AX_WINSOCK],[ + AC_ARG_WITH([winsock], + AC_HELP_STRING([--with-winsock], + [use windows sockets even if sys/socket.h exists])) + if test "${with_winsock}" = "yes" ; then + AC_DEFINE(USE_WINSOCK,[1],[Define to 1 to use windows sockets]) + ac_cv_header_sys_socket_h="no" + else + ac_cv_header_winsock2_h="no" + ac_cv_header_winsock_h="no" + fi + AC_CHECK_HEADERS([windows.h winsock2.h winsock.h sys/socket.h]) +]) diff --git a/m4/boinc_check_cygwin.m4 b/m4/boinc_check_cygwin.m4 index ff344092d0..2fbc7161f2 100644 --- a/m4/boinc_check_cygwin.m4 +++ b/m4/boinc_check_cygwin.m4 @@ -9,6 +9,12 @@ AC_DEFUN([BOINC_CHECK_CYGWIN],[ esac AC_MSG_RESULT($with_cygwin) if test "${with_cygwin}" = "yes" ; then + save_cflags="${CFLAGS}" + CFLAGS="-I/usr/include/w32api -D_WIN32 -DWIN32 ${CFLAGS}" + fi + AX_WINSOCK + if test "${with_cygwin}" = "yes" ; then + CFLAGS="${save_cflags}" AC_MSG_CHECKING([whether to use X11 or WIN32 GUI]) if test "${with_x+set}" = set; then with_x="${with_x}" diff --git a/m4/boinc_getsockopt.m4 b/m4/boinc_getsockopt.m4 index b51e9c8737..7f5fdfd971 100644 --- a/m4/boinc_getsockopt.m4 +++ b/m4/boinc_getsockopt.m4 @@ -1,6 +1,12 @@ AC_DEFUN([BOINC_GETSOCKOPT_TYPE],[ AC_LANG_PUSH(C) +AC_CHECK_HEADERS([windows.h]) +if test "${ac_cv_header_windows_h}" = "yes" ; then + ac_includes_default="${ac_includes_default} +#include +" +fi AC_CHECK_HEADERS([sys/socket.h]) if test "${ac_cv_header_sys_socket_h}" = "yes" ; then ac_includes_default="${ac_includes_default}