Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Fri, Apr 17, 2015 at 08:02:28AM -0700, Gurucharan Shetty wrote: 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. You can also check whether it builds successfully on Windows by adding your proposed commit to your fork of OVS in Github and then logging into appveyor.com via your github account. You can then start a new build there If you prefer that I take care of Windows, let me know. Hi Guru, Thanks for letting me know that I could use Appveyor ci service to build Windows-target binary wheels. I didn't know that since I haven't had any Windows boxes for years. The good news is we've already had a soultion to fix pthread linking issue. :-) 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 @@ dnlglibc: HAVE_GLIBC_PTHREAD_SETNAME_NP dnlNetBSD: HAVE_NETBSD_PTHREAD_SETNAME_NP dnlFreeBSD: 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
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Fri, Apr 17, 2015 at 09:41:19PM -0700, Ben Pfaff wrote: On Sat, Apr 18, 2015 at 01:28:21AM +0800, Kevin Lo wrote: On Fri, Apr 17, 2015 at 09:17:46AM -0700, Ben Pfaff wrote: On Fri, Apr 17, 2015 at 02:45:32PM +0800, Kevin Lo wrote: 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. Does the following even simpler change also fix the problem on BSD? Indeed. I must have more coffee :( Sorry for the noise. Will you submit this diff with an updated commit message, then? I'm happy that we arrived at such a straightforward solution! Done. http://openvswitch.org/pipermail/dev/2015-April/054242.html Thanks. diff --git a/configure.ac b/configure.ac index 8af5ef0..b100c80 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,7 @@ 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_SEARCH_LIBS([pthread_create], [pthread]) AC_FUNC_STRERROR_R OVS_CHECK_ESX ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
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 @@ dnlglibc: HAVE_GLIBC_PTHREAD_SETNAME_NP dnlNetBSD: HAVE_NETBSD_PTHREAD_SETNAME_NP dnlFreeBSD: 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
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
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. You can also check whether it builds successfully on Windows by adding your proposed commit to your fork of OVS in Github and then logging into appveyor.com via your github account. You can then start a new build there If you prefer that I take care of Windows, let me know. 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 @@ dnlglibc: HAVE_GLIBC_PTHREAD_SETNAME_NP dnlNetBSD: HAVE_NETBSD_PTHREAD_SETNAME_NP dnlFreeBSD: 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
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Fri, Apr 17, 2015 at 09:17:46AM -0700, Ben Pfaff wrote: On Fri, Apr 17, 2015 at 02:45:32PM +0800, Kevin Lo wrote: 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. Does the following even simpler change also fix the problem on BSD? Indeed. I must have more coffee :( Sorry for the noise. diff --git a/configure.ac b/configure.ac index 8af5ef0..b100c80 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,7 @@ 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_SEARCH_LIBS([pthread_create], [pthread]) AC_FUNC_STRERROR_R OVS_CHECK_ESX ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Fri, Apr 17, 2015 at 02:45:32PM +0800, Kevin Lo wrote: 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. Does the following even simpler change also fix the problem on BSD? diff --git a/configure.ac b/configure.ac index 8af5ef0..b100c80 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,7 @@ 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_SEARCH_LIBS([pthread_create], [pthread]) AC_FUNC_STRERROR_R OVS_CHECK_ESX ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Sat, Apr 18, 2015 at 01:28:21AM +0800, Kevin Lo wrote: On Fri, Apr 17, 2015 at 09:17:46AM -0700, Ben Pfaff wrote: On Fri, Apr 17, 2015 at 02:45:32PM +0800, Kevin Lo wrote: 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. Does the following even simpler change also fix the problem on BSD? Indeed. I must have more coffee :( Sorry for the noise. Will you submit this diff with an updated commit message, then? I'm happy that we arrived at such a straightforward solution! diff --git a/configure.ac b/configure.ac index 8af5ef0..b100c80 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,7 @@ 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_SEARCH_LIBS([pthread_create], [pthread]) AC_FUNC_STRERROR_R OVS_CHECK_ESX ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
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. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Tue, Apr 14, 2015 at 08:43:42PM -0700, Ben Pfaff wrote: [Guru: please see final paragraph] On Tue, Apr 07, 2015 at 03:54:30PM +0800, Kevin Lo wrote: On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org Thanks for the patch. I apologize for the delay in the review; I've been away on vacation for a week. I agree that using this macro will generally be a portability improvement. I think that the patch to configure.ac should add $PTHREAD_CFLAGS to OVS_CFLAGS instead of to CFLAGS, so that the user does not accidentally override it on the configure command line. For the rationale, please see the mention of CFLAGS in INSTALL.md and https://www.gnu.org/software/autoconf/manual/automake.html#Flag-Variables-Ordering in the Autoconf manual. Ah, you're right. Thank you for taking the time to review my patch. 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. Understood. Thanks for your clear explanation. Thanks, Ben. Kevin ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Tue, Apr 14, 2015 at 09:06:28PM -0700, Ben Pfaff wrote: On Wed, Apr 15, 2015 at 01:07:30PM +0900, YAMAMOTO Takashi wrote: On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org --- diff --git a/configure.ac b/configure.ac index 8d47eb9..531a1f0 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,11 @@ AC_SEARCH_LIBS([timer_create], [rt]) AC_SEARCH_LIBS([pthread_sigmask], [pthread]) i guess AC_SEARCH_LIBS for potentially-in-libpthread stuffs should be after the AX_PTHREAD check. Hmm, I guess that we don't need that AC_SEARCH_LIBS at all when AX_PTHREAD is in use. I think that AX_PTHREAD does everything needed. Exactly. :) Thanks. Kevin ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
[Guru: please see final paragraph] On Tue, Apr 07, 2015 at 03:54:30PM +0800, Kevin Lo wrote: On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org Thanks for the patch. I apologize for the delay in the review; I've been away on vacation for a week. I agree that using this macro will generally be a portability improvement. I think that the patch to configure.ac should add $PTHREAD_CFLAGS to OVS_CFLAGS instead of to CFLAGS, so that the user does not accidentally override it on the configure command line. For the rationale, please see the mention of CFLAGS in INSTALL.md and https://www.gnu.org/software/autoconf/manual/automake.html#Flag-Variables-Ordering in the Autoconf manual. 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. Thanks, Ben. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Wed, Apr 15, 2015 at 01:07:30PM +0900, YAMAMOTO Takashi wrote: On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org --- diff --git a/configure.ac b/configure.ac index 8d47eb9..531a1f0 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,11 @@ AC_SEARCH_LIBS([timer_create], [rt]) AC_SEARCH_LIBS([pthread_sigmask], [pthread]) i guess AC_SEARCH_LIBS for potentially-in-libpthread stuffs should be after the AX_PTHREAD check. Hmm, I guess that we don't need that AC_SEARCH_LIBS at all when AX_PTHREAD is in use. I think that AX_PTHREAD does everything needed. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org --- diff --git a/configure.ac b/configure.ac index 8d47eb9..531a1f0 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,11 @@ AC_SEARCH_LIBS([timer_create], [rt]) AC_SEARCH_LIBS([pthread_sigmask], [pthread]) i guess AC_SEARCH_LIBS for potentially-in-libpthread stuffs should be after the AX_PTHREAD check. YAMAMOTO Takashi AC_FUNC_STRERROR_R +AX_PTHREAD([ + LIBS=$PTHREAD_LIBS $LIBS + CFLAGS=$CFLAGS $PTHREAD_CFLAGS + CC=$PTHREAD_CC], AC_MSG_ERROR([Missing POSIX threads support.])) + OVS_CHECK_ESX OVS_CHECK_WIN32 OVS_CHECK_VISUAL_STUDIO_DDK ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On Wed, Apr 15, 2015 at 01:07:30PM +0900, YAMAMOTO Takashi wrote: On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org --- diff --git a/configure.ac b/configure.ac index 8d47eb9..531a1f0 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,11 @@ AC_SEARCH_LIBS([timer_create], [rt]) AC_SEARCH_LIBS([pthread_sigmask], [pthread]) i guess AC_SEARCH_LIBS for potentially-in-libpthread stuffs should be after the AX_PTHREAD check. Hmm, I guess that we don't need that AC_SEARCH_LIBS at all when AX_PTHREAD is in use. I think that AX_PTHREAD does everything needed. sure, very likely. YAMAMOTO Takashi ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] use AX_PTHREAD to detect pthreads
On FreeBSD using AC_SEARCH_LIBS is not sufficient for finding the linker flags for linking with a pthread library. Add macro ax_pthread.m4 from GNU autoconf macro archive and use macro AX_PTHREAD. Signed-off-by: Kevin Lo kevlo at FreeBSD.org --- diff --git a/configure.ac b/configure.ac index 8d47eb9..531a1f0 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,11 @@ AC_SEARCH_LIBS([timer_create], [rt]) AC_SEARCH_LIBS([pthread_sigmask], [pthread]) AC_FUNC_STRERROR_R +AX_PTHREAD([ + LIBS=$PTHREAD_LIBS $LIBS + CFLAGS=$CFLAGS $PTHREAD_CFLAGS + CC=$PTHREAD_CC], AC_MSG_ERROR([Missing POSIX threads support.])) + OVS_CHECK_ESX OVS_CHECK_WIN32 OVS_CHECK_VISUAL_STUDIO_DDK diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 new file mode 100644 index 000..d383ad5 --- /dev/null +++ b/m4/ax_pthread.m4 @@ -0,0 +1,332 @@ +# === +#http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# === +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS=$PTHREAD_LIBS $LIBS +# CFLAGS=$CFLAGS $PTHREAD_CFLAGS +# CC=$PTHREAD_CC +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson stev...@alum.mit.edu +# Copyright (c) 2011 Daniel Richard G. sk...@iskunk.org +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see http://www.gnu.org/licenses/. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 21 + +AU_ALIAS([ACX_PTHREAD],