fixed problem in autoconf using Xaw3d
[xboard.git] / configure.ac
index a5deaa0..97c2d00 100644 (file)
@@ -122,34 +122,31 @@ if test "$xt" == "no" ; then
    exit 1\r
 fi\r
 \r
    exit 1\r
 fi\r
 \r
-AC_ARG_WITH(Xaw3d, [  --with-Xaw3d            use Xaw3d instead of Xaw],\r
-  with_xaw3d="yes", with_xaw3d="no")\r
-\r
-\r
-xaw_headers="no"\r
-if test "$with_xaw3d" == "yes" ; then\r
-   XAW_LIBS="-lXaw3d"\r
-   AC_CHECK_LIB([Xaw3d], [XawTextReplace], xaw3d_lib="yes", xaw3d_lib="no")\r
-   if test "$xaw3d_lib" == "no" ; then\r
-      echo Xaw3d libraries not found\r
-      exit 1\r
-   else\r
-      AC_CHECK_HEADER(X11/Xaw3d/Dialog.h,xaw3d_headers="yes",xaw3d_headers="no")       \r
-      if test "$xaw3d_headers" == "yes" ; then\r
-        AC_DEFINE(USE_XAW3D)\r
-        xaw_headers="yes"\r
-      else\r
-       AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")     \r
-      fi\r
-   fi\r
-else\r
+dnl | test if user wants ot use Xaw3d headers\r
+AC_ARG_WITH([Xaw3d],\r
+            [AS_HELP_STRING([--with-Xaw3d],\r
+                            [use Xaw3d instead of Xaw])],\r
+            [with_xaw3d=yes],\r
+            [with_xaw3d=no])\r
+\r
+XAW_LIBS=\r
+AS_IF([test "x$with_xaw3d" != xno],\r
+      [AC_CHECK_LIB([Xaw3d], \r
+                    [XawTextReplace],\r
+                    [AC_SUBST([XAW_LIBS], \r
+                              ["-lXaw3d"])\r
+                     AC_DEFINE([USE_XAW3D], [1],\r
+                               [Define if you want to use Xaw3d])],\r
+                    [AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")\r
+                    AC_MSG_FAILURE(\r
+                              [--with-Xaw3d was given, but test for Xaw3d failed])],\r
+                              [-lXaw])])\r
+if test "$with_xaw3d" == "no" ; then\r
    XAW_LIBS="-lXaw"\r
    XAW_LIBS="-lXaw"\r
-   AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")\r
 fi\r
 fi\r
-\r
 AC_SUBST(XAW_LIBS)\r
 \r
 AC_SUBST(XAW_LIBS)\r
 \r
-\r
+dnl | end Xaw3d test\r
 \r
 if test "$xaw_headers" == "no" ; then\r
    echo Xaw headers not found \r
 \r
 if test "$xaw_headers" == "no" ; then\r
    echo Xaw headers not found \r