The following patch fixes the compilation of lyxclient on solaris,
where the socket function need additional libraries. It happens that
LyX itself is not affected because X window adds these libraries for
its own use.

I am not really satisfied by this patch. An alternative solution (or
hack) would be to just add X_EXTRA_LIBS to lyxclient's libraries. This
would of course fail if compiling without X (but OSX and windows do
not need the libs anyway).

What shall I do? We have to do something before 1.4.0 anyway.

JMarc

Index: configure.ac
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.ac,v
retrieving revision 1.66
diff -u -p -r1.66 configure.ac
--- configure.ac	18 Oct 2005 09:11:19 -0000	1.66
+++ configure.ac	30 Nov 2005 16:50:49 -0000
@@ -301,7 +301,17 @@ LYX_CHECK_SPELL_ENGINES
 
 lyx_client_subdir=true
 AC_LANG_PUSH(C)
-AC_CHECK_FUNCS(fcntl,, [lyx_client_subdir=false])
+dnl LIBS already contains some X extra libs that may interfere.
+save_LIBS="$LIBS"
+LIBS=
+AC_CHECK_FUNCS(fcntl,
+  [AC_SEARCH_LIBS([gethostbyname], [nsl])
+   AC_SEARCH_LIBS([socket], [socket], [], 
+     [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
+                [], [-lnsl])])], 
+  [lyx_client_subdir=false])
+AC_SUBST(CLIENT_LIBS,$LIBS)
+LIBS="$save_LIBS"
 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
 AC_LANG_POP(C)
 
Index: src/client/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/Makefile.am,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile.am
--- src/client/Makefile.am	12 Jul 2005 23:42:21 -0000	1.11
+++ src/client/Makefile.am	30 Nov 2005 16:50:49 -0000
@@ -16,7 +16,7 @@ BOOST_LIBS = $(BOOST_REGEX) $(BOOST_FILE
 
 lyxclient_LDADD = \
 	$(top_builddir)/src/support/libsupport.la \
-	$(BOOST_LIBS) $(INTLLIBS)
+	$(BOOST_LIBS) $(INTLLIBS) $(CLIENT_LIBS)
 
 lyxclient_SOURCES = \
 	boost.C \

Reply via email to