path: root/src/cgi-bin/Makefile.am
diff options
authorSergey Poznyakoff <gray@gnu.org>2015-01-10 20:14:14 +0200
committerSergey Poznyakoff <gray@gnu.org>2015-01-10 20:14:14 +0200
commit1c22a86e073d57c4b35ac5b7ffea07aa541141c4 (patch)
treec90f3fc758b5dfc2f8e8fd64f2ef0a87343b3e50 /src/cgi-bin/Makefile.am
parent2b99881a880d101ae32a94b3d1e0a792224cb74c (diff)
Make it possible to use apache rewrite rules to create nice cgi urls
Example: configure with options: --without-script-suffix --without-script-dir, and add the following to the Apache virtual host configuration: RewriteEngine on RewriteRule ^/dict(.*) /cgi-bin/dict.cgi$1 [H=cgi-script] RewriteRule ^/nea(.*) /cgi-bin/nea.cgi$1 [H=cgi-script] RewriteRule ^/conj(.*) /cgi-bin/conj.cgi$1 [H=cgi-script] All cgi's will then be referred to directly, as in: http://ellinika/dict?lang=pl. * configure.ac (REAL_SCRIPT_SUFFIX): New subst var New options --with-script-suffix, --with-script-dir * src/cgi-bin/.gitignore: Remove cgi * src/cgi-bin/Makefile.am: Rename installed scm's in place * src/ellinika/cgi.scm4 (cgi-program-name): Suffix can be empty. * xml/lingua.conf.in: =SCRIPT_SUFFIX= always begins with dot
Diffstat (limited to 'src/cgi-bin/Makefile.am')
1 files changed, 16 insertions, 11 deletions
diff --git a/src/cgi-bin/Makefile.am b/src/cgi-bin/Makefile.am
index f085e57..aca9137 100644
--- a/src/cgi-bin/Makefile.am
+++ b/src/cgi-bin/Makefile.am
@@ -14,10 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-EXTRA_DIST=dict.scm4 nea.scm4 conj.scm4
-CLEANFILES=dict.m4 dict.scm nea.scm dict.cgi nea.cgi conj.cgi
+cgidir = @CGIDIR@
+CGI_SOURCES = dict.scm4 nea.scm4 conj.scm4
+cgi_SCRIPTS = $(CGI_SOURCES:.scm4=.scm)
+CLEANFILES = dict.m4 $(cgi_SCRIPTS)
dict.m4: Makefile
$(AM_V_GEN){ \
@@ -43,18 +44,22 @@ dict.m4: Makefile
echo ')dnl'; \
} > dict.m4
-SUFFIXES = .scm4 .scm .cgi
+SUFFIXES = .scm4 .scm
$(AM_V_GEN)m4 dict.m4 $< > $@
- $(AM_V_GEN)cp $< $@
dict.scm: dict.scm4 dict.m4
nea.scm: nea.scm4 dict.m4
conj.scm: conj.scm4 dict.m4
-dict.cgi: dict.scm
-nea.cgi: nea.scm
-conj.cgi: conj.scm
+ $(AM_V_GEN)if test @REAL_SCRIPT_SUFFIX@ != .scm; then\
+ here=`pwd`; \
+ cd $(DESTDIR)$(cgidir); \
+ for file in $(cgi_SCRIPTS); do\
+ mv $$file $${file%%.scm}@REAL_SCRIPT_SUFFIX@;\
+ done;\
+ cd $$here;\
+ fi

Return to:

Send suggestions and report system problems to the System administrator.