[mew-dist 26413] More hacks on configure

Shun-ichi TAHARA ( 田原 俊一 ) jado at example.com
2005年 6月 9日 (木) 12:56:32 JST


configure で、--with-elispdir と --with-etcdir を指定できるようにして
みました。

おまけとして、--with-elispdir や --with-etcdir が指定されておらず、か
つ、--datadir (XEmacs の場合は --libdir) が指定されていない場合は、
emacs がインストールされているところを自動的に検出します。

# Emacs 関係は --prefix を見ませんので、Emacs がパッケージで /usr 以下
# に入っている場合等でも、configure 一発で OK です。
_______________________________
田原 俊一   jado at example.com, shunichi_tahara at example.com
                                  http://flowernet.gr.jp/jado/
FingerPrint:  16 9E 70 3B 05 86 5D 08  B8 4C 47 3A E7 E9 8E D9
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
-------------- next part --------------
Index: Makefile.in
===================================================================
RCS file: /cvsmew/mew/Makefile.in,v
retrieving revision 1.5
diff -u -r1.5 Makefile.in
--- Makefile.in	17 Mar 2005 03:50:50 -0000	1.5
+++ Makefile.in	9 Jun 2005 03:52:49 -0000
@@ -20,6 +20,9 @@
 ##
 
 prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+datadir=@datadir@
 infodir=@infodir@
 
 ##
@@ -37,16 +40,18 @@
 ## A directory where mew*.el[c] will be installed.
 ##
 
-elispdir = $(prefix)/share/emacs/site-lisp/mew
-#elispdir  = $(prefix)/lib/$(EMACS)/site-lisp
+elispdir = @elispdir@
+#elispdir = $(prefix)/share/emacs/site-lisp/mew
+#elispdir  = $(prefix)/lib/xemacs/site-lisp
 #elispdir = $(prefix)/lib/emacs
 
 ##
 ## A directory where etc file will be installed.
 ##
 
-etcdir = $(prefix)/share/emacs/site-lisp/mew/etc
-#etcdir = $(prefix)/lib/$(EMACS)/etc/Mew
+etcdir = @etcdir@
+#etcdir = $(prefix)/share/emacs/site-lisp/mew/etc
+#etcdir = $(prefix)/lib/xemacs/etc/Mew
 
 ################################################################
 ##
Index: configure.in
===================================================================
RCS file: /cvsmew/mew/configure.in,v
retrieving revision 1.2
diff -u -r1.2 configure.in
--- configure.in	14 Mar 2005 06:31:42 -0000	1.2
+++ configure.in	9 Jun 2005 03:52:49 -0000
@@ -1,6 +1,139 @@
 AC_INIT(mew.el)
 AC_CONFIG_SUBDIRS(bin)
-AC_ARG_WITH(emacs, [  --with-emacs=EMACS],
-    [EMACS=$with_emacs],[EMACS=emacs])
+AC_ARG_WITH(emacs,
+    [  --with-emacs=EMACS      use EMACS],
+    EMACS="${withval}")
 AC_SUBST(EMACS)
+AC_ARG_WITH(elispdir,
+    [  --with-elispdir=DIR     where elisp files should go],
+    elispdir="${withval}")
+AC_SUBST(elispdir)
+AC_ARG_WITH(etcdir,
+    [  --with-etcdir=DIR       where etc files should go],
+    etcdir="${withval}")
+AC_SUBST(etcdir)
+
+if test -z "${EMACS}"; then
+    AC_PATH_PROGS(EMACS, emacs xemacs mule, emacs)
+fi
+if test ! -x "${EMACS}"; then
+    AC_MSG_ERROR([${EMACS} is not found.])
+fi
+chk_prefix=
+case "${EMACS}" in
+*xemacs*)
+    if test "${libdir}" = "\${exec_prefix}/lib" && \
+       test -z "${elispdir}" -o -z "${etcdir}"; then
+	chk_prefix=yes
+    fi
+    ;;
+*)
+    if test "${datadir}" = "\${prefix}/share" && \
+       test -z "${elispdir}" -o -z "${etcdir}"; then
+	chk_prefix=yes
+    fi
+    ;;
+esac
+if test "${chk_prefix}"; then
+    AC_MSG_CHECKING(for prefix of ${EMACS})
+    AC_CACHE_VAL(EMACS_cv_emacs_prefix,[
+	OUTPUT=./conftest-$$
+	echo ${EMACS}' -q -no-site-file -batch -eval '\''(write-region (princ (expand-file-name ".." invocation-directory)) nil "'${OUTPUT}'" nil 5)'\' >& AC_FD_CC 2>&1
+	eval ${EMACS}' -q -no-site-file -batch -eval '\''(write-region (princ (expand-file-name ".." invocation-directory)) nil "'${OUTPUT}'" nil 5)'\' >& AC_FD_CC 2>&1
+	retval="`cat ${OUTPUT}`"
+	rm -f ${OUTPUT}
+	EMACS_cv_emacs_prefix="${retval}"])
+    emacs_prefix=${EMACS_cv_emacs_prefix}
+    AC_MSG_RESULT(${emacs_prefix})
+fi
+
+if test "${chk_prefix}" -a -z "${elispdir}"; then
+    AC_MSG_CHECKING([where lisp files should go])
+    case "${EMACS}" in
+    *xemacs*)
+	if test -d "${emacs_prefix}/lib/xemacs/site-lisp"; then
+	    elispdir="${emacs_prefix}/lib/xemacs/site-lisp/mew"
+	fi
+	;;
+    *)
+	if test -d "${emacs_prefix}/share/emacs/site-lisp"; then
+	    elispdir="${emacs_prefix}/share/emacs/site-lisp/mew"
+	fi
+	;;
+    esac
+    if test "${elispdir}"; then
+	AC_MSG_RESULT(${elispdir})
+    else
+	AC_MSG_RESULT([none (fall back to the default value)])
+    fi
+fi
+if test -z "${elispdir}"; then
+    case "${EMACS}" in
+    *xemacs*)
+	elispdir="\${libdir}/xemacs/site-lisp/mew"
+	;;
+    *)
+	elispdir="\${datadir}/emacs/site-lisp/mew"
+	;;
+    esac
+fi
+
+if test "${chk_prefix}" -a -z "${etcdir}"; then
+    AC_MSG_CHECKING([where etc files should go])
+    case "${EMACS}" in
+    *xemacs*)
+	if test -d "${emacs_prefix}/lib/xemacs/etc"; then
+	    etcdir="${emacs_prefix}/lib/xemacs/etc/Mew"
+	fi
+	;;
+    *)
+	if test -d "${emacs_prefix}/share/emacs/site-lisp"; then
+	    etcdir="${emacs_prefix}/share/emacs/site-lisp/mew/etc"
+	fi
+	;;
+    esac
+    if test "${etcdir}"; then
+	AC_MSG_RESULT(${etcdir})
+    else
+	AC_MSG_RESULT([none (fall back to the default value)])
+    fi
+fi
+if test -z "${etcdir}"; then
+    case ${EMACS} in
+    *xemacs*)
+	etcdir="\${libdir}/xemacs/etc/Mew"
+	;;
+    *)
+	etcdir="\${datadir}/emacs/site-lisp/mew/etc"
+	;;
+    esac
+fi
+
 AC_OUTPUT(Makefile)
+
+echo_value () {
+    case "$1" in
+    *\$*)
+	eval "echo_value \"$1\""
+	;;
+    *)
+	echo "$1"
+	;;
+    esac
+}
+
+echo
+echo "***************************"
+echo " Mew configuration results"
+echo "***************************"
+echo
+echo -n "use emacs             : "; echo_value "${EMACS}"
+echo -n "elisp files should go : "; echo_value "${elispdir}"
+echo -n "etc files should go   : "; echo_value "${etcdir}"
+echo -n "exec files should go  : "; echo_value "${bindir}"
+echo -n "info files should go  : "; echo_value "${infodir}"
+echo -n "man files should go   : "; echo_value "${mandir}/man1"
+echo
+echo "Then type 'make', 'make info' and 'make install'."
+echo "For Japanese environment, also 'make jinfo' and 'make install-jinfo'."
+echo


Mew-dist メーリングリストの案内