On Wed, Apr 15, 2015 at 05:50:42PM -0700, Ben Pfaff wrote: > > On Wed, Apr 15, 2015 at 07:52:24AM -0700, Gurucharan Shetty wrote: > > > > > > I am also concerned that it this will break the Windows build. > > > Currently Windows uses some Windows-only code in m4/openvswitch.m4, > > > which requires Win32 builders to specify --with-pthread=<dir> on the > > > configure command line. Ideally, we would want Windows builds to work > > > the same as other builds. Maybe that would mean that Windows builders > > > should specify the PTHREAD_* variables on the configure command line, > > > instead of --with-pthread, or that the OVS pthread-win32 support should > > > move from OVS_CHECK_WIN32 to somewhere around the new invocation of > > > AX_PTHREAD. Either way, I think that this will require some change to > > > what this patch does (and possibly an update to INSTALL.Windows.md) > > > before it can go in. I'm CCing Guru, who knows the Windows build, to > > > get his opinion. > > > > commit 94887cf4caa74bfb5 added the support for pthreads check for Windows. > > As one can see in that commit, we have very specific Windows related > > includes, ldflags, libs that we need added. This is mainly because > > pthreads on Windows is downloadable and installed in any directory. I > > do not know what is a good portable solution here if we need to make > > Windows related changes again there. > > > > One concern that I have in changing '--with-pthread' for Windows means > > that the auto builds at different places will also need changing. > > Unless the benefits look good, I would like to avoid making that > > change. > > I think that this is pretty close to working already, actually. The > proposed AX_PTHREAD allows previously set shell variables PTHREAD_CFLAGS > and PTHREAD_LIBS to control how pthread compiling and linking should > work. I think that OVS_CHECK_WIN32 could simply set these variables: > PTHREAD_CFLAGS to the -I option and PTHREAD_LIBS to the -L and -l > options. > > We'd want to ensure that OVS_CHECK_WIN32 gets called before AX_PTHREAD. > I think we can add AC_BEFORE([$0], [AX_PTHREAD]) to OVS_CHECK_WIN32 to > ensure that.
I know some of you are concerned about it will break build on Windows. The diff below fixes pthread linking on FreeBSD. Tested on Linux, NetBSD, and FreeBSD. If it looks good, I'll update the commit message, thanks. diff --git a/acinclude.m4 b/acinclude.m4 index b09f2f2..c5214dc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -710,6 +710,7 @@ dnl glibc: HAVE_GLIBC_PTHREAD_SETNAME_NP dnl NetBSD: HAVE_NETBSD_PTHREAD_SETNAME_NP dnl FreeBSD: HAVE_PTHREAD_SET_NAME_NP AC_DEFUN([OVS_CHECK_PTHREAD_SET_NAME], + [AC_CHECK_LIB(pthread, pthread_create)] [AC_CHECK_FUNCS([pthread_set_name_np]) if test $ac_cv_func_pthread_set_name_np != yes; then AC_CACHE_CHECK( diff --git a/configure.ac b/configure.ac index d1b48ca..9d1dbf3 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,6 @@ AC_SUBST([LT_AGE]) AC_SEARCH_LIBS([pow], [m]) AC_SEARCH_LIBS([clock_gettime], [rt]) AC_SEARCH_LIBS([timer_create], [rt]) -AC_SEARCH_LIBS([pthread_sigmask], [pthread]) AC_FUNC_STRERROR_R OVS_CHECK_ESX _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev