|
From: Mojca M. <moj...@gm...> - 2014-06-19 20:27:54
|
On Thu, Jun 19, 2014 at 9:31 PM, Ethan A Merritt
<sf...@us...> wrote:
> On Thursday, 19 June, 2014 11:33:34 Mojca Miklavec wrote:
>> On Thu, Jun 19, 2014 at 10:05 AM, Jun T. wrote:
>> > On 2014/06/17, at 4:43, Ethan A Merritt wrote:
>> >> So I have changed gnuplot's autoconfigure script to add -lX11
>> >> itself if it sees that the newer wxWidgets is being used.
>> >
>> > This causes a problem on my Mac (and maybe on other systems);
>> > the linker dies saying "-lX11 can't be found".
>> > (OS X 10.8 / no X11 installed / wxWidgets=svn HEAD)
>>
>> Confirmed. You shouldn't unconditionally link to X11 (in particular
>> not on Mac). The check for wx_gtk should be better, but then again gtk
>> also works with quartz on OS X. Honestly I don't expect people to use
>> wxGTK 3.0 with quartz on Macs when they can use Cocoa (unless maybe
>> with wxGTK 2.8 to get support for old software that hasn't been ported
>> to 3.0, but then again wxWidgets 2.8 won't work with GTK/quartz
>> without quite a bit of patching).
>>
>> I wanted to test gnuplot with wxGTK 3.0 on Mac, but it didn't work at
>> all because I have it linked against gtk 3.0 and gnuplot fails because
>> it has a fixed idea that wxGTK is using GTK+ 2:
>>
>> if test "${enable_wxwidgets_ok}" = yes ; then
>> WX_CXXFLAGS="`$WX_CONFIG --cxxflags | sed 's/-fno-exceptions//'`
>> $CAIROPANGO_CFLAGS"
>> WX_LIBS="`$WX_CONFIG --libs` $CAIROPANGO_LIBS"
>>
>> dnl Check for fork(), used for the 'persist' effect
>> AC_FUNC_FORK
>>
>> dnl Check for gtk (raise/lower tweaks)
>> PKG_CHECK_MODULES(GTK, [gtk+-2.0], have_gtk=yes, have_gtk=no)
>> if test "${have_gtk}" = yes ; then
>> AC_DEFINE(HAVE_GTK, 1, [Define to use gtk/gdk tweaks])
>> WX_CXXFLAGS="$WX_CXXFLAGS $GTK_CFLAGS"
>> WX_LIBS="$WX_LIBS $GTK_LIBS"
>> fi
>>
>> dnl The user can force single-threaded mode
>> AC_ARG_WITH(wx-single-threaded, dnl
>> [--with-wx-single-threaded do not use multithreaded wxgtk even if
>> available],
>> WX_CXXFLAGS="$WX_CXXFLAGS -DWXT_MONOTHREADED",~
>> )
>>
>> dnl Check for gtk>2.8 for direct rendering to screen
>> PKG_CHECK_MODULES(GTK28, [gtk+-2.0 >= 2.8.0], have_gtk28=yes, have_gtk28=no)
>> if test "${have_gtk28}" = yes ; then
>> AC_DEFINE(HAVE_GTK28, 1, [Define to use gtk+ functions to handle cairo])
>> fi
>>
>> So please also check whether wxWidgets are using gtk2 or gtk3 before
>> calling pkg-config to supply build flags.
>
> That's a chicken-or-egg dilemma.
> wx-config is supposed to tell us the version, but we need the version in
> order to call the correct wx-config.
I don't see any chicken here ;)
Once gnuplot calls
WX_CXXFLAGS="`$WX_CONFIG --cxxflags
it already knows which $WX_CONFIG it is calling.
The problematic line is only
PKG_CHECK_MODULES(GTK, [gtk+-2.0], have_gtk=yes, have_gtk=no)
Gnuplot should run
"$WX_CONFIG" --basename | <grep something>
before asking for gtk+-2.0.
Here's what FileZilla does for example:
http://svn.filezilla-project.org/filezilla/FileZilla3/trunk/configure.ac?view=markup
if echo "`$WX_CONFIG_WITH_ARGS --basename`" | grep -i gtk2 >
/dev/null 2>&1; then
PKG_CHECK_MODULES(LIBGTK, gtk+-2.0,, [
AC_MSG_ERROR([gtk+-2.0 was not found ...])
])
fi
if echo "`$WX_CONFIG_WITH_ARGS --basename`" | grep -i gtk3 >
/dev/null 2>&1; then
PKG_CHECK_MODULES(LIBGTK, gtk+-3.0,, [
AC_MSG_ERROR([gtk+-3.0 was not found ...])
])
fi
> I suppose we can add configuration options --with-gtk={ gtk2 | gtk3 }
No, please don't. The user has zero influence on that and that is only
going to lead into problems. Gnuplot should automatically determine
whether wxWidgets are using GTK and if so, which version. wx-config
--basename return wx_gtk2* or wx_gtk3* ("*" can be different endings
based on other characteristics of the installation).
> but that won't make the gtk3 build actually work, because we already
> know it doesn't report the correct set of libraries that are needed.
The problem above is unrelated. Adding extra flags is slightly
different that preventing the user to even compile gnuplot (by adding
incompatible flags).
>> > 1037c1037,1038
>> > < if expr ${WXWIDGETS_VERSION} \> 2.8 >/dev/null; then
>> > ---
>> >> if expr ${WXWIDGETS_VERSION} \> 2.8 >/dev/null && \
>> >> ${WX_CONFIG} --basename | grep 'wx_gtk' >/dev/null 2>&1; then
>>
>> Yes, checking for wx_gtk should help, even though I believe that some
>> package (either gtk or wxwidgets) should suggest the proper flag.
>
> But that is exactly the problem!
I'm not saying that this is ideal. Just saying that this is better
than the current situation where you add X11 unconditionally; it would
help to eliminate problems at least in the cases where wxWidgets is
not even based on GTK.
(But then again it is probably a lot easier to add compiler flags than
to remove them.)
> Yes, gtk and/or wxWidgets should declare what support libraries are
> required. That is what `wx-config --libs` is supposed to do.
> But it doesn't.
I would ask the wxWidgets developers for advice.
Mojca
|