# Required initializer AC_INIT # Automake initialization AM_INIT_AUTOMAKE(mod_nss, 1.0) # Add a test for a compiler. AC_PROG_CC AM_PROG_LIBTOOL # Check for header files AC_HEADER_STDC AC_CHECK_HEADERS( \ unistd.h ) # Check for typedefs, structures, and compiler characteristics. AC_C_CONST # Find lex and yacc (or flex and bison) AC_PROG_YACC AC_PROG_LEX AC_DECL_YYTEXT AC_CHECKING(for apr-config) # check for --with-apr-config AC_MSG_CHECKING(for --with-apr-config) AC_ARG_WITH(apr-config, [--with-apr-config Use apr-config to determine the APR directory], [ AC_PATH_PROG(APR_CONFIG, apr-config) if test -n "$APR_CONFIG"; then apr_inc=`$APR_CONFIG --includes` else AC_MSG_ERROR([apr-config not found]) fi ], AC_MSG_RESULT(no)) AC_CHECKING(for apxs) # check for --with-apxs AC_MSG_CHECKING(for --with-apxs) AC_ARG_WITH(apxs, [--with-apxs=PATH Path to apxs], [ if test -x "$withval" then AC_MSG_RESULT([using $withval]) APXS=$withval else echo AC_MSG_ERROR([$withval not found or not executable]) fi ], AC_MSG_RESULT(no)) # if no apxs found yet, check /usr/local/apache/sbin # since it's the default Apache location if test -z "$APXS"; then AC_MSG_CHECKING(for apxs in /usr/local/apache/sbin) if test -x /usr/local/apache/sbin/apxs; then APXS=/usr/local/apache/sbin/apxs AC_MSG_RESULT([found $APXS. Use --with-apxs to specify another.]) else AC_MSG_RESULT(no) fi fi # last resort if test -z "$APXS"; then AC_MSG_CHECKING(for apxs in your PATH) AC_PATH_PROG(APXS, apxs) if test -n "$APXS"; then AC_MSG_RESULT([found $APXS. Use --with-apxs to specify another.]) fi fi # and finally if test -z "$APXS"; then AC_MSG_ERROR([apxs was not found. use --with-apxs to specifiy it.]) fi # Get some variables we need for Makefile.in apache_inc=`$APXS -q INCLUDEDIR` apache_conf=`$APXS -q SYSCONFDIR` apache_prefix=`$APXS -q PREFIX` apache_bin=`$APXS -q SBINDIR` if ! test -f "$apache_inc/apr.h"; then if test -z "$apr_inc"; then AC_MSG_ERROR([apr.h is not in your Apache include dir as reported by apxs. Use --with-apr-config to have apr-config tell us where to find it.]) fi fi AC_CHECKING(for NSPR) # check for --with-nspr AC_MSG_CHECKING(for --with-nspr) AC_ARG_WITH(nspr, [--with-nspr=PATH Netscape Portable Runtime (NSPR) directory], [ if test -e "$withval"/include/nspr.h then AC_MSG_RESULT([using $withval]) NSPRDIR=$withval nspr_inc="-I$NSPRDIR/include" nspr_lib="-L$NSPRDIR/lib" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # if NSPR is not found yet, try pkg-config # last resort if test -z "$NSPRDIR"; then AC_MSG_CHECKING(for nspr with pkg-config) AC_PATH_PROG(PKG_CONFIG, pkg-config) if test -n "$PKG_CONFIG"; then if $PKG_CONFIG --exists mozilla-nspr; then nspr_inc=`$PKG_CONFIG --cflags-only-I mozilla-nspr` nspr_lib=`$PKG_CONFIG --libs-only-L mozilla-nspr` else AC_MSG_ERROR([NSPR not found, specify with --with-nspr.]) fi fi fi AC_CHECKING(for NSS) # check for --with-nss AC_MSG_CHECKING(for --with-nss) AC_ARG_WITH(nss, [--with-nss=PATH Network Security Services (NSS) directory], [ if test -e "$withval"/include/nss.h then AC_MSG_RESULT([using $withval]) NSSDIR=$withval nss_inc="-I$NSSDIR/include" nss_lib="-L$NSSDIR/lib" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # if NSS is not found yet, try pkg-config # last resort if test -z "$NSSDIR"; then AC_MSG_CHECKING(for nss with pkg-config) AC_PATH_PROG(PKG_CONFIG, pkg-config) if test -n "$PKG_CONFIG"; then if $PKG_CONFIG --exists mozilla-nss; then nss_inc=`$PKG_CONFIG --cflags-only-I mozilla-nss` nss_lib=`$PKG_CONFIG --libs-only-L mozilla-nss` else AC_MSG_ERROR([NSS not found, specify with --with-nss.]) fi fi fi nspr_dir=`echo "$nspr_lib" | sed 's/\/lib[[/]]*$//' | sed 's/-L//'` nss_dir=`echo "$nss_lib" | sed 's/\/lib[[/]]*$//' | sed 's/-L//'` # Substitute values AC_SUBST(APXS) AC_SUBST(apr_inc) AC_SUBST(apache_inc) AC_SUBST(apache_conf) AC_SUBST(apache_prefix) AC_SUBST(apache_bin) AC_SUBST(nspr_inc) AC_SUBST(nspr_lib) AC_SUBST(nss_inc) AC_SUBST(nss_lib) AC_SUBST(nspr_dir) AC_SUBST(nss_dir) # Write config.status and the Makefile AC_OUTPUT(Makefile nss.conf gencert) chmod +x gencert