Move image files to etc/gnus.
[gnus] / aclocal.m4
1 # serial 1
2
3 AC_DEFUN(AM_PATH_LISPDIR,
4  [# If set to t, that means we are running in a shell under Emacs.
5   # If you have an Emacs named "t", then use the full path.
6   test "$EMACS" = t && EMACS=
7   test "$EMACS" || AC_PATH_PROGS(EMACS, emacs xemacs, no)
8   if test $EMACS != "no"; then
9     AC_MSG_CHECKING([where .elc files should go])
10     dnl Set default value
11     lispdir="\$(datadir)/emacs/site-lisp"
12     if test "x$prefix" = "xNONE"; then
13       if test -d $ac_default_prefix/share/emacs/site-lisp; then
14         lispdir="\$(prefix)/share/emacs/site-lisp"
15       else
16         if test -d $ac_default_prefix/lib/emacs/site-lisp; then
17           lispdir="\$(prefix)/lib/emacs/site-lisp"
18         fi
19       fi
20     else
21       if test -d $prefix/share/emacs/site-lisp; then
22         lispdir="\$(prefix)/share/emacs/site-lisp"
23       else
24         if test -d $prefix/lib/emacs/site-lisp; then
25           lispdir="\$(prefix)/lib/emacs/site-lisp"
26         fi
27       fi
28     fi
29     AC_MSG_RESULT($lispdir)
30   fi
31   AC_SUBST(lispdir)])
32
33 dnl AC_EMACS_LIST AC_XEMACS_P AC_PATH_LISPDIR and AC_EMACS_CHECK_LIB
34 dnl are stolen from w3.
35 dnl AC_PATH_LISPDIR obsoletes AM_PATH_LISPDIR.
36
37 AC_DEFUN(AC_EMACS_LISP, [
38 elisp="$2"
39 if test -z "$3"; then
40         AC_MSG_CHECKING(for $1)
41 fi
42 AC_CACHE_VAL(EMACS_cv_SYS_$1,[
43         OUTPUT=./conftest-$$
44         echo ${EMACS} -batch -eval "(let ((x ${elisp})) (write-region (if (stringp x) (princ x) (prin1-to-string x)) nil \"${OUTPUT}\"))" >& AC_FD_CC 2>&1  
45         ${EMACS} -batch -eval "(let ((x ${elisp})) (write-region (if (stringp x) (princ x 'ignore) (prin1-to-string x)) nil \"${OUTPUT}\"nil 5))" >& AC_FD_CC 2>&1
46         retval=`cat ${OUTPUT}`
47         echo "=> ${retval}" >& AC_FD_CC 2>&1
48         rm -f ${OUTPUT}
49         EMACS_cv_SYS_$1=$retval
50 ])
51 $1=${EMACS_cv_SYS_$1}
52 if test -z "$3"; then
53         AC_MSG_RESULT($$1)
54 fi
55 ])
56
57 AC_DEFUN(AC_XEMACS_P, [
58   AC_MSG_CHECKING([if $EMACS is really XEmacs])
59   AC_EMACS_LISP(xemacsp,(if (string-match \"XEmacs\" emacs-version) \"yes\" \"no\") ,"noecho")
60   XEMACS=${EMACS_cv_SYS_xemacsp}
61   EMACS_FLAVOR=emacs
62   if test "$XEMACS" = "yes"; then
63      EMACS_FLAVOR=xemacs
64   fi
65   AC_MSG_RESULT($XEMACS)
66   AC_SUBST(XEMACS)
67   AC_SUBST(EMACS_FLAVOR)
68 ])
69
70 AC_DEFUN(AC_PATH_LISPDIR, [
71   AC_XEMACS_P
72   if test "$prefix" = "NONE"; then
73         AC_MSG_CHECKING([prefix for your Emacs])
74         AC_EMACS_LISP(prefix,(expand-file-name \"..\" invocation-directory),"noecho")
75         prefix=${EMACS_cv_SYS_prefix}
76         AC_MSG_RESULT($prefix)
77   fi
78   AC_ARG_WITH(lispdir,[  --with-lispdir=DIR      Where to install lisp files], lispdir=${withval})
79   AC_MSG_CHECKING([where .elc files should go])
80   if test -z "$lispdir"; then
81     dnl Set default value
82     theprefix=$prefix
83     if test "x$theprefix" = "xNONE"; then
84         theprefix=$ac_default_prefix
85     fi
86     lispdir="\$(datadir)/${EMACS_FLAVOR}/site-lisp"
87     for thedir in share lib; do
88         potential=
89         if test -d ${theprefix}/${thedir}/${EMACS_FLAVOR}/site-lisp; then
90            lispdir="\$(prefix)/${thedir}/${EMACS_FLAVOR}/site-lisp"
91            break
92         fi
93     done
94   fi
95   AC_MSG_RESULT($lispdir)
96   AC_SUBST(lispdir)
97 ])
98
99 AC_DEFUN(AC_PATH_ETCDIR, [
100   AC_ARG_WITH(etcdir,[  --with-etcdir=DIR       Where to install etc files], etcdir=${withval})
101   AC_MSG_CHECKING([where etc files should go])
102   if test -z "$etcdir"; then
103     dnl Set default value
104     etcdir="\$(lispdir)/../etc"
105   fi
106   AC_MSG_RESULT($etcdir)
107   AC_SUBST(etcdir)
108 ])
109
110 dnl
111 dnl Check whether a function exists in a library
112 dnl All '_' characters in the first argument are converted to '-'
113 dnl
114 AC_DEFUN(AC_EMACS_CHECK_LIB, [
115 if test -z "$3"; then
116         AC_MSG_CHECKING(for $2 in $1)
117 fi
118 library=`echo $1 | tr _ -`
119 AC_EMACS_LISP($1,(progn (fmakunbound '$2) (condition-case nil (progn (require '$library) (fboundp '$2)) (error (prog1 nil (message \"$library not found\"))))),"noecho")
120 if test "${EMACS_cv_SYS_$1}" = "nil"; then
121         EMACS_cv_SYS_$1=no
122 fi
123 if test "${EMACS_cv_SYS_$1}" = "t"; then
124         EMACS_cv_SYS_$1=yes
125 fi
126 HAVE_$1=${EMACS_cv_SYS_$1}
127 AC_SUBST(HAVE_$1)
128 if test -z "$3"; then
129         AC_MSG_RESULT($HAVE_$1)
130 fi
131 ])
132
133 dnl
134 dnl Perform sanity checking and try to locate the W3 package
135 dnl
136 AC_DEFUN(AC_CHECK_W3, [
137 AC_MSG_CHECKING(for acceptable W3 version)
138 AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_W3,[
139 AC_EMACS_CHECK_LIB(w3_forms, w3-form-encode-xwfu,"noecho")
140 if test "${HAVE_w3_forms}" = "yes"; then
141         EMACS_cv_ACCEPTABLE_W3=yes
142 else
143         EMACS_cv_ACCEPTABLE_W3=no
144 fi
145
146 if test "${EMACS_cv_ACCEPTABLE_W3}" = "yes"; then
147         AC_EMACS_LISP(w3_dir,(file-name-directory (locate-library \"w3-forms\")),"noecho")
148         EMACS_cv_ACCEPTABLE_W3=$EMACS_cv_SYS_w3_dir
149 fi
150 ])
151    AC_ARG_WITH(w3,[  --with-w3=DIR           Specify where to find the w3 package], [ EMACS_cv_ACCEPTABLE_W3=`( cd $withval && pwd || echo "$withval" ) 2> /dev/null` ])
152    W3=${EMACS_cv_ACCEPTABLE_W3}
153    AC_SUBST(W3)
154    AC_MSG_RESULT("${W3}")
155 ])