Use emacs based configuration.
authormorioka <morioka>
Fri, 16 Jan 1998 08:51:15 +0000 (08:51 +0000)
committermorioka <morioka>
Fri, 16 Jan 1998 08:51:15 +0000 (08:51 +0000)
CANNA-CFG [new file with mode: 0644]
CANNA-CONFIG [new file with mode: 0644]
CANNA-ELS [new file with mode: 0644]
CANNA-MK [new file with mode: 0644]
Makefile [deleted file]
Makefile.in [new file with mode: 0644]
configure [new file with mode: 0755]

diff --git a/CANNA-CFG b/CANNA-CFG
new file mode 100644 (file)
index 0000000..cc23631
--- /dev/null
+++ b/CANNA-CFG
@@ -0,0 +1,55 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: CANNA-CFG,v 1.1 1998-01-16 08:51:11 morioka Exp $
+;;;
+
+(defvar default-load-path load-path)
+
+;; (setq load-path (append
+;;                  (mapcar (function
+;;                           (lambda (path)
+;;                             (expand-file-name path (getenv "PWD"))
+;;                             ))
+;;                          '("." "../apel" "../emu" "../tl")
+;;                          )
+;;                  load-path))
+
+(add-to-list 'load-path
+            (expand-file-name "../../site-lisp/apel" data-directory))
+
+(if (boundp 'LISPDIR)
+    (progn
+      (add-to-list 'default-load-path LISPDIR)
+      (add-to-list 'load-path LISPDIR)
+      (add-to-list 'load-path (expand-file-name "apel" LISPDIR))
+      ))
+
+(require 'install)
+
+(add-path default-directory)
+
+
+;;; @ Please specify prefix of install directory.
+;;;
+
+;; Please specify install path prefix.
+;; If it is omitted, shared directory (maybe /usr/local is used).
+(defvar PREFIX install-prefix)
+;;(setq PREFIX "~/")
+
+;; Please specify prefix for ``CANNA'' [optional]
+(setq CANNA_PREFIX "")
+
+\f
+
+;;; @ optional settings
+;;;
+
+;; It is generated by automatically. Please set variable `PREFIX'.
+;; If you don't like default directory tree, please set it.
+(defvar LISPDIR (install-detect-elisp-directory PREFIX))
+;; (setq install-default-elisp-directory "~/lib/emacs/lisp")
+
+(setq CANNA_DIR (expand-file-name CANNA_PREFIX LISPDIR))
+
+;;; CANNA-CFG ends here
diff --git a/CANNA-CONFIG b/CANNA-CONFIG
new file mode 100644 (file)
index 0000000..003a880
--- /dev/null
@@ -0,0 +1,83 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: CANNA-CONFIG,v 1.1 1998-01-16 08:51:11 morioka Exp $
+;;;
+
+(defun config-canna ()
+  (let ((emacs (car command-line-args))
+       (srcdir (expand-file-name "src" source-directory))
+       prefix canna-includes canna-libraries arg)
+    (while (setq arg (car command-line-args-left))
+      (cond ((string-match "^--prefix=" arg)
+            (setq prefix (substring arg (match-end 0))))
+           ((string-match "^--with-canna-includes=" arg)
+            (setq canna-includes (substring arg (match-end 0))))
+           ((string-match "^--with-canna-libraries=" arg)
+            (setq canna-libraries (substring arg (match-end 0))))
+           )
+      (setq command-line-args-left (cdr command-line-args-left))
+      )
+    (or prefix
+       (progn
+         (require 'install)
+         (setq prefix install-prefix))
+       )
+    (or canna-includes
+       (setq canna-includes
+             (expand-file-name "include"
+                               (let ((default-load-path '("/usr/local")))
+                                 (require 'path-util)
+                                 (add-path prefix)
+                                 (get-latest-path "canna")
+                                 ))))
+    (or canna-libraries
+       (setq canna-libraries
+             (let ((default-load-path '("/usr/local/lib"))
+                   dir)
+               (require 'path-util)
+               (add-path (expand-file-name "lib" prefix))
+               (while (and (setq dir (car default-load-path))
+                           (not (file-exists-p
+                                 (expand-file-name "libcanna.a" dir)))
+                           )
+                 (setq default-load-path (cdr dir)))
+               dir)))
+    (princ (format "\
+emacs=%s
+srcdir=%s
+archlibdir=%s
+canna-includes=%s
+canna-libraries=%s
+" 
+                  emacs srcdir exec-directory
+                  canna-includes canna-libraries))
+    (make-canna-makefile emacs srcdir canna-includes canna-libraries)
+    ))
+
+(defun make-canna-makefile (emacs srcdir canna-includes canna-libraries)
+  (if (file-exists-p "Makefile")
+      (delete-file  "Makefile")
+    )
+  (let ((buf (let (vc-follow-symlinks)
+              (find-file "Makefile.in")
+              )))
+    (setq buffer-read-only nil)
+    (goto-char (point-min))
+    (and (re-search-forward "${emacs}")
+        (replace-match emacs))
+    (goto-char (point-min))
+    (and (re-search-forward "${srcdir}")
+        (replace-match srcdir))
+    (goto-char (point-min))
+    (and (re-search-forward "${archlibdir}")
+        (replace-match exec-directory))
+    (goto-char (point-min))
+    (and (re-search-forward "${canna_includes}")
+        (replace-match canna-includes))
+    (goto-char (point-min))
+    (and (re-search-forward "${canna_libraries}")
+        (replace-match canna-libraries))
+    (write-file "Makefile")
+    ))
+
+;;; CANNA-CONFIG ends here
diff --git a/CANNA-ELS b/CANNA-ELS
new file mode 100644 (file)
index 0000000..95544a3
--- /dev/null
+++ b/CANNA-ELS
@@ -0,0 +1,8 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: CANNA-ELS,v 1.1 1998-01-16 08:51:12 morioka Exp $
+;;;
+
+(setq canna-modules '(canna))
+
+;;; CANNA-ELS ends here
diff --git a/CANNA-MK b/CANNA-MK
new file mode 100644 (file)
index 0000000..addb161
--- /dev/null
+++ b/CANNA-MK
@@ -0,0 +1,34 @@
+;;; -*-Emacs-Lisp-*-
+;;;
+;;; $Id: CANNA-MK,v 1.1 1998-01-16 08:51:13 morioka Exp $
+;;;
+
+(defun config-canna ()
+  (let (prefix lisp-dir)
+    (and (setq prefix (car command-line-args-left))
+        (or (string-equal "NONE" prefix)
+            (defvar PREFIX prefix)
+            ))
+    (setq command-line-args-left (cdr command-line-args-left))
+    (and (setq lisp-dir (car command-line-args-left))
+        (or (string-equal "NONE" lisp-dir)
+            (defvar LISPDIR lisp-dir)
+            ))
+    (setq command-line-args-left (cdr command-line-args-left))
+    (load-file "CANNA-CFG")
+    (load-file "CANNA-ELS")
+    (princ (format "PREFIX=%s
+LISPDIR=%s\n" PREFIX LISPDIR))
+    ))
+
+(defun compile-canna ()
+  (config-canna)
+  (compile-elisp-modules canna-modules ".")
+  )
+
+(defun install-canna ()
+  (config-canna)
+  (install-elisp-modules canna-modules "./" CANNA_DIR)
+  )
+
+;;; CANNA-MK ends here
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index af57f97..0000000
--- a/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# $Id: Makefile,v 1.3 1997-09-24 08:43:45 morioka Exp $
-#
-
-EMACS_SRC_DIR  = /usr/src/emacs-20.2
-CC             = gcc
-CFLAGS         = -g -O2 -shared -nostdlib -fPIC -pipe -I$(EMACS_SRC_DIR)/src
-CANNA_LDFLAGS  = -lcanna -DCANNA_EMACS -DCANNA_EMACS_DL
-CANNA_CFLAGS   = -I/usr/local/canna/include
-
-VERSION        = 1.0
-
-canna.so:      canna.c
-       $(CC) $(CFLAGS) $(CANNA_CFLAGS) -o canna.so $(CANNA_LDFLAGS) \
-               canna.c
-
-tar:
-       -(cd /tmp ; mkdir dl-canna-$(VERSION))
-       cp README.?? Makefile *.c *.el ChangeLog /tmp/dl-canna-$(VERSION)
-       cd /tmp; tar cvzf dl-canna-$(VERSION).tar.gz dl-canna-$(VERSION)
-       rm -rf /tmp/dl-canna-$(VERSION)
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..c07bcb6
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# $Id: Makefile.in,v 1.1 1998-01-16 08:51:14 morioka Exp $
+#
+
+EMACS          = ${emacs}
+EMACS_FLAGS    = -batch -q -no-site-file -l CANNA-MK
+
+EMACS_SRC_DIR  = ${srcdir}
+CC             = gcc
+CANNA_DEFINES  = -DCANNA_EMACS -DCANNA_EMACS_DL
+CANNA_HEADERDIR = ${canna_includes}
+CANNA_CFLAGS   = $(CANNA_DEFINES) -I$(CANNA_HEADERDIR)
+CANNA_LDFLAGS  = -L${canna_libraries} -lcanna
+
+DL_INSTALLDIR  = ${archlibdir}
+
+CFLAGS         = -g -O2 -c -nostdlib -fPIC
+
+LINKER         = $(CC) -shared -o
+
+VERSION                = 1.1
+
+all:   canna.so canna.elc
+
+canna.elc:     canna.el
+       $(EMACS) $(EMACS_FLAGS) -f compile-canna $(PREFIX) $(LISPDIR)
+
+canna.o:       canna.c Makefile
+       $(CC) $(CFLAGS) -I$(EMACS_SRC_DIR) $(CANNA_CFLAGS) canna.c
+
+canna.so:      canna.o
+       $(LINKER) canna.so $(CANNA_LDFLAGS) canna.o
+
+
+install:       install.elc install.so
+
+install.elc:   canna.elc
+       $(EMACS) $(EMACS_FLAGS) -f install-canna $(PREFIX) $(LISPDIR)
+
+install.so:    canna.so
+       install -c canna.so $(DL_INSTALLDIR)
+       (cd $(DL_INSTALLDIR); ln -sf canna.so canna.so.$(VERSION))
+
+
+clean:
+       -rm -f canna.o canna.so canna.elc
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..959d192
--- /dev/null
+++ b/configure
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+EMACS=emacs
+
+eval $EMACS -batch -q -no-site-file -l CANNA-CONFIG -f config-canna