/[auctex]/auctex/aclocal.m4
ViewVC logotype

Diff of /auctex/aclocal.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.57 by angeli, Wed Apr 27 18:24:46 2005 UTC revision 1.58 by dak, Sat Jun 4 09:51:34 2005 UTC
# Line 1  Line 1 
1  # serial 1  # serial 1
2    
3  dnl mostly stolen from emacs-w3m, credit to Katsumi Yamaoka  dnl this was once done by Katsumi Yamaoka <yamaoka@jpl.org>, but
4  dnl <yamaoka@jpl.org>  dnl pretty much no original code remains.
5    
6  AC_DEFUN(EMACS_EXAMINE_PACKAGEDIR,  dnl EMACS_LISP takes 5 arguments.  $1 is the name of the shell
7   [dnl Examine packagedir.  dnl variable to assign a value, $2 is a Lisp expression placed into
8    dnl $2 here is only for correcting old (CVS) mistakes  dnl shell double quotes (which has consequences for quoting and
9    tmpprefix="${prefix}"  dnl variable expansion).  $3 is a list of Emacs options evaluated before
10    AC_FULL_EXPAND(tmpprefix)  dnl the expression itself, $4 is a list of Elisp variables that is
11    EMACS_LISP(packagedir,  dnl assigned from the command line arguments from $5.
12      [(let* (\  
13             (putative-existing-lisp-dir (locate-library \"$1\"))\  AC_DEFUN(EMACS_LISP, [
14             (package-dir\    elisp="$2"
15             (and putative-existing-lisp-dir\    OUTPUT=./conftest-$$
16                  (setq putative-existing-lisp-dir\    echo "${EMACS}" -batch $3 -eval "(let* (patsubst([$4], [\w+], [(\&(pop command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x (prin1-to-string x)) nil \"${OUTPUT}\"))" $5 >& AC_FD_CC 2>&1
17                        (file-name-directory putative-existing-lisp-dir))\    "${EMACS}" -batch $3 -eval "(let* (patsubst([$4], [\w+], [(\&(pop command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x (prin1-to-string x)) nil \"${OUTPUT}\"))" $5 >& AC_FD_CC 2>&1
18                  (string-match \"[[\\\\/]]lisp[[\\\\/]]\\\\($2[[\\\\/]]\\\\)?\$\"\    $1="`cat ${OUTPUT}`"
19                                 putative-existing-lisp-dir)\    echo "=> [$]{$1}" >& AC_FD_CC 2>&1
20                  (replace-match \"\" t t putative-existing-lisp-dir))))\    rm -f ${OUTPUT}
21        (if (and (boundp (quote early-packages))\  ])
22                 (not package-dir))\  
23            (let ((dirs (append (if early-package-load-path early-packages)\  # This generates a prefix variables $1 from the executable in $2.
24                                (if late-package-load-path late-packages)\  # The executable is searched in PATH, and a potential bin/ or
25                                (if last-package-load-path last-packages))))\  # bin/architecture/ component is stripped from it.
26              (while (and dirs (not package-dir))\  AC_DEFUN(EMACS_PATH_PREFIX,[
27                (if (file-directory-p (car dirs))\    EMACS_LISP([$1],[[(condition-case nil (let*
28                    (setq package-dir (car dirs))\      ((prefix (directory-file-name (file-name-directory (executable-find cmd))))
29                    (setq dirs (cdr dirs))))))\       (parent (directory-file-name (file-name-directory prefix))))
30        (if package-dir\      (if (string= (file-name-nondirectory prefix) \"bin\")
31            (progn\          (setq prefix parent)
32              (if (string-match \"[[\\\\/]]\$\" package-dir)\        (if (string= (file-name-nondirectory parent) \"bin\")
33                  (setq package-dir (substring package-dir 0\           (setq prefix (directory-file-name (file-name-directory parent)))))
34                                               (match-beginning 0))))\      prefix) (error "NONE"))]],[[-no-site-file]],[[cmd]],[$2])])
35              (if (and prefix\  
36                       (progn\  AC_DEFUN(EMACS_PROG_EMACS, [
37                         (setq prefix (file-name-as-directory prefix))\  # Check for (X)Emacs, report its path, flavor and prefix
38                         (eq 0 (string-match (regexp-quote prefix)\  
39                                             package-dir))))\  # Apparently, if you run a shell window in Emacs, it sets the EMACS
40                  (replace-match (file-name-as-directory \"\${prefix}\") t t package-dir)\  # environment variable to 't'.  Let's undo the damage.
41                package-dir))\  if test "${EMACS}" = "t"; then
42          \"NONE\"))],     EMACS=""
43      [noecho],,[prefix],["${tmpprefix}"])])  fi
44    AC_ARG_WITH(emacs,
45      [  --with-emacs@<:@=PATH@:>@     Use Emacs to build (on PATH if given)],
46      [if test "${withval}" = "yes"; then EMACS=emacs
47       elif test "${withval}" = "no"; then EMACS=xemacs
48       else EMACS="${withval}"; fi])
49    
50    AC_ARG_WITH(xemacs,
51      [  --with-xemacs@<:@=PATH@:>@    Use XEmacs to build (on PATH if given)],
52      [if test "x${withval}" != xno
53       then
54         if test "x${with_emacs}" != xno -a "x${with_emacs}" != x
55         then
56           AC_MSG_ERROR([[cannot use both Emacs and XEmacs]])
57         fi
58         if test "x${withval}" = "xyes"
59         then
60           EMACS=xemacs
61         else
62           EMACS="${withval}"
63         fi
64       elif test "x${with_emacs}" = xno
65       then
66         AC_MSG_ERROR([[need to use either Emacs or XEmacs]])
67       fi])
68    
69    # "${prefix}/bin" is for Windows users
70    AC_PATH_PROGS(EMACS, ${EMACS} emacs xemacs, "", ${PATH} "${prefix}/bin" )
71    if test -z "${EMACS}"; then
72      AC_MSG_ERROR([(X)Emacs not found!  Aborting!])
73    fi
74    
75    AC_MSG_CHECKING([if ${EMACS} is XEmacs])
76    EMACS_LISP(XEMACS,
77            [[(if (featurep (quote xemacs)) \"yes\" \"no\")]],[[-no-site-file]])
78    if test "${XEMACS}" = "yes"; then
79      EMACS_FLAVOR=xemacs
80      EMACS_NAME="XEmacs"
81    elif test "${XEMACS}" = "no"; then
82      EMACS_FLAVOR=emacs
83      EMACS_NAME="Emacs"
84    else
85      AC_MSG_ERROR([Unable to run ${EMACS}!  Aborting!])
86    fi
87      AC_MSG_RESULT(${XEMACS})
88      AC_SUBST(XEMACS)
89      AC_SUBST(EMACS_FLAVOR)
90      AC_MSG_CHECKING([for ${EMACS_NAME} prefix])
91      EMACS_PATH_PREFIX([[emacsprefix]],[["${EMACS}"]])
92      AC_MSG_RESULT([["${emacsprefix}"]])
93    ])
94    
95    AC_DEFUN(AC_DATE_VERSION_FROM_CHANGELOG, [
96    AC_MSG_CHECKING([for date in ChangeLog])
97    $1=[`sed -n '1s/^\([-0-9][-0-9]*\).*/\1/p' ChangeLog`]
98    if test "X${$1}" = X
99    then
100      AC_MSG_ERROR([[not found]])
101    fi
102    AC_MSG_RESULT(${$1})
103    AC_MSG_CHECKING([for release in ChangeLog])
104    $2=[`sed -n '2,/^[0-9]/s/.*Version \(.*\) released\..*/\1/p' ChangeLog`]
105    if test "X${$2}" = X
106    then
107      $2=${$1}
108      AC_MSG_RESULT([not found, using ${$2} instead])
109    else
110      AC_MSG_RESULT([${$2}])
111    fi
112    ])
113    
114    AC_DEFUN(EMACS_CHECK_VERSION, [
115    AC_MSG_CHECKING([if ${EMACS_NAME} is recent enough])
116    EMACS_LISP(result,[(cond ((< emacs-major-version $1) \"no\")
117                             ((> emacs-major-version $1) \"yes\")
118                             ((< emacs-minor-version 0$2) \"no\")
119                             (t \"yes\"))],[[-no-site-file]])
120    AC_MSG_RESULT([${result}])
121    if test "${result}" != "yes"
122    then
123      AC_MSG_ERROR([This package requires at least ${EMACS_NAME} version $1.$2  Aborting!])
124    fi
125    ])
126    
127    dnl Look for an installation directory under given prefixes.
128    dnl $1 is the variable name we are looking for.
129    dnl $2 is a list of prefixes to try as a list of shell words
130    dnl $3 is a Lisp expression giving a list of directory names
131    dnl    those should be be either nil or a relative path like "tex/latex".
132    dnl   Those names are tried in turn, and every one of them is matched
133    dnl   against the tail of each location in $4.  nil matches everything,
134    dnl   it is a wildcard.
135    dnl $4 is Lisp expression giving a list of locations where to find names.
136    dnl   A location is only considered if it is nonnil, an existing
137    dnl   absolute directory,
138    dnl   and is a subdirectory of one of the given prefixes.
139    dnl $5,$6,$7 are additional arguments for the elisp call
140    AC_DEFUN(EMACS_EXAMINE_INSTALLATION_DIR,
141     [  for currentprefix in $2
142      do
143      expprefix="${currentprefix}"
144      AC_FULL_EXPAND(expprefix)
145      EMACS_LISP([$1],
146        [(catch 22
147           (let (reldir (dirs $4))
148              (dolist (name $3 \"NONE\")
149                (dolist (dir dirs)
150                  (when (and dir
151                             (setq dir (directory-file-name dir))
152                             (file-name-absolute-p dir)
153                             (file-directory-p dir)
154                             (not (string-match \"\\\\\`\\\\.\\\\.\"
155                               (setq reldir (file-relative-name dir expanded))))
156                             (not (file-name-absolute-p reldir))
157                             (let ((name name) (dir dir))
158                               (while (and dir name
159                                           (string= (file-name-nondirectory dir)
160                                                    (file-name-nondirectory name))
161                                  (setq dir (file-name-directory dir)
162                                       name (file-name-directory name))
163                                  (if (and dir name)
164                                     (setq dir (directory-file-name dir)
165                                          name (directory-file-name name)))))
166                                (null name))
167                       (throw 22
168                          (if (string= reldir \".\") (directory-file-name prefix)
169                            (concat (file-name-as-directory prefix)
170                                    reldir)))))))))],[$5],
171      [prefix expanded $6],["${currentprefix}" "${expprefix}" $7])
172      if test "[$]$1" != NONE; then break; fi; done])
173    
174  AC_DEFUN(EMACS_PATH_PACKAGEDIR,  AC_DEFUN(EMACS_PATH_PACKAGEDIR,
175   [dnl Check for packagedir.   [AC_ARG_WITH(packagedir,
176    dnl $2 here is only for correcting old (CVS) mistakes      [  --with-packagedir=DIR   package DIR for XEmacs],
177    if test ${EMACS_FLAVOR} = xemacs; then      [packagedir="`echo ${withval} | sed 's/^~\//${HOME}\//;s/[[\/\\]]$//'`"],
178      AC_MSG_CHECKING([for XEmacs package directory])      [if test ${EMACS_FLAVOR} = xemacs; then
179      AC_ARG_WITH(packagedir,        AC_MSG_CHECKING([for XEmacs package directory])
180        [  --with-packagedir=DIR   package DIR for XEmacs],        EMACS_EXAMINE_INSTALLATION_DIR(packagedir,
181        [if test "${withval}" = yes -o -z "${withval}"; then          [['${datadir}/xemacs/xemacs-packages' \
182          EMACS_EXAMINE_PACKAGEDIR($1,$2)            '${libdir}/xemacs/xemacs-packages' \
183        else            '${datadir}' '${libdir}' "${emacsprefix}"]],
184          packagedir="`echo ${withval} | sed 's/^~\//${HOME}\//;s/[[\/\\]]$//'`"          [[(list \"xemacs/site-packages\" \"xemacs/xemacs-packages\"
185        fi],                  \"site-packages\" \"xemacs-packages\")]],
186        [EMACS_EXAMINE_PACKAGEDIR($1,$2)])          [[(append late-packages last-packages early-packages)]])
187      if test -z "${packagedir}"; then        if test "x${packagedir}" = xNONE -o -z "${packagedir}"; then
188        AC_MSG_ERROR([not found, exiting!])          AC_MSG_ERROR([not found, exiting!])
189      fi        fi
190      AC_MSG_RESULT(${packagedir})        AC_MSG_RESULT(${packagedir})
191    else      else
192      packagedir=        packagedir=no
193    fi      fi])
194    AC_SUBST(packagedir)])    AC_SUBST(packagedir)])
195    
196    AC_DEFUN(EMACS_PATH_LISPDIR, [
197      AC_MSG_CHECKING([where lisp files go])
198      AC_ARG_WITH(lispdir,
199        [  --with-lispdir=DIR      A place in load-path for Lisp files; most
200                              files will be place in a subdirectory.],
201        [[lispdir="${withval}"]])
202      if test "X${lispdir}" = X; then
203         if test "${EMACS_FLAVOR}" = 'emacs'; then
204           # Test paths relative to prefixes
205           EMACS_EXAMINE_INSTALLATION_DIR(lispdir,
206             [['${datadir}/emacs' '${libdir}/emacs' "${emacsprefix}/share/emacs" \
207               '${datadir}' '${libdir}' "${emacsprefix}"]],
208             [[(list \"emacs/site-lisp\" \"emacs/site-packages\"
209                     \"site-lisp\" \"site-packages\")]], load-path)
210           if test "${lispdir}" = "NONE"; then
211             # No? notify user.
212             AC_MSG_ERROR([Cannot locate lisp directory,
213    use  --with-lispdir, --datadir, or possibly --prefix to rectify this])
214           fi
215         else
216           # XEmacs
217           lispdir="${packagedir}/lisp"
218         fi
219        fi
220      AC_MSG_RESULT([[${lispdir}]])
221      AC_SUBST(lispdir)
222    ])
223    
224    
225  AC_DEFUN(TEX_PATH_TEXMFDIR,  AC_DEFUN(TEX_PATH_TEXMFDIR,
226   [   [
227  AC_ARG_WITH(texmf-dir,[  --with-texmf-dir=DIR    TEXMF tree to install into],  AC_ARG_WITH(texmf-dir,
228    [  --with-texmf-dir=DIR    TEXMF tree to install into,
229                             or --without-texmf-dir for runtime config],
230   [ texmfdir="${withval}" ;   [ texmfdir="${withval}" ;
231     AC_FULL_EXPAND(withval)     if test "x${texmfdir}" = xno
232     if test ! -d "$withval"  ; then     then
233        AC_MSG_ERROR([--with-texmf-dir="$texmfdir": Directory does not exist])       previewtexmfdir="${packagedatadir}/latex"
234         previewdocdir="${packagedatadir}/doc"
235       else
236         AC_FULL_EXPAND(withval)
237         if test ! -d "${withval}"  ; then
238            AC_MSG_ERROR([--with-texmf-dir="${texmfdir}": Directory does not exist])
239         fi
240         previewtexmfdir="${texmfdir}/tex/latex/preview"
241         previewdocdir="${texmfdir}/doc/latex/styles"
242     fi     fi
    previewtexmfdir='${texmfdir}/tex/latex/preview'  
    previewdocdir='${texmfdir}/doc/latex/styles'  
243     ])     ])
244    
245  AC_ARG_WITH(tex-dir,  AC_ARG_WITH(tex-dir,
246   [  --with-tex-dir=DIR      Location to install preview TeX sources],   [  --with-tex-dir=DIR      Location to install preview TeX sources],
247   [ previewtexmfdir="${withval}" ;   [ previewtexmfdir="${withval}" ;
248     AC_FULL_EXPAND(withval)     AC_FULL_EXPAND(withval)
249     if test ! -d "$withval"  ; then     if test ! -d "${withval}"  ; then
250        AC_MSG_ERROR([--with-tex-dir="$previewtexmfdir": Directory does not exist])        AC_MSG_ERROR([--with-tex-dir="${previewtexmfdir}": Directory does not exist])
251     fi     fi
252     ])     ])
253    
# Line 90  AC_ARG_WITH(doc-dir, Line 255  AC_ARG_WITH(doc-dir,
255    [  --with-doc-dir=DIR      Location to install preview.dvi],    [  --with-doc-dir=DIR      Location to install preview.dvi],
256    [ previewdocdir="${withval}" ;    [ previewdocdir="${withval}" ;
257     AC_FULL_EXPAND(withval)     AC_FULL_EXPAND(withval)
258     if test ! -d "$withval"  ; then     if test ! -d "${withval}"  ; then
259        AC_MSG_ERROR([--with-doc-dir="$previewdocdir": Directory does not exist])        AC_MSG_ERROR([--with-doc-dir="${previewdocdir}": Directory does not exist])
260     fi     fi
261     ])     ])
262    
263  # First check for docstrip.cfg information  # First check for docstrip.cfg information -- removed.  Too high
264    # likelihood to pick up a user preference instead of a system setting.
265    
 if test -z "$previewtexmfdir" ; then  
     AC_MSG_CHECKING([for docstrip directory configuration])  
     cat > testdocstrip.tex <<\EOF  
 \input docstrip  
 \ifx\basedir\undefined\else  
    \message{^^J--preview-tex-dir=\showdirectory{tex/latex/preview}^^J%  
                --texmf-prefix=\basedir^^J}  
 \fi  
 \endbatchfile  
 EOF  
     "$LATEX" '\nonstopmode \input testdocstrip' >&5 2>&1  
     texmfdir=`sed -n -e 's+/* *$++' -e '/^--texmf-prefix=/s///p' testdocstrip.log 2>&5`  
     previewtexmfdir=`sed -n -e '/UNDEFINED/d' -e 's+/* *$++' -e '/^--preview-tex-dir=/s///p' testdocstrip.log 2>&5 `  
     if test -z "$previewtexmfdir"  ; then  
         if test ! -z "$texmfdir"  ; then  
             previewtexmfdir='${texmfdir}'  
             previewdocdir='${texmfdir}'  
         fi  
     else  
         previewdocdir='${texmfdir}/doc/latex/styles'  
     fi  
266  # Next  # Next
267  # kpsepath -n latex tex  # kpsepath -n latex tex
268  # and then go for the following in its output:  # and then go for the following in its output:
269  # a) first absolute path component ending in tex/latex// (strip trailing  # a) first path component in datadir/prefix ending in tex/latex// (strip trailing
270  # // and leading !!):  "Searching for TDS-compliant directory."  Install  # // and leading !!):  "Searching for TDS-compliant directory."  Install
271  # in preview subdirectory.  # in preview subdirectory.
272  # b) first absolute path component ending in // "Searching for directory  # b) first absolute path component ending in // "Searching for directory
273  # hierarchy"  Install in preview subdirectory.  # hierarchy"  Install in preview subdirectory.
274  # c) anything absolute.  Install both files directly there.  # c) anything absolute.  Install both files directly there.
275    
276  if test -z "$previewtexmfdir"  ; then  if test "x${texmfdir}" != xno ; then
277  AC_MSG_RESULT([no])  if test "x${previewtexmfdir}" = x ; then
278    
279    AC_MSG_CHECKING([for prefix from kpsepath])
280    
281    EMACS_PATH_PREFIX(texprefix,kpsepath)
282    
283    if test "x${texprefix}" != "xNONE"
284    then
285    
286    AC_MSG_RESULT([["${texprefix}"]])
287    
288  AC_MSG_CHECKING([for TDS-compliant directory])  AC_MSG_CHECKING([for TDS-compliant directory])
289  for x in `kpsepath -n latex tex | tr ':' '\\n' | sed -e 's/^!!//' | \  
290                  grep '^/.*/tex/latex//$' `  pathoutput="`kpsepath -n latex tex`"
291  do  
292    x="`echo $x | sed -e 's+//+/+g' -e 's+/\$++' `"  EMACS_EXAMINE_INSTALLATION_DIR(texmfdir,
293    if test -d "$x"  ; then    [['${datadir}/texmf' "${texprefix}/share/texmf-local" "${texprefix}/share/texmf" "${texprefix}/texmf-local" "${texprefix}/texmf"]],
294       texmfdir="`echo $x | sed -e 's+/tex/latex++'`"    [[(list nil)]],
295       previewdocdir='${texmfdir}/doc/latex/styles'    [[(mapcar (lambda(x)
296       previewtexmfdir='${texmfdir}/tex/latex/preview'                (and (string-match \"\\\\\`!*\\\\(.*\\\\)/tex/latex//+\\\\'\" x)
297       break                     (match-string 1 x)))
298    fi        (append (split-string pathoutput \";\")
299  done               (split-string pathoutput \":\")))]],
300        [[-no-site-file]],
301        [[pathoutput]],[["${pathoutput}"]])
302    
303    if test -n "${texmfdir}" -a "${texmfdir}" != "NONE" ; then
304       previewdocdir="${texmfdir}/doc/latex/styles"
305       previewtexmfdir="${texmfdir}/tex/latex/preview"
306  fi  fi
307    
308  if test -z "$previewtexmfdir"  ; then  if test -z "${previewtexmfdir}" -o "${previewtexmfdir}" = no  ; then
309    
310  AC_MSG_RESULT([no])  AC_MSG_RESULT([no])
311  AC_MSG_CHECKING([for TeX directory hierarchy])  AC_MSG_CHECKING([for TeX directory hierarchy])
312  for x in `kpsepath -n latex tex | tr ':' '\\n' | sed -e 's/^!!//' | \  
313                  grep '^/.*//$'`  EMACS_EXAMINE_INSTALLATION_DIR(texmfdir,
314  do    [['${datadir}/texmf' "${texprefix}/share/texmf-local" "${texprefix}/share/texmf" "${texprefix}/texmf-local" "${texprefix}/texmf" '${datadir}' "${texprefix}/share" "${texprefix}"]],
315    if test -d "$x"  ; then    [[(list nil)]],
316       texmfdir="$x"    [[(mapcar (lambda(x)
317       previewtexmfdir='${texmfdir}/preview'                (and (string-match \"\\\\\`!*\\\\(.*[^/]\\\\)//+\\\\'\" x)
318       previewdocdir='${texmfdir}/preview'                     (match-string 1 x)))
319       break        (append (split-string pathoutput \";\")
320    fi               (split-string pathoutput \":\")))]],
321  done      [[-no-site-file]],
322        [[pathoutput]],[["${pathoutput}"]])
323    
324    if test -n "${texmfdir}" -a "${texmfdir}" != "NONE" ; then
325       previewtexmfdir="${texmfdir}/preview"
326       previewdocdir="${texmfdir}/preview"
327  fi  fi
328    fi
329    
330    if test -z "${previewtexmfdir}" -o "${previewtexmfdir}" = no  ; then
331    
 if test -z "$previewtexmfdir"  ; then  
332  AC_MSG_RESULT([no])  AC_MSG_RESULT([no])
333  AC_MSG_CHECKING([for TeX input directory])  AC_MSG_CHECKING([for TeX input directory])
334  for x in `kpsepath -n latex tex | tr ':' '\\n' | sed -e 's/^!!//' | \  
335                  grep '^/'`  EMACS_EXAMINE_INSTALLATION_DIR(texmfdir,
336  do    [['${datadir}' "${texprefix}/share" "${texprefix}"]],
337    if test -d "$x"  ; then    [[(list nil)]],
338       texmfdir="$x"    [[(mapcar (lambda(x)
339       previewdocdir='${texmfdir}'                (and (string-match \"\\\\\`!*\\\\(.*[^/]\\\\)/?\\\\'\" x)
340       break                     (match-string 1 x)))
341    fi        (append (split-string pathoutput \";\")
342  done               (split-string pathoutput \":\")))]],
343        [[-no-site-file]],
344        [[pathoutput]],[["${pathoutput}"]])
345    
346    if test -n "${texmfdir}" -a "${texmfdir}" != "NONE" ; then
347       previewtexmfdir="${texmfdir}"
348       previewdocdir="${texmfdir}"
349  fi  fi
350    fi
351    fi
352    
353    if test -z "${previewtexmfdir}" -o "${previewtexmfdir}" = no  ; then
354    
 if test -z "$previewtexmfdir"  ; then  
355  AC_MSG_RESULT([no])  AC_MSG_RESULT([no])
356          AC_MSG_ERROR([Cannot find the texmf directory!          AC_MSG_ERROR([Cannot find the texmf directory!
357  Please use --with-texmf-dir=dir to specify where the preview tex files go])  Please use --with-texmf-dir=dir to specify where the preview tex files go])
358  fi  fi
359       AC_MSG_RESULT($texmfdir)  
360    AC_MSG_RESULT(${texmfdir})
361    fi
362  fi  fi
363    
364  echo Preview will be placed in $previewtexmfdir  echo Preview will be placed in ${previewtexmfdir}
365  echo Preview docs will be placed in $previewdocdir  echo Preview docs will be placed in ${previewdocdir}
366  AC_SUBST(texmfdir)  AC_SUBST(texmfdir)
367  AC_SUBST(previewtexmfdir)  AC_SUBST(previewtexmfdir)
368  AC_SUBST(previewdocdir)])  AC_SUBST(previewdocdir)])
369    
370  AC_DEFUN(AC_FULL_EXPAND,  AC_DEFUN(AC_FULL_EXPAND,
371  [ while :;do case "[$]$1" in *\[$]*) __ac_tmp__='s/[[\`"]]/\\&/g'  [ __ac_tmp_oldprefix__="${prefix}"
372      __ac_tmp_oldexec_prefix__="$exec_prefix"
373     test "x${prefix}" = xNONE && prefix="${ac_default_prefix}"
374     test "x${exec_prefix}" = xNONE && exec_prefix='${prefix}'
375     while :;do case "[$]$1" in *\[$]*) __ac_tmp__='s/[[\`"-"]]/\\&/g'
376  eval "$1=`sed ${__ac_tmp__} <<EOF  eval "$1=`sed ${__ac_tmp__} <<EOF
377  [$]$1  [$]$1
378  EOF  EOF
379  `";; *) break ;; esac; done ])  `";; *) break ;; esac; done
380  dnl "    prefix="${__ac_tmp_oldprefix__}"
381      exec_prefix="${__ac_tmp_oldexec_prefix__}" ])
   
   
 dnl EMACS_LISP EMACS_PROG_EMACS EMACS_PATH_LISPDIR and EMACS_CHECK_LIB  
 dnl adapted from w3.  
   
 dnl EMACS_LISP takes 6 arguments.  $1 is the name of the shell  
 dnl variable to assign a value, $2 is a Lisp expression placed into  
 dnl shell double quotes (which has consequences for quoting and  
 dnl variable expansion).  $3 is ignored; it is there for historical  
 dnl reasons.  $4 is a list of Emacs options evaluated before the  
 dnl expression itself, $5 is a list of Elisp variables that is  
 dnl assigned from the command line arguments from $6.  
   
 AC_DEFUN(EMACS_LISP, [  
   elisp="$2"  
   OUTPUT=./conftest-$$  
   echo "${EMACS}" -batch $4 -eval "(let* (patsubst([$5], [\w+], [(\&(pop command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x (prin1-to-string x)) nil \"${OUTPUT}\"))" $6 >& AC_FD_CC 2>&1  
   "${EMACS}" -batch $4 -eval "(let* (patsubst([$5], [\w+], [(\&(pop command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x (prin1-to-string x)) nil \"${OUTPUT}\"))" $6 >& AC_FD_CC 2>&1  
   $1="`cat ${OUTPUT}`"  
   echo "=> ${1}" >& AC_FD_CC 2>&1  
   rm -f ${OUTPUT}  
 ])  
   
   
 AC_DEFUN(EMACS_PROG_EMACS, [  
 # Check for (X)Emacs, report its path, flavor and version  
   
 # Apparently, if you run a shell window in Emacs, it sets the EMACS  
 # environment variable to 't'.  Let's undo the damage.  
 if test "${EMACS}" = "t"; then  
    EMACS=""  
 fi  
 AC_ARG_WITH(emacs,  
   [  --with-emacs@<:@=PATH@:>@     Use Emacs to build (on PATH if given)],  
   [if test "${withval}" = "yes"; then EMACS=emacs  
    else if test "${withval}" = "no"; then EMACS=xemacs  
    else EMACS="${withval}"; fi ; fi])  
 AC_ARG_WITH(xemacs,  
   [  --with-xemacs@<:@=PATH@:>@    Use XEmacs to build (on PATH if given)],  
   [if test "${withval}" = "yes"; then EMACS=xemacs;  
    else if test "${withval}" = "no"; then EMACS=emacs  
    else EMACS="${withval}"; fi ; fi])  
   
 # "${prefix}/bin" is for Windows users  
 AC_PATH_PROGS(EMACS, $EMACS emacs xemacs, "", $PATH "${prefix}/bin" )  
 if test -z "$EMACS"; then  
   AC_MSG_ERROR([(X)Emacs not found!  Aborting!])  
 fi  
   
 AC_MSG_CHECKING([if $EMACS is XEmacs])  
 EMACS_LISP(XEMACS,  
         [(if (string-match \"XEmacs\" emacs-version) \"yes\" \"no\")])  
 if test "$XEMACS" = "yes"; then  
   EMACS_FLAVOR=xemacs  
 else  
   if test "$XEMACS" = "no"; then  
     EMACS_FLAVOR=emacs  
   else  
     AC_MSG_ERROR([Unable to run $EMACS!  Aborting!])  
   fi  
 fi  
   AC_MSG_RESULT($XEMACS)  
   AC_SUBST(XEMACS)  
   AC_SUBST(EMACS_FLAVOR)  
 ])  
   
 AC_DEFUN(EMACS_CHECK_MAJOR_VERSION, [  
 AC_MSG_CHECKING([if (X)Emacs is recent enough])  
 EMACS_LISP(EMACS_MAJOR_VERSION,[emacs-major-version])  
 if (( $EMACS_MAJOR_VERSION < $1 )); then  
   AC_MSG_RESULT([no])  
   AC_MSG_ERROR([This package requires at least (X)Emacs version $1.  Aborting!])  
 else  
   AC_MSG_RESULT([yes])  
 fi  
   AC_SUBST(EMACS_MAJOR_VERSION)  
 ])  
   
 dnl "\${packagedir}/lisp"  
   
 AC_DEFUN(EMACS_TEST_LISPDIR, [  
   for i in "\${datadir}/${EMACS_FLAVOR}/site-lisp" \  
            "\${libdir}/${EMACS_FLAVOR}/site-lisp" \  
            "\${libdir}/${EMACS_FLAVOR}/site-packages/lisp" \  
            "\${datadir}/${EMACS_FLAVOR}/site-packages/lisp" \  
            "\${prefix}/site-lisp" ; do  
     lispdir="$i"  
     AC_FULL_EXPAND(i)  
     EMACS_LISPDIR=""  
     EMACS_LISP(EMACS_LISPDIR,  
       [[(let ((load-path load-path)  
              (pattern (concat \"^\" (regexp-quote cmdpath) \"[/\\\\]?\$\")))  
          (while (and load-path (not (string-match pattern  
                                                   (car load-path))))  
                 (setq load-path (cdr load-path)))  
          (if load-path \"yes\" \"no\"))]],,,[cmdpath],["$i"])  
     if test "$EMACS_LISPDIR" = "yes"; then  
       break  
     fi  
   done  
   if test "$EMACS_LISPDIR" = "no"; then  
     lispdir="NONE"  
   fi  
 ])  
   
   
 AC_DEFUN(EMACS_PATH_LISPDIR, [  
   AC_MSG_CHECKING([where lisp files go])  
   AC_ARG_WITH(lispdir,  
     [  --with-lispdir=DIR      Where to install lisp files, note that most  
                            of AUCTeX will be installed in a subdirectory],  
     [lispdir="${withval}"  
      # Store expanded path minus trailing slash, may be added to (X)Emacs load-path  
      lispdir_expanded="`echo $lispdir | sed 's/[[\/\\]]$//'`"  
      AC_FULL_EXPAND(lispdir_expanded)  
     ],  
     [  
      # Save prefix  
      oldprefix=${prefix}  
      oldexec_prefix=${exec_prefix}  
      if test "${prefix}" = "NONE"; then  
        # Set prefix temporarily  
        prefix="${ac_default_prefix}"  
      fi  
      if test "${exec_prefix}" = "NONE"; then  
        # Set exec_prefix temporarily  
         exec_prefix="${prefix}"  
      fi  
      if test "${EMACS_FLAVOR}" = 'emacs' -o "${packagedir}" = 'no'; then  
        # Test paths relative to prefixes  
        EMACS_TEST_LISPDIR  
        if test "$lispdir" = "NONE"; then  
          # No? Test paths relative to binary  
          EMACS_LISP(prefix,[(expand-file-name \"..\" invocation-directory)])  
          exec_prefix=${prefix}  
          EMACS_TEST_LISPDIR  
          AC_FULL_EXPAND(lispdir)  
        fi  
        if test "$lispdir" = "NONE"; then  
          # No? notify user.  
          AC_MSG_ERROR([Cannot locate lisp directory,  
 use  --with-lispdir, --datadir, or possibly --prefix to rectify this])  
        fi  
      else  
        # XEmacs  
        lispdir='${packagedir}/lisp'  
      fi  
      # Store expanded path, may be added to (X)Emacs load-path  
      lispdir_expanded="$lispdir"  
      AC_FULL_EXPAND(lispdir_expanded)  
      # Restore prefix  
      prefix=${oldprefix}  
      exec_prefix=${oldexec_prefix}  
     ])  
   AC_MSG_RESULT([${lispdir}, expanded to ${lispdir_expanded}])  
   AC_SUBST(lispdir)  
 ])  
   
382    
383  AC_DEFUN(AC_CHECK_PROG_REQUIRED, [  AC_DEFUN(AC_CHECK_PROG_REQUIRED, [
384  AC_CHECK_PROG($1, $2, NONE)  AC_CHECK_PROG($1, $2, NONE)
# Line 393  if test -z "$3"; then Line 419  if test -z "$3"; then
419          AC_MSG_CHECKING(for $2 in $1)          AC_MSG_CHECKING(for $2 in $1)
420  fi  fi
421  library=`echo $1 | tr _ -`  library=`echo $1 | tr _ -`
422  EMACS_LISP(EMACS_cv_SYS_$1,(progn (fmakunbound '$2) (condition-case nil (progn (require '$library) (fboundp '$2)) (error (prog1 nil (message \"$library not found\"))))),"noecho")  EMACS_LISP(EMACS_cv_SYS_$1,(progn (fmakunbound '$2) (condition-case nil (progn (require '${library}) (fboundp '$2)) (error (prog1 nil (message \"${library} not found\"))))))
423  if test "${EMACS_cv_SYS_$1}" = "nil"; then  if test "${EMACS_cv_SYS_$1}" = "nil"; then
424          EMACS_cv_SYS_$1=no          EMACS_cv_SYS_$1=no
425  fi  fi
# Line 403  fi Line 429  fi
429  HAVE_$1=${EMACS_cv_SYS_$1}  HAVE_$1=${EMACS_cv_SYS_$1}
430  AC_SUBST(HAVE_$1)  AC_SUBST(HAVE_$1)
431  if test -z "$3"; then  if test -z "$3"; then
432          AC_MSG_RESULT($HAVE_$1)          AC_MSG_RESULT(${HAVE_$1})
433  fi  fi
434  ])  ])
435    
# Line 417  if test -z "$2"; then Line 443  if test -z "$2"; then
443  fi  fi
444  library=`echo $1 | tr _ -`  library=`echo $1 | tr _ -`
445  EMACS_LISP($1,  EMACS_LISP($1,
446          [(condition-case nil (require '$library ) \          [(condition-case nil (require '${library} ) \
447          (error (prog1 nil (message \"$library not found\"))))],"noecho")          (error (prog1 nil (message \"${library} not found\"))))])
448  if test "$$1" = "nil"; then  if test "$$1" = "nil"; then
449          $1=no          $1=no
450  fi  fi
451  if test "$$1" = "$library"; then  if test "$$1" = "${library}"; then
452          $1=yes          $1=yes
453  fi  fi
454  HAVE_$1=$$1  HAVE_$1=$$1
455  AC_SUBST(HAVE_$1)  AC_SUBST(HAVE_$1)
456  if test -z "$2"; then  if test -z "$2"; then
457          AC_MSG_RESULT($HAVE_$1)          AC_MSG_RESULT(${HAVE_$1})
458  fi  fi
459  ])  ])
460    
# Line 440  AC_MSG_CHECKING(for the location of AUCT Line 466  AC_MSG_CHECKING(for the location of AUCT
466  AC_ARG_WITH(tex-site,[  --with-tex-site=DIR     Location of AUCTeX's tex-site.el, if not standard],  AC_ARG_WITH(tex-site,[  --with-tex-site=DIR     Location of AUCTeX's tex-site.el, if not standard],
467   [ auctexdir="${withval}" ;   [ auctexdir="${withval}" ;
468     AC_FULL_EXPAND(withval)     AC_FULL_EXPAND(withval)
469     if test ! -d "$withval"  ; then     if test ! -d "${withval}"  ; then
470        AC_MSG_ERROR([--with-tex-site=$auctexdir: Directory does not exist])        AC_MSG_ERROR([--with-tex-site=${auctexdir}: Directory does not exist])
471     fi     fi
472  ])  ])
473  if test -z "$auctexdir" ; then  if test -z "${auctexdir}" ; then
474    AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_AUCTEX,[    AC_CACHE_VAL(EMACS_cv_ACCEPTABLE_AUCTEX,[
   EMACS_CHECK_REQUIRE(tex_site,silent)  
   if test "${HAVE_tex_site}" = "yes"; then  
475      EMACS_LISP(EMACS_cv_ACCEPTABLE_AUCTEX,      EMACS_LISP(EMACS_cv_ACCEPTABLE_AUCTEX,
476          [[(let ((aucdir (file-name-directory (locate-library \"tex-site\"))))\          [[(condition-case nil
477             (if (string-match \"[\\\\/]\$\" aucdir)\               (directory-file-name (file-name-directory
478                 (replace-match \"\" t t aucdir)\                  (locate-library \"tex-site\")))
479                 aucdir))]], "noecho")              (error \"\"))]])
480    else      if test -z "${EMACS_cv_ACCEPTABLE_AUCTEX}" ; then
481          AC_MSG_ERROR([Can't find AUCTeX!  Please install it!          AC_MSG_ERROR([Can't find AUCTeX!  Please install it!
482  Check the PROBLEMS file for details.])  Check the PROBLEMS file for details.])
483    fi    fi
484    ])    ])
485    auctexdir=${EMACS_cv_ACCEPTABLE_AUCTEX}    auctexdir="${EMACS_cv_ACCEPTABLE_AUCTEX}"
486  fi  fi
487  AC_MSG_RESULT(${auctexdir})  AC_MSG_RESULT(${auctexdir})
488  AC_SUBST(auctexdir)  AC_SUBST(auctexdir)
# Line 486  dnl MAKEINFO_CHECK_MACRO( MACRO, [ACTION Line 510  dnl MAKEINFO_CHECK_MACRO( MACRO, [ACTION
510  dnl                                     [, ACTION-IF-NOT-FOUND]])  dnl                                     [, ACTION-IF-NOT-FOUND]])
511  dnl  dnl
512  AC_DEFUN(MAKEINFO_CHECK_MACRO,  AC_DEFUN(MAKEINFO_CHECK_MACRO,
513  [if test -n "$MAKEINFO" -a "$makeinfo" != ":"; then  [if test -n "${MAKEINFO}" -a "${makeinfo}" != ":"; then
514    AC_MSG_CHECKING([if $MAKEINFO understands @$1{}])    AC_MSG_CHECKING([if ${MAKEINFO} understands @$1{}])
515    echo \\\\input texinfo > conftest.texi    echo \\\\input texinfo > conftest.texi
516    echo @$1{test} >> conftest.texi    echo @$1{test} >> conftest.texi
517    if $MAKEINFO conftest.texi > /dev/null 2> /dev/null; then    if ${MAKEINFO} conftest.texi > /dev/null 2> /dev/null; then
518      AC_MSG_RESULT(yes)      AC_MSG_RESULT(yes)
519      ifelse([$2], , :, [$2])      ifelse([$2], , :, [$2])
520    else    else
# Line 507  dnl                                    [, ACTION-IF-NOT-FOUND]]) Line 531  dnl                                    [, ACTION-IF-NOT-FOUND]])
531  dnl  dnl
532  AC_DEFUN(MAKEINFO_CHECK_MACROS,  AC_DEFUN(MAKEINFO_CHECK_MACROS,
533  [for ac_macro in $1; do  [for ac_macro in $1; do
534      MAKEINFO_CHECK_MACRO($ac_macro, $2,      MAKEINFO_CHECK_MACRO(${ac_macro}, $2,
535          [MAKEINFO_MACROS="-D no-$ac_macro $MAKEINFO_MACROS"          [MAKEINFO_MACROS="-D no-${ac_macro} ${MAKEINFO_MACROS}"
536          $3])dnl          $3])dnl
537    done    done
538  AC_SUBST(MAKEINFO_MACROS)  AC_SUBST(MAKEINFO_MACROS)
# Line 530  AC_DEFUN(VALID_BUILD_DIR, [ Line 554  AC_DEFUN(VALID_BUILD_DIR, [
554      [[(if (or (member (directory-file-name default-directory) load-path)\      [[(if (or (member (directory-file-name default-directory) load-path)\
555                (member (file-name-as-directory default-directory) load-path))\                (member (file-name-as-directory default-directory) load-path))\
556           \"no\" \"yes\")]])           \"no\" \"yes\")]])
557    if test "$valid_build_dir" = "no"; then    if test "${valid_build_dir}" = "no"; then
558      AC_MSG_ERROR([Build directory inside load-path!  Aborting!])      AC_MSG_ERROR([Build directory inside load-path!  Aborting!])
559    else    else
560      AC_MSG_RESULT([yes])      AC_MSG_RESULT([yes])
561    fi    fi
562  ])  ])
563    
 # AC_LISPIFY_DIR  
 # First argument is a variable name where a lisp expression is to be  
 # substituted with AC_SUBST.  
 # Second argument is the original path in shell-quoted syntax, usually  
 # something like [["${whatever}"]].  
 # If the expression is not an absolute path, it is evaluated relative  
 # to the current file name.  
   
 AC_DEFUN(AC_LISPIFY_DIR,[  
 EMACS_LISP([$1],[[(prin1-to-string  
  (if (file-name-absolute-p path)  
    (expand-file-name (file-name-as-directory path))  
   (backquote (expand-file-name (, (file-name-as-directory path))  
      (file-name-directory load-file-name)))))]],,-no-site-file,path,[$2])  
  AC_SUBST([$1])]  
 )  
   
564  # AUCTEX_AUTO_DIR  # AUCTEX_AUTO_DIR
565  # ---------------  # ---------------
566  # Set the directory containing AUCTeX automatically generated global style  # Set the directory containing AUCTeX automatically generated global style
# Line 563  AC_DEFUN(AUCTEX_AUTO_DIR, Line 570  AC_DEFUN(AUCTEX_AUTO_DIR,
570   AC_ARG_WITH(auto-dir,   AC_ARG_WITH(auto-dir,
571               [  --with-auto-dir=DIR     directory containing AUCTeX automatically generated               [  --with-auto-dir=DIR     directory containing AUCTeX automatically generated
572                            global style hooks],                            global style hooks],
573               [autodir="${withval}"               [autodir="${withval}"],
574                autodir_expanded="${autodir}"               [autodir='${localstatedir}/auctex'])
575                AC_FULL_EXPAND(autodir_expanded)],   AC_MSG_RESULT([${autodir}])
              [autodir='${localstatedir}/auctex'  
               oldprefix="${prefix}" # save prefix  
               if test "${prefix}" = "NONE"  
                 then prefix="${ac_default_prefix}" # temporarily set it  
               fi  
               autodir_expanded="${autodir}"  
               AC_FULL_EXPAND(autodir_expanded)  
               prefix="${oldprefix}" # restore prefix])  
  AC_MSG_RESULT([${autodir}, expanded to ${autodir_expanded}])  
576   AC_SUBST(autodir)   AC_SUBST(autodir)
  AC_LISPIFY_DIR(lispautodir,[["${autodir_expanded}"]])  
577  ])  ])
578    
579    # AC_LISPIFY_DIR
580    # First argument is a variable name where a lisp expression is to be
581    # substituted with AC_SUBST and "lisp" prepended.
582    # lispdir is used for two purposes: any relative names are resolved
583    # relative to lispdir, and the lispification uses relative file names
584    # in relation to the second argument if the target dir is in the
585    # lispdir hierarchy.
586    # Second argument is a path to be resolved relatively to the filename
587    # in the third argument.
588    # If a third argument is given, it specifies a path specification
589    # to be expanded relative to the resulting directory.
590    AC_DEFUN(AC_LISPIFY_DIR,[
591     tmpdir="[$]{$1}"
592     AC_FULL_EXPAND(tmpdir)
593     explispdir="[$]{lispdir}"
594     AC_FULL_EXPAND(explispdir)
595     expstartup=$2
596     AC_FULL_EXPAND(expstartup)
597    EMACS_LISP([lisp$1],[[(progn (setq path (directory-file-name path))
598      (if (or target
599              (not (string= (car load-path) (directory-file-name (car load-path)))))
600        (setq path (file-name-as-directory path)))
601      (setq path (expand-file-name path lispdir))
602      (setq startupdir (file-name-directory (expand-file-name startup lispdir)))
603      (prin1-to-string
604        (if (or (string-match \"\\\\\`\\\\.\\\\.\"
605                  (setq relname (file-relative-name startupdir lispdir)))
606                (file-name-absolute-p relname)
607                (string-match \"\\\\\`\\\\.\\\\.\"
608                  (setq relname (file-relative-name path lispdir)))
609                (file-name-absolute-p relname))
610              (concat path target)
611            (cond (target
612                   \`(expand-file-name
613                       ,(file-relative-name (concat path target) startupdir)
614                       (file-name-directory load-file-name)))
615                  ((string= path startupdir)
616                     '(file-name-directory load-file-name))
617                  ((string= path (directory-file-name startupdir))
618                     '(directory-file-name (file-name-directory load-file-name)))
619                  (t
620                   \`(expand-file-name
621                       ,(file-relative-name path startupdir)
622                       (file-name-directory load-file-name)))))))]],
623           -no-site-file,[[path lispdir startup target]],
624      [["${tmpdir}" "${explispdir}" "${expstartup}" $3]])
625       AC_SUBST([lisp$1])
626       AC_SUBST([$1])])

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26