On Sat, May 18, 2013 at 09:59:18PM +0200, Sebastian Geerken wrote:
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.
Sorry, it's not in the fltk headers, but via fltk headers. It's defined in X11/X.h.
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
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
Ah that's cool. It's good to base the decision for linking and the ifdef in the code on the same thing. I can test it on OSX on tuesday. Johannes