Permalink
Browse files

use autoconf

  • Loading branch information...
1 parent 03fb93e commit a321c86cc7a43918318ee1a9138b3623bcf1cea6 @spiritloose committed Oct 9, 2009
Showing with 75 additions and 13 deletions.
  1. +5 −0 .gitignore
  2. +15 −9 Makefile → Makefile.in
  3. +9 −4 README
  4. +46 −0 configure.ac
View
5 .gitignore
@@ -5,3 +5,8 @@
*.o
*.slo
/t/test.conf
+/Makefile
+/autom4te*.cache
+/config.log
+/config.status
+/configure
View
24 Makefile → Makefile.in
@@ -3,13 +3,13 @@
## Autogenerated via ``apxs -n psgi -g''.
##
-PACKAGE_NAME=mod_psgi
-PACKAGE_VERSION=0.0.1
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
# the used tools
-APXS=apxs
-APACHECTL=apachectl
-PERL=perl
+APXS=@APXS@
+APACHECTL=@APACHECTL@
+PERL=@PERL@
builddir=.
top_srcdir=$(shell $(APXS) -q exp_datadir)
@@ -38,6 +38,12 @@ clean:
rm -f ppport.h
$(MAKE) -C t clean
+realclean: clean
+ rm -f Makefile
+
+configure: configure.ac
+ autoconf
+
mod_psgi.c: ppport.h
ppport.h:
@@ -64,13 +70,13 @@ stop:
DIST_DIR=$(PACKAGE_NAME)-$(PACKAGE_VERSION)
DIST_FILE=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar
-dist: ppport.h
+dist: ppport.h configure
rm -f $(DIST_FILE)
git archive --format=tar --prefix=$(DIST_DIR)/ HEAD > $(DIST_FILE)
mkdir $(DIST_DIR)
- cp ppport.h $(DIST_DIR)
- tar rf $(DIST_FILE) $(DIST_DIR)/ppport.h
+ cp ppport.h configure $(DIST_DIR)
+ tar rf $(DIST_FILE) $(DIST_DIR)/ppport.h $(DIST_DIR)/configure
rm -fr $(DIST_DIR)
gzip --best $(DIST_FILE)
-.PHONY: testconf
+.PHONY: testconf realclean
View
13 README
@@ -2,11 +2,16 @@ This is Apache2 module mod_psgi.
* Install
-Just type 'make' and 'make install'.
-You can specify apxs and perl as follows:
+ % ./configure
+ % make
+ % sudo make install
- % make APXS=/usr/local/apache2/bin/apxs PERL=/usr/local/bin/perl
- % sudo make APXS=/usr/local/apache2/bin/apxs PERL=/usr/local/bin/perl install
+You can specify apxs, apachectl and perl as follows:
+
+ % ./configure \
+ --with-apxs=/path/to/apxs \
+ --with-apctl=/path/to/apachectl \
+ --with-perl=/path/to/perl
Then activate it in Apache's httpd.conf file for instance
for the URL /psgi in as follows:
View
46 configure.ac
@@ -0,0 +1,46 @@
+AC_INIT(mod_psgi, 0.0.1, jiro@cpan.org)
+
+AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],
+ [name of the apxs executable [[apxs]]]),
+ [APXS="$with_apxs"])
+if test -z "${APXS}"; then
+ AC_PATH_PROGS(APXS, apxs2 apxs, no, [$PATH:/usr/sbin:/usr/local/apache2/bin])
+fi
+if test "$APXS" = no; then
+ AC_MSG_ERROR([apxs not found. set apxs with --with-apxs.])
+fi
+AC_SUBST(APXS)
+
+AC_ARG_WITH(apachectl, AC_HELP_STRING([--with-apctl=NAME],
+ [name of the apachectl executable [[apachectl]]]),
+ [APACHECTL="$with_apctl"])
+if test -z "${APACHECTL}"; then
+ AC_PATH_PROGS(APACHECTL, apache2ctl apachectl, no, [$PATH:/usr/sbin:/usr/local/apache2/bin])
+fi
+if test "$APACHECTL" = no; then
+ AC_MSG_ERROR([apachectl not found. set apachectl with --with-apctl.])
+fi
+AC_SUBST(APACHECTL)
+
+AC_ARG_WITH(perl, AC_HELP_STRING([--with-perl=NAME],
+ [name of the perl executable [[perl]]]),
+ [PERL="$with_perl"])
+if test -z "${PERL}"; then
+ AC_PATH_PROG(PERL, perl, no, [$PATH])
+fi
+if test "$PERL" = no; then
+ AC_MSG_ERROR([perl not found set perl with --with-perl.])
+fi
+AC_SUBST(PERL)
+
+AC_OUTPUT(Makefile)
+
+echo "
+$PACKAGE_NAME $PACKAGE_VERSION configuration:
+-----------------------
+ apxs: ${APXS}
+ apachectl: ${APACHECTL}
+ perl: ${PERL}
+
+Now type 'make' to build $PACKAGE_NAME $PACKAGE_VERSION!
+"

0 comments on commit a321c86

Please sign in to comment.