configure: rework the way TIRPC is detected and handled
authorJon Trulson <jon@radscan.com>
Thu, 21 Nov 2019 01:26:59 +0000 (18:26 -0700)
committerJon Trulson <jon@radscan.com>
Thu, 21 Nov 2019 01:26:59 +0000 (18:26 -0700)
Previously we would detect whether TIRPC is installed or not, and set
TIRPCINC to the include directory with the -DOPT_TIRPC macro defined.
Then, pretty much every Makefile.am needs to be sure that $(TIRPCINC) is
specified in the cpp/c/cxx flags.

Since we can never be sure that an RPC header file might be indirectly
included, a better approach is to simply add TIRPCINC to the global
list of CXXFLAGS and CFLAGS in configure.ac for everybody.  This way,
it is always specified properly on tirpc systems, and we don't need to
always add it to every individual Makefile.am since everyone will get
it by default.

TIRPCLIB is still marked as a dep in libtt, so as long as libtt is
linked, you should automatically get the tirpc library too.  This is
still unchanged.

cde/configure.ac

index 16417613ba1d4655b83f380ba93dc3cfd6863e34..bc1af5c68b46fdfb266ad1fde7f420dd3e365d3f 100644 (file)
@@ -265,10 +265,15 @@ AC_CHECK_HEADERS([locale.h])
 dnl libraries
 AC_CHECK_LIB(m, cosf)
 AC_CHECK_LIB(crypt, crypt)
-AC_CHECK_LIB(tirpc, main, [TIRPCINC="-DOPT_TIRPC -I/usr/include/tirpc"; TIRPCLIB=-ltirpc])
-AC_SUBST(TIRPCINC)
+AC_CHECK_LIB(Xinerama, XineramaQueryScreens, ,
+                       [AC_MSG_ERROR([libXinerama not found])])
+
+dnl Special check for tirpc...
+AC_CHECK_LIB(tirpc, svc_register,
+      [CFLAGS="${CFLAGS} -DOPT_TIRPC -I/usr/include/tirpc";
+       CXXFLAGS="${CXXFLAGS} -DOPT_TIRPC -I/usr/include/tirpc";
+       TIRPCLIB=-ltirpc])
 AC_SUBST(TIRPCLIB)
-AC_CHECK_LIB(Xinerama, XineramaQueryScreens, ,[AC_MSG_ERROR([libXinerama not found])])
 
 dnl Setup XTOOLLIB - we do it in this specific order to avoid ordering
 dnl issues