From 0648b5d06021ca5cacb34df1a8b5119e9d5e3ffe Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Mon, 13 Feb 2023 15:43:46 +0200 Subject: [PATCH] Add ./configure --with flags for X11 --with-x11 --with-xt --with-xaw All disabled by default, since the code has probably bitrotted. --- configure.ac | 83 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/configure.ac b/configure.ac index 885db67..131b074 100644 --- a/configure.ac +++ b/configure.ac @@ -26,6 +26,24 @@ AC_TYPE_SIZE_T # Check whether we are doing a native build AM_CONDITIONAL(NATIVE_BUILD, test "${cross_compiling}" = "no") +AC_ARG_WITH([x11], + [AS_HELP_STRING([--with-x11], + [enable support for libx11])], + [], + [with_x11=no]) + +AC_ARG_WITH([xt], + [AS_HELP_STRING([--with-xt], + [enable support for libxt])], + [], + [with_xt=no]) + +AC_ARG_WITH([xaw], + [AS_HELP_STRING([--with-xaw], + [enable support for libxaw])], + [], + [with_xaw=no]) + AC_CHECK_HEADERS(inttypes.h, [STDINT_HEADER=""], [AC_CHECK_HEADERS(sys/inttypes.h, @@ -484,48 +502,51 @@ AC_PATH_X 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}]]) +ac_cv_my_have_x11=no +AS_IF([test "x$with_x11" != xno], +[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}]])]) 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}]]) -else - ac_cv_my_have_xt=no -fi +ac_cv_my_have_xt=no +AS_IF([test "x$with_xt" != xno], +[AC_CHECK_LIB(Xt, XtFree, + if test "${cross_compiling}" = "no"; then + [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}]]) + 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}]]) -else - ac_cv_my_have_xaw="no (cross-compiling)" -fi +ac_cv_my_have_xaw=no +AS_IF([test "x$with_xaw" != xno], +[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}]]) + fi]) AM_CONDITIONAL(HAVE_XAW, test "${ac_cv_my_have_xaw}" = "yes") AC_SUBST(XAW_CFLAGS) AC_SUBST(XAW_LIBS) +ac_cv_my_have_motif=no if test "${cross_compiling}" = "no"; then AC_CHECK_LIB(Xm, XmStringConcat, [ac_cv_my_have_motif=yes @@ -533,8 +554,6 @@ if test "${cross_compiling}" = "no"; then MOTIF_LIBS="${x_libs} -lXm ${XT_LIBS}"], [ac_cv_my_have_motif=no], [[${XT_LIBS}]]) -else - ac_cv_my_have_motif="no (cross-compiling)" fi AM_CONDITIONAL(HAVE_MOTIF, test "${ac_cv_my_have_motif}" = "yes") AC_SUBST(MOTIF_CFLAGS)