Skip to content

Commit

Permalink
Implemented autoconf.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Medaer (Escaux) committed Mar 1, 2017
1 parent fc981a8 commit 7e8133e
Show file tree
Hide file tree
Showing 11 changed files with 526 additions and 18 deletions.
Empty file added AUTHORS
Empty file.
14 changes: 14 additions & 0 deletions COPYING
@@ -0,0 +1,14 @@
Copyright 2017 Anthony Deroche <anthony@deroche.me>
2017 Raphael Medaer <raphael@medaer.me>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
File renamed without changes.
371 changes: 370 additions & 1 deletion INSTALL

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

27 changes: 27 additions & 0 deletions Makefile.am
@@ -0,0 +1,27 @@
ACLOCAL_AMFLAGS = -I acinclude.d

noinst_LTLIBRARIES = libmodauthnzjwt.la
noinst_DATA = mod_authnz_jwt.la

AM_CPPFLAGS = ${APACHE_CFLAGS} ${JWT_CFLAGS} ${JANSSON_CFLAGS} ${Z_CFLAGS}
AM_LDFLAGS = ${JWT_LIBS} ${JANSSON_LDFLAGS} ${Z_LIBS} ${APR_LDFLAGS}

libmodauthnzjwt_la_SOURCES = mod_authnz_jwt.c

AM_CXXFLAGS = -Wall

if NITPICK
AM_CXXFLAGS += -Wextra -Wundef -Wshadow -Wunsafe-loop-optimizations -Wconversion -Wmissing-format-attribute
AM_CXXFLAGS += -Wredundant-decls -ansi -Wmissing-noreturn
endif

if DEBUG
AM_CXXFLAGS += -DDEBUG
endif

install-exec-local:
${APXS} -i -a -n 'authnz_jwt' mod_authnz_jwt.la

mod_authnz_jwt.la: libmodauthnzjwt.la
${APXS} -c -o $@ $< ${APACHE_CFLAGS} ${JWT_CFLAGS} ${JWT_LIBS} \
${JANSSON_CFLAGS} ${JANSSON_LDFLAGS} ${Z_CFLAGS} ${Z_LIBS}
Empty file added NEWS
Empty file.
1 change: 1 addition & 0 deletions README
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -39,6 +39,8 @@ cd ..
sudo apt-get install apache2 apache2-dev
git clone https://github.com/AnthonyDeroche/mod_authnz_jwt
cd mod_authnz_jwt
autoreconf -ivf
./configure
make
sudo make install
~~~~
Expand Down
42 changes: 42 additions & 0 deletions acinclude.d/ax_with_apxs.m4
@@ -0,0 +1,42 @@
# some code taken from mod_python's (http://www.modpython.org/) configure.in

AC_DEFUN([AX_WITH_APXS],
[
# check for --with-apxs
AC_MSG_CHECKING(for --with-apxs)
AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=PATH], [Path to apxs]),
[
if test -x "$withval"
then
AC_MSG_RESULT([$withval executable, good])
APXS=$withval
else
echo
AC_MSG_ERROR([$withval not found or not executable])
fi
],
AC_MSG_RESULT(no))
# find apxs
if test -z "$APXS"; then
AC_PATH_PROGS([APXS],[apxs2 apxs],[false],[${PATH}:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin])
test "${APXS}" = "false" && AC_MSG_ERROR([failed to find apxs. Try using --with-apxs])
fi
# check Apache version
AC_MSG_CHECKING(Apache version)
HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`"
if test ! -x "$HTTPD"; then
AC_MSG_ERROR($APXS says that your apache binary lives at $HTTPD but that file isn't executable. Specify the correct apxs location with --with-apxs)
fi
ver=`$HTTPD -v | /usr/bin/awk '/version/ {print $3}' | /usr/bin/awk -F/ '{print $2}'`
AC_MSG_RESULT($ver)
# make sure version begins with 2
if test -z "`$HTTPD -v | egrep 'Server version: Apache/2'`"; then
AC_MSG_ERROR([mod_auth_openid only works with Apache 2. The one you have seems to be $ver.])
fi
AC_SUBST(APXS)
])
70 changes: 70 additions & 0 deletions configure.ac
@@ -0,0 +1,70 @@
AC_INIT([mod_authnz_jwt], [0.8], [anthony@deroche.me])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE()

AC_CONFIG_MACRO_DIR([acinclude.d])

AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG_CPLUSPLUS
AC_CANONICAL_HOST
AC_PROG_INSTALL
AM_PROG_LIBTOOL

AC_HEADER_STDC

# provide flag --enable-debug
AC_ARG_ENABLE([debug],
[ --enable-debug Enable debugging output to Apache error log],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])

# this will look for apxs command - put it in $APXS, fail on failure
AX_WITH_APXS()

# find apr-config binary
AC_ARG_WITH(apr_config, AC_HELP_STRING([[--with-apr-config=FILE]], [Path to apr-config program]),
[ apr_config="$withval" ],
[AC_PATH_PROGS(apr_config,
[apr-config apr-0-config apr-1-config],
[no],
[$PATH:/usr/sbin/:/usr/local/apache2/bin]
)]
)

if test "$apr_config" = "no"; then
AC_MSG_ERROR(Could not find the apr-config program. You can specify a location with the --with-apr-config=FILE option. It may be named apr-0-config or apr-1-config and can be found in your apache2 bin directory.)
fi

$apr_config --cppflags &> /dev/null
if test "$?" != "0"; then
AC_MSG_ERROR($apr_config is not a valid apr-config program)
fi

APR_LDFLAGS="`${apr_config} --link-ld --libs`"
AC_SUBST(APR_LDFLAGS)

APACHE_CFLAGS="-I`${APXS} -q INCLUDEDIR` -I`${apr_config} --includedir`"
AC_SUBST(APACHE_CFLAGS)

PKG_CHECK_MODULES([JWT], [libjwt >= 1.7])
PKG_CHECK_MODULES([JANSSON], [jansson >= 2.0])
PKG_CHECK_MODULES([Z], [zlib])

# Idea taken from libopekele
nitpick=false
AC_ARG_ENABLE([nitpicking],
AC_HELP_STRING([--enable-nitpicking],[make compiler warn about possible problems]),
[ test "$enableval" = "no" || nitpick=true ]
)
AM_CONDITIONAL(NITPICK, test x$nitpick = xtrue)

AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT

0 comments on commit 7e8133e

Please sign in to comment.