autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: _AC_PATH_X


From: Akim Demaille
Subject: FYI: _AC_PATH_X
Date: 07 Dec 2000 16:26:36 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Just factoring a little to make things slightly more readable.  Some
work will be needed in this area, but for 2.51.  This patch was only
meant to help me understand the structure of the X macros while trying
to address the X_DISPLAY_MISSING problem.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * tests/atgeneral.m4 (AT_CHECK): Bad typo: assign `exit 1' to
        at_continue if something failed, not `:'.
        * tests/semantics.at (AC_PATH_XTRA): New.
        * acspecific.m4 (_AC_PATH_X): New, extracted form AC_PATH_X.

Index: acspecific.m4
===================================================================
RCS file: /cvs/autoconf/acspecific.m4,v
retrieving revision 1.320
diff -u -u -r1.320 acspecific.m4
--- acspecific.m4 2000/12/05 18:15:44 1.320
+++ acspecific.m4 2000/12/07 15:18:40
@@ -823,65 +823,9 @@
 ## --------------------- ##
 
 
-# AC_PATH_X
-# ---------
-# If we find X, set shell vars x_includes and x_libraries to the
-# paths, otherwise set no_x=yes.
-# Uses ac_ vars as temps to allow command line to override cache and checks.
-# --without-x overrides everything else, but does not touch the cache.
-AC_DEFUN([AC_PATH_X],
-[dnl Document the X abnormal options inherited from history.
-AC_DIVERT_ONCE([HELP_BEGIN], [
-X features:
-  --x-includes=DIR    X include files are in DIR
-  --x-libraries=DIR   X library files are in DIR])dnl
-AC_MSG_CHECKING([for X])
-
-AC_ARG_WITH(x, [  --with-x                use the X Window System])
-# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-if test "x$with_x" = xno; then
-  # The user explicitly disabled X.
-  have_x=disabled
-else
-  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-    # Both variables are already set.
-    have_x=yes
-  else
-AC_CACHE_VAL(ac_cv_have_x,
-[# One or both of the vars are not set, and there is no cached value.
-ac_x_includes=no ac_x_libraries=no
-_AC_PATH_X_XMKMF
-_AC_PATH_X_DIRECT
-if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
-  # Didn't find X anywhere.  Cache the known absence of X.
-  ac_cv_have_x="have_x=no"
-else
-  # Record where we found X for the cache.
-  ac_cv_have_x="have_x=yes \
-               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
-fi])dnl
-  fi
-  eval "$ac_cv_have_x"
-fi # $with_x != no
-
-if test "$have_x" != yes; then
-  AC_MSG_RESULT([$have_x])
-  no_x=yes
-else
-  # If each of the values was on the command line, it overrides each guess.
-  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
-  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-  # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes \
-               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
-fi
-])# AC_PATH_X
-
-
 # _AC_PATH_X_XMKMF
 # ----------------
-# Internal subroutine of AC_PATH_X.
+# Internal subroutine of _AC_PATH_X.
 # Set ac_x_includes and/or ac_x_libraries.
 m4_define([_AC_PATH_X_XMKMF],
 [rm -fr conftestdir
@@ -922,7 +866,7 @@
 
 # _AC_PATH_X_DIRECT
 # -----------------
-# Internal subroutine of AC_PATH_X.
+# Internal subroutine of _AC_PATH_X.
 # Set ac_x_includes and/or ac_x_libraries.
 m4_define([_AC_PATH_X_DIRECT],
 [# Standard set of common directories for X headers.
@@ -1001,6 +945,71 @@
 ])# _AC_PATH_X_DIRECT
 
 
+# _AC_PATH_X
+# ----------
+# Compute ac_cv_have_x.
+AC_DEFUN([_AC_PATH_X],
+[AC_CACHE_VAL(ac_cv_have_x,
+[# One or both of the vars are not set, and there is no cached value.
+ac_x_includes=no ac_x_libraries=no
+_AC_PATH_X_XMKMF
+_AC_PATH_X_DIRECT
+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi])dnl
+])
+
+
+# AC_PATH_X
+# ---------
+# If we find X, set shell vars x_includes and x_libraries to the
+# paths, otherwise set no_x=yes.
+# Uses ac_ vars as temps to allow command line to override cache and checks.
+# --without-x overrides everything else, but does not touch the cache.
+AC_DEFUN([AC_PATH_X],
+[dnl Document the X abnormal options inherited from history.
+AC_DIVERT_ONCE([HELP_BEGIN], [
+X features:
+  --x-includes=DIR    X include files are in DIR
+  --x-libraries=DIR   X library files are in DIR])dnl
+AC_MSG_CHECKING([for X])
+
+AC_ARG_WITH(x, [  --with-x                use the X Window System])
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+    _AC_PATH_X
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+  AC_MSG_RESULT([$have_x])
+  no_x=yes
+else
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
+fi
+])# AC_PATH_X
+
+
+
 # AC_PATH_XTRA
 # ------------
 # Find additional X libraries, magic flags, etc.
@@ -1008,7 +1017,7 @@
 [AC_REQUIRE([AC_PATH_X])dnl
 if test "$no_x" = yes; then
   # Not all programs may use this symbol, but it does not hurt to define it.
-  AC_DEFINE(X_DISPLAY_MISSING, 1,
+  AC_DEFINE([X_DISPLAY_MISSING], 1,
             [Define if the X Window System is missing or not being used.])
   X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
 else
Index: tests/atgeneral.m4
===================================================================
RCS file: /cvs/autoconf/tests/atgeneral.m4,v
retrieving revision 1.37
diff -u -u -r1.37 atgeneral.m4
--- tests/atgeneral.m4 2000/12/06 16:29:50 1.37
+++ tests/atgeneral.m4 2000/12/07 15:18:43
@@ -450,7 +450,7 @@
         expout, [AT_CLEANUP_FILES([expout])dnl
 $at_diff expout stdout >&5 || at_continue='exit 1'],
         [], [$at_diff empty stdout >&5 || at_continue='exit 1'],
-        [echo $at_n "m4_patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - 
stdout >&5 || at_continue=:])
+        [echo $at_n "m4_patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - 
stdout >&5 || at_continue='exit 1'])
 dnl Check exit val.
 case $at_status in
   77) exit 77;;
Index: tests/atspecific.m4
===================================================================
RCS file: /cvs/autoconf/tests/atspecific.m4,v
retrieving revision 1.32
diff -u -u -r1.32 atspecific.m4
--- tests/atspecific.m4 2000/12/06 14:05:47 1.32
+++ tests/atspecific.m4 2000/12/07 15:18:46
@@ -37,7 +37,9 @@
 
 
 # AT_CHECK_CONFIGURE
-# -------------------
+# ------------------
+# `top_srcdir' is needed so that `./configure' finds install-sh.
+# Using --srcdir is more expensive.
 m4_define([AT_CHECK_CONFIGURE],
 [AT_CLEANUP_FILE_IFELSE([config.hin],
                         [AT_CLEANUP_FILE(config.h)])dnl
Index: tests/mktests.sh
===================================================================
RCS file: /cvs/autoconf/tests/mktests.sh,v
retrieving revision 1.11
diff -u -u -r1.11 mktests.sh
--- tests/mktests.sh 2000/11/29 10:12:05 1.11
+++ tests/mktests.sh 2000/12/07 15:18:46
@@ -89,10 +89,13 @@
 #   Already tested by `AT_CHECK_MACRO'.
 # - AC_FD_CC
 #   Is a number.
-# - AC_PROG_CC, AC_C_(CONST|INLINE|VOLATILE)
+# - AC_PROG_CC, AC_C_(CONST|INLINE|VOLATILE), AC_PATH_XTRA
 #   Checked in semantics.
 # - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT
 #   AU defined to nothing.
+# - AC_PATH_XTRA
+#   Checked in semantics.
+#
 syntax_exclude_list='^AC_ARG_VAR$
 ^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
 ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
@@ -112,6 +115,7 @@
 ^AC_FD_CC$
 ^(AC_(PROG_CC|C_CONST|C_INLINE|C_VOLATILE))$
 ^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$
+^AC_PATH_XTRA$
 _AC_'
 
 # syntax_exclude_egrep --
Index: tests/semantics.at
===================================================================
RCS file: /cvs/autoconf/tests/semantics.at,v
retrieving revision 1.9
diff -u -u -r1.9 semantics.at
--- tests/semantics.at 2000/11/29 14:14:10 1.9
+++ tests/semantics.at 2000/12/07 15:18:48
@@ -1,12 +1,8 @@
 #                                                      -*- autoconf -*-
 
-cat <<EOF
+AT_BANNER([Semantics.])
 
-Semantics.
 
-EOF
-
-
 # AC_TRY_LINK_FUNC
 # ----------------
 AT_CHECK_MACRO(AC_TRY_LINK_FUNC,
@@ -361,7 +357,7 @@
 #define HAVE_STDIO_H 1
 ])
 
-AT_CLEANUP()dnl
+AT_CLEANUP
 
 
 # Non-strict preprocessors work if they produce no warnings.
@@ -390,5 +386,25 @@
 [/* #undef HAVE_AUTOCONF_IO_H */
 #define HAVE_STDIO_H 1
 ])
+
+AT_CLEANUP
+
+
+
+
+## -------------- ##
+## AC_PATH_XTRA.  ##
+## -------------- ##
+
+
+AT_SETUP([AC_PATH_XTRA])
+
+_AT_CHECK_AC_MACRO([AC_PATH_XTRA])
+
+# Check X_DISPLAY_MISSING.
+AT_CHECK([top_srcdir=$top_srcdir ./configure --without-x], 0, ignore)
+AT_CHECK_DEFINES(
+[#define X_DISPLAY_MISSING 1
+])
 
-AT_CLEANUP()dnl
+AT_CLEANUP
Index: tests/syntax.at
===================================================================
RCS file: /cvs/autoconf/tests/syntax.at,v
retrieving revision 1.4
diff -u -u -r1.4 syntax.at
--- tests/syntax.at 2000/11/29 14:58:44 1.4
+++ tests/syntax.at 2000/12/07 15:18:48
@@ -66,7 +66,6 @@
 AT_CHECK_MACRO([AC_MINIX])
 AT_CHECK_MACRO([AC_NO_EXECUTABLES])
 AT_CHECK_MACRO([AC_OUTPUT_COMMANDS])
-AT_CHECK_MACRO([AC_PATH_XTRA])
 AT_CHECK_MACRO([AC_PREFIX_DEFAULT])
 AT_CHECK_MACRO([AC_PROG_AWK])
 AT_CHECK_MACRO([AC_PROG_CC_C_O])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]