[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elk] patch to disable x11 with configure
Below, you'll find a patch to configure.ac and lib/Makefile.am that
provides a --disable-x11 argument to the configure script. X11 remains
enabled by default. Giving configure this argument should disable all
the X related extensions-- X11, Xt, Xaw, and Motif-- and will prevent
either the xlib or xwidgets directories from being compiled.
I tried to minimize the numbers of lines I changed, so some of the logic
is a little backwards, but it appears to work nicely on my system.
FWIW, I'm also getting a lot of warnings when compiling under gcc-4.1.1.
-nash
--
Please do not mock other religons
in your quest for the Spaghetti god.
- anonymous
---
Index: configure.ac
===================================================================
--- configure.ac (revision 273)
+++ configure.ac (working copy)
@@ -490,62 +490,106 @@
if test -n "${x_includes}"; then x_cflags="-I${x_includes}"; fi
if test -n "${x_libraries}"; then x_libs="-I${x_libraries}"; fi
-AC_CHECK_LIB(X11, XOpenDisplay,
- [ac_cv_my_have_x11=yes
- X_CFLAGS="${x_cflags}"
- X_LIBS="${x_libs} -lX11"],
- [ac_cv_my_have_x11=no],
- [[${x_libs}]])
+dnl
+dnl X11 library, should be able to toggle with a configure argument
+dnl
+AC_ARG_ENABLE(x11,
+ [ --enable-x11 Enable X11 support, if it's available (default,
yes).],
+ [case "${enableval}" in
+ yes)
+ try_with_x11="yes"
+ ;;
+ no)
+ try_with_x11="no"
+ ;;
+ *)
+ AC_MSG_ERROR([ bad value ${enableval} for --enable-debug ])
+ ;;
+ esac],
+ [try_with_x11="yes"])
+
+if test "x${try_with_x11}" != "xno" ; then
+ AC_CHECK_LIB(X11, XOpenDisplay,
+ [ac_cv_my_have_x11="yes"
+ X_CFLAGS="${x_cflags}"
+ X_LIBS="${x_libs} -lX11"],
+ [ac_cv_my_have_x11="no"],
+ [[${x_libs}]])
+else
+ ac_cv_my_have_x11="no"
+fi
+
AM_CONDITIONAL(HAVE_X11, test "${ac_cv_my_have_x11}" = "yes")
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
+
if test "${cross_compiling}" = "no"; then
- AC_CHECK_LIB(Xt, XtFree,
- [ac_cv_my_have_xt=yes
- AC_CHECK_LIB(Xmu, XmuDrawLogo,
- [XT_CFLAGS="${x_cflags}"
- XT_LIBS="${x_libs} -lXmu -lXt -lSM -lICE -lXext -lX11"],
- [XT_CFLAGS="${x_cflags}"
- XT_LIBS="${x_libs} -lXt -lSM -lICE -lXext -lX11"],
- [[-lXt -lSM -lICE -lXext -lX11 ${x_libs}]])],
- [ac_cv_my_have_xt=no],
- [[-lSM -lICE -lXext -lX11 ${x_libs}]])
+ dnl Only check for XT if X11 is enabled
+ if test "x${try_with_x11}" != "xno" ; then
+ AC_CHECK_LIB(Xt, XtFree,
+ [ac_cv_my_have_xt="yes"
+ AC_CHECK_LIB(Xmu, XmuDrawLogo,
+ [XT_CFLAGS="${x_cflags}"
+ XT_LIBS="${x_libs} -lXmu -lXt -lSM -lICE -lXext -lX11"],
+ [XT_CFLAGS="${x_cflags}"
+ XT_LIBS="${x_libs} -lXt -lSM -lICE -lXext -lX11"],
+ [[-lXt -lSM -lICE -lXext -lX11 ${x_libs}]])],
+ [ac_cv_my_have_xt="no"],
+ [[-lSM -lICE -lXext -lX11 ${x_libs}]])
+ else
+ ac_cv_my_have_xt="no"
+ fi
else
- ac_cv_my_have_xt=no
+ ac_cv_my_have_xt="no"
fi
+
AM_CONDITIONAL(HAVE_XT, test "${ac_cv_my_have_xt}" = "yes")
AC_SUBST(XT_CFLAGS)
AC_SUBST(XT_LIBS)
if test "${cross_compiling}" = "no"; then
- AC_CHECK_LIB(Xaw, XawTextSearch,
- [ac_cv_my_have_xaw=yes
- XAW_CFLAGS="${x_cflags}"
- XAW_LIBS="${x_libs} -lXaw ${XT_LIBS}"],
- [ac_cv_my_have_xaw=no],
- [[${XT_LIBS}]])
+ if test "x${try_with_x11}" != "xno" ; then
+ AC_CHECK_LIB(Xaw, XawTextSearch,
+ [ac_cv_my_have_xaw="yes"
+ XAW_CFLAGS="${x_cflags}"
+ XAW_LIBS="${x_libs} -lXaw ${XT_LIBS}"],
+ [ac_cv_my_have_xaw="no"],
+ [[${XT_LIBS}]])
+ else
+ ac_cv_my_have_xaw="no"
+ fi
else
ac_cv_my_have_xaw="no (cross-compiling)"
fi
+
AM_CONDITIONAL(HAVE_XAW, test "${ac_cv_my_have_xaw}" = "yes")
AC_SUBST(XAW_CFLAGS)
AC_SUBST(XAW_LIBS)
if test "${cross_compiling}" = "no"; then
- AC_CHECK_LIB(Xm, XmStringConcat,
- [ac_cv_my_have_motif=yes
- MOTIF_CFLAGS="${x_cflags} -I/usr/include/Xm"
- MOTIF_LIBS="${x_libs} -lXm ${XT_LIBS}"],
- [ac_cv_my_have_motif=no],
- [[${XT_LIBS}]])
+ if "x${try_with_x11}" != "xno" ; then
+ AC_CHECK_LIB(Xm, XmStringConcat,
+ [ac_cv_my_have_motif="yes"
+ MOTIF_CFLAGS="${x_cflags} -I/usr/include/Xm"
+ MOTIF_LIBS="${x_libs} -lXm ${XT_LIBS}"],
+ [ac_cv_my_have_motif="no"],
+ [[${XT_LIBS}]])
+ else
+ ac_cv_my_have_motif="no"
+ fi
else
ac_cv_my_have_motif="no (cross-compiling)"
fi
+
+echo 'ping pong!'
+
AM_CONDITIONAL(HAVE_MOTIF, test "${ac_cv_my_have_motif}" = "yes")
AC_SUBST(MOTIF_CFLAGS)
AC_SUBST(MOTIF_LIBS)
+echo 'ping pong!'
+
INCLUDES="${INCLUDES} -I\$(top_srcdir)/include
-I\$(top_builddir)/include"
AC_SUBST(INCLUDES)
@@ -560,9 +604,9 @@
AC_PROG_AWK
AC_MSG_CHECKING(for groff -ms)
if echo foo | groff -ms >/dev/null 2>&1; then
- ac_cv_my_have_groff=yes
+ ac_cv_my_have_groff="yes"
else
- ac_cv_my_have_groff=no
+ ac_cv_my_have_groff="no"
fi
AC_MSG_RESULT([${ac_cv_my_have_groff}])
AM_CONDITIONAL(HAVE_GROFF, test "${ac_cv_my_have_groff}" = "yes")
@@ -609,9 +653,10 @@
-------------------------
build C++ plugins: ${ac_cv_my_have_cxx}
libgdbm support: ${ac_cv_my_have_gdbm}
-X11 support: ${ac_cv_my_have_x11}
-Xaw support: ${ac_cv_my_have_xaw}
-Motif support: ${ac_cv_my_have_motif}
-build documentation: ${ac_cv_my_have_groff}
+ X11 support: ${ac_cv_my_have_x11}
+ XT support: ${ac_cv_my_have_xt}
+ Xaw support: ${ac_cv_my_have_xaw}
+ Motif support: ${ac_cv_my_have_motif}
+ build documentation: ${ac_cv_my_have_groff}
EOF
Index: lib/Makefile.am
===================================================================
--- lib/Makefile.am (revision 273)
+++ lib/Makefile.am (working copy)
@@ -1 +1,6 @@
-SUBDIRS = misc unix xlib xwidgets
+SUBDIRS = misc unix
+
+if HAVE_X11
+ SUBDIRS=$(SUBDIRS) xlib xwidgets
+endif
+
--
This is the elk mailing-list, see http://sam.zoy.org/elk/
Trouble unsubscribing? Please contact <sam@zoy.org>
List archives are at http://sam.zoy.org/elk/threads.html