Re: Can't compile Dillo 3.0.3

"Sebastian Geerken" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
On Sat, May 18, Johannes Hofmann wrote:
> On Sat, May 18, 2013 at 08:23:34PM +0200, Sebastian Geerken wrote:
> > On Sat, May 18, Johannes Hofmann wrote:
> > > On Sat, May 18, 2013 at 02:47:56PM +0200, Sebastian Geerken wrote:
> > > > [...]
> > > > 
> > > > X11 is needed in src/xembed.cc. It seems that on most systems it is
> > > > linked indirectly, (src/dillo -> libfltk.so -> libX11.so), on others
> > > > not, so that an additional "-lX11" is necessary. Should we add it
> > > > generally? It does not harm; we have only to care about other systems
> > > > than X11.
> > > 
> > > Could we check for libX11 in configure and link explicitely against
> > > it if available but not fail otherwise?
> > > That way dillo should still compile on OSX.
> > 
> > I thought of this. The code is included in "#ifdef X_PROTOCOL", so
> > making "-lX11" depend on this X_PROTOCOL should be save; however, I've
> > not found where X_PROTOCOL is defined.
> 
> That comes from the fltk headers depending on whether fltk was built
> with X11 backend or not.

Do not find it, strange.

> I don't see how we could get that information at configure time.
> Maybe some fltk-config option?

See attached patch for an incomplete implementation. On my system, it
says "checking whether to link to X11... yes", on OSX it should say
"... no".

Unfortunately, AC_RUN_IFELSE is incompatible with cross compiling.
Perhaps, something with AC_COMPILE_IFELSE could also work.

Sebastian

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
test_X11.diff (text/x-diff, 804 B)
diff -r 2a024fd43fe8 configure.ac
--- a/configure.ac	Sat May 18 21:27:59 2013 +0200
+++ b/configure.ac	Sat May 18 21:58:45 2013 +0200
@@ -124,6 +124,28 @@
          AC_MSG_ERROR(FLTK 1.3 required; fltk-config not found)
 esac
 
+dnl -----------------------------------
+dnl Test for X11 (only on some systems)
+dnl -----------------------------------
+AC_MSG_CHECKING([whether to link to X11])
+AC_LANG_PUSH([C++])
+old_libs=$LIBS
+old_cxxflags=$CXXFLAGS
+LIBS=$LIBFLTK_LIBS
+CXXFLAGS=$LIBFLTK_CXXFLAGS
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#define FL_INTERNALS
+#include <FL/x.H>
+]],[[
+#ifdef X_PROTOCOL
+   return 0;
+#else
+   return 1;
+#endif
+]])], [AC_MSG_RESULT(yes)] ,[AC_MSG_RESULT(no)])
+CXXFLAGS=$old_cxxflags
+LIBS=$old_libs
+AC_LANG_POP([C++])
 
 dnl ----------------
 dnl Test for libjpeg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.