From 38e9cdf7e5e7d1173cc15f7cbfd423e0703305fc Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Fri, 19 Nov 2004 13:50:51 +0000 Subject: [PATCH] - Added nice macro (acinclude.m4) to CVS for detection of wxWidgets. Any additional non-standard macros should be added to this file. Now switch off clientgui build (with nice warning) if wxWidgets is not found. Add - Use outcome of pthread tests and corresponding flags to set pthreads CFLAGS correctly. svn path=/trunk/boinc/; revision=4605 --- Makefile.am | 9 +- acinclude.m4 | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++ checkin_notes | 12 +++ configure.ac | 67 +++++++-------- 4 files changed, 281 insertions(+), 39 deletions(-) create mode 100644 acinclude.m4 diff --git a/Makefile.am b/Makefile.am index 80927dcb33..d5854686f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,14 +6,17 @@ AUTOMAKE_OPTIONS = foreign API_SUBDIRS = api lib boincglut apps if ENABLE_SERVER - SERVER_SUBDIRS = db tools test py sched + SERVER_SUBDIRS = db tools test py sched endif if ENABLE_CLIENT - CLIENT_SUBDIRS = client clientgui + CLIENT_SUBDIRS = client +endif +if BUILD_CLIENTGUI + CLIENTGUI_SUBDIRS = clientgui endif -SUBDIRS = RSAEuro $(SERVER_SUBDIRS) $(CLIENT_SUBDIRS) $(API_SUBDIRS) +SUBDIRS = RSAEuro $(SERVER_SUBDIRS) $(CLIENT_SUBDIRS) $(CLIENTGUI_SUBDIRS) $(API_SUBDIRS) # Putting a directory name recursively copies the entire contents - the # dist-hook below gets rid of CVS directories. diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000000..b5db4c310b --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,232 @@ +dnl --------------------------------------------------------------------------- +dnl Macros for wxWindows detection. Typically used in configure.in as: +dnl +dnl AC_ARG_ENABLE(...) +dnl AC_ARG_WITH(...) +dnl ... +dnl AM_OPTIONS_WXCONFIG +dnl ... +dnl ... +dnl AM_PATH_WXCONFIG(2.3.4, wxWin=1) +dnl if test "$wxWin" != 1; then +dnl AC_MSG_ERROR([ +dnl wxWindows must be installed on your system +dnl but wx-config script couldn't be found. +dnl +dnl Please check that wx-config is in path, the directory +dnl where wxWindows libraries are installed (returned by +dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or +dnl equivalent variable and wxWindows version is 2.3.4 or above. +dnl ]) +dnl fi +dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" +dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" +dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" +dnl +dnl LDFLAGS="$LDFLAGS $WX_LIBS" +dnl --------------------------------------------------------------------------- + +dnl --------------------------------------------------------------------------- +dnl AM_OPTIONS_WXCONFIG +dnl +dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and +dnl --wx-config command line options +dnl --------------------------------------------------------------------------- + +AC_DEFUN([AM_OPTIONS_WXCONFIG], +[ + AC_ARG_WITH(wxdir, + [ --with-wxdir=PATH Use uninstalled version of wxWindows in PATH], + [ wx_config_name="$withval/wx-config" + wx_config_args="--inplace"]) + AC_ARG_WITH(wx-config, + [ --with-wx-config=CONFIG wx-config script to use (optional)], + wx_config_name="$withval" ) + AC_ARG_WITH(wx-prefix, + [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)], + wx_config_prefix="$withval", wx_config_prefix="") + AC_ARG_WITH(wx-exec-prefix, + [ --with-wx-exec-prefix=PREFIX + Exec prefix where wxWindows is installed (optional)], + wx_config_exec_prefix="$withval", wx_config_exec_prefix="") +]) + +dnl --------------------------------------------------------------------------- +dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]]) +dnl +dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC +dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME +dnl environment variable to override the default name of the wx-config script +dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this +dnl case the macro won't even waste time on tests for its existence. +dnl +dnl Optional WX-LIBS argument contains comma- or space-separated list of +dnl wxWindows libraries to link against (it may include contrib libraries). If +dnl it is not specified then WX_LIBS and WX_LIBS_STATIC will contain flags to +dnl link with all of the core wxWindows libraries. +dnl +dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config +dnl invocation command in present. It can be used to fine-tune lookup of +dnl best wxWidgets build available. +dnl +dnl Example use: +dnl AM_PATH_WXCONFIG([2.6.0], [wxWin=1], [wxWin=0], [html,core,net] +dnl [--unicode --debug]) +dnl --------------------------------------------------------------------------- + +dnl +dnl Get the cflags and libraries from the wx-config script +dnl +AC_DEFUN([AM_PATH_WXCONFIG], +[ + dnl do we have wx-config name: it can be wx-config or wxd-config or ... + if test x${WX_CONFIG_NAME+set} != xset ; then + WX_CONFIG_NAME=wx-config + fi + + if test "x$wx_config_name" != x ; then + WX_CONFIG_NAME="$wx_config_name" + fi + + dnl deal with optional prefixes + if test x$wx_config_exec_prefix != x ; then + wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" + WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" + fi + if test x$wx_config_prefix != x ; then + wx_config_args="$wx_config_args --prefix=$wx_config_prefix" + WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" + fi + if test "$cross_compiling" = "yes"; then + wx_config_args="$wx_config_args --host=$host_alias" + fi + + dnl don't search the PATH if WX_CONFIG_NAME is absolute filename + if test -x "$WX_CONFIG_NAME" ; then + AC_MSG_CHECKING(for wx-config) + WX_CONFIG_PATH="$WX_CONFIG_NAME" + AC_MSG_RESULT($WX_CONFIG_PATH) + else + AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH") + fi + + if test "$WX_CONFIG_PATH" != "no" ; then + WX_VERSION="" + no_wx="" + + min_wx_version=ifelse([$1], ,2.2.1,$1) + if test -z "$5" ; then + AC_MSG_CHECKING([for wxWindows version >= $min_wx_version]) + else + AC_MSG_CHECKING([for wxWindows version >= $min_wx_version ($5)]) + fi + + WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5 $4" + + WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` + wx_config_major_version=`echo $WX_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + wx_config_minor_version=`echo $WX_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + wx_config_micro_version=`echo $WX_VERSION | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + wx_requested_major_version=`echo $min_wx_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + wx_requested_minor_version=`echo $min_wx_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + wx_requested_micro_version=`echo $min_wx_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + wx_ver_ok="" + if test "x$WX_VERSION" != x ; then + if test $wx_config_major_version -gt $wx_requested_major_version; then + wx_ver_ok=yes + else + if test $wx_config_major_version -eq $wx_requested_major_version; then + if test $wx_config_minor_version -gt $wx_requested_minor_version; then + wx_ver_ok=yes + else + if test $wx_config_minor_version -eq $wx_requested_minor_version; then + if test $wx_config_micro_version -ge $wx_requested_micro_version; then + wx_ver_ok=yes + fi + fi + fi + fi + fi + fi + + if test "x$wx_ver_ok" = x ; then + no_wx=yes + else + WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` + WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs` + + dnl starting with version 2.2.6 wx-config has --cppflags argument + wx_has_cppflags="" + if test $wx_config_major_version -gt 2; then + wx_has_cppflags=yes + else + if test $wx_config_major_version -eq 2; then + if test $wx_config_minor_version -gt 2; then + wx_has_cppflags=yes + else + if test $wx_config_minor_version -eq 2; then + if test $wx_config_micro_version -ge 6; then + wx_has_cppflags=yes + fi + fi + fi + fi + fi + + if test "x$wx_has_cppflags" = x ; then + dnl no choice but to define all flags like CFLAGS + WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` + WX_CPPFLAGS=$WX_CFLAGS + WX_CXXFLAGS=$WX_CFLAGS + + WX_CFLAGS_ONLY=$WX_CFLAGS + WX_CXXFLAGS_ONLY=$WX_CFLAGS + else + dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS + WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags` + WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags` + WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` + + WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` + WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` + fi + fi + + if test "x$no_wx" = x ; then + AC_MSG_RESULT(yes (version $WX_VERSION)) + ifelse([$2], , :, [$2]) + else + if test "x$WX_VERSION" = x; then + dnl no wx-config at all + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(no (version $WX_VERSION is not new enough)) + fi + + WX_CFLAGS="" + WX_CPPFLAGS="" + WX_CXXFLAGS="" + WX_LIBS="" + WX_LIBS_STATIC="" + ifelse([$3], , :, [$3]) + fi + fi + + AC_SUBST(WX_CPPFLAGS) + AC_SUBST(WX_CFLAGS) + AC_SUBST(WX_CXXFLAGS) + AC_SUBST(WX_CFLAGS_ONLY) + AC_SUBST(WX_CXXFLAGS_ONLY) + AC_SUBST(WX_LIBS) + AC_SUBST(WX_LIBS_STATIC) + AC_SUBST(WX_VERSION) +]) diff --git a/checkin_notes b/checkin_notes index 368d77deb6..61bae31ba7 100755 --- a/checkin_notes +++ b/checkin_notes @@ -19873,3 +19873,15 @@ Rom 19 Nov 2004 ViewWork.cpp lib/ gui_rpc_client.C + +Bruce 19 Nov 2004 UTC (from Reinhard Prix) + + - Added nice macro (acinclude.m4) to CVS for detection of wxWidgets. Any additional + non-standard macros should be added to this file. Now switch off + clientgui build (with nice warning) if wxWidgets is not found. Add + - Use outcome of pthread tests and corresponding flags to set pthreads + CFLAGS correctly. + + configure.ac + Makefile.am + acinclude.m4 diff --git a/configure.ac b/configure.ac index d19b4b171c..6cbfc6fe81 100644 --- a/configure.ac +++ b/configure.ac @@ -11,16 +11,6 @@ AC_PREREQ(2.57) dnl Set the BOINC version here. You can also use the set-version script. AC_INIT(BOINC, 4.56) -WXCONFIG=wx-config -AC_ARG_WITH(wx-config, -[[ --with-wx-config=FILE Use the given path to wx-config when determining - wxWidgets configuration; defaults to "wx-config"]], -[ - if test "$withval" != "yes" -a "$withval" != ""; then - WXCONFIG=$withval - fi -]) - AC_ARG_ENABLE(server, AC_HELP_STRING([--disable-server], [disable building the scheduling server]), @@ -47,35 +37,10 @@ else if test "${enable_client}" = yes ; then configured_to_build='client only' else - echo "You've disabled both the server and the client -- nothing to build!" >&2 - exit 1 + echo "You've disabled both the server and the client -- only BOINC-libraries will be built!" >&2 fi fi -dnl If building the client, check for existence of wxWidgets -if test "${enable_client}" = yes ; then - AC_MSG_CHECKING([wxWidgets version]) - if wxversion=`$WXCONFIG --version`; then - AC_MSG_RESULT([$wxversion]) - else - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.]) - fi - -WX_CPPFLAGS="`$WXCONFIG --cppflags`" -WX_CXXFLAGS="`$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`" -WX_LIBS="`$WXCONFIG --libs`" - -#CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" -#CXXFLAGS="$CXXFLAGS $WX_CPPFLAGS" - -AC_SUBST(WX_LIBS) -AC_SUBST(WX_CPPFLAGS) -AC_SUBST(WX_CXXFLAGS) - -fi - - echo "--- Configuring BOINC AC_PACKAGE_VERSION (${configured_to_build}) ---" AM_CONDITIONAL(ENABLE_SERVER, [test "${enable_server}" = yes]) @@ -157,6 +122,10 @@ AC_CHECK_LIB(stdc++, main) AC_CHECK_LIB(z, gzopen) dnl check for pthread ACX_PTHREAD(AC_DEFINE(HAVE_PTHREAD,1, [Have pthread])) +CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" +CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +LIBS="$PTHREAD_LIBS $LIBS" + dnl check for GL library SAH_GRX_LIBS AC_CHECK_LIB(socket, setservent) @@ -239,6 +208,32 @@ if test -e "/proc/meminfo"; then AC_DEFINE(HAVE__PROC_MEMINFO, 1, [Define to 1 if /proc/meminfo exists]) fi + +dnl ---------- wxWindows -------------------------------------------------- + +AM_OPTIONS_WXCONFIG + +dnl check for wxWindows +AM_PATH_WXCONFIG(2.3.4, wxWin=1) +if ( test "${enable_client}" = yes ) && ( test "$wxWin" != 1 ); then + AC_MSG_WARN([ +================================================================================ +WARNING: wxWindows could not be found ==> building client without clientgui. + If you add wxWindows to your system, then this configure script will also + configure your system to build the BOINC graphical client (clientgui). + + If wxWindows is installed on your system, please check that wx-config is + in the path, that the directory where wxWindows libraries are installed + (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH (or equivalent), + and that wxWindows version is 2.3.4 or above. +================================================================================ + ]) +fi + +AM_CONDITIONAL(BUILD_CLIENTGUI, [ test "$wxWin" = 1 -a "${enable_client}" = yes ]) +dnl -------------------------------------------------------------------------------- + + dnl This is one way to set up host-specific stuff case "${host}" in *-*-linux*)