Permalink
Browse files

Use autotools step 1

The old configure now is config.local and is executed at the
end of the configure process, after config.status.

The new configure.ac allows one to specify the place in which
libevent is installed, using --with-libevent=foo.

Add empty directory, m4, in which m4 files are saved.
  • Loading branch information...
bassosimone committed May 28, 2014
1 parent 45ab9df commit 8c04d84e2e0fec4db6e045ee27ace3f95ff4a8f2
Showing with 77 additions and 34 deletions.
  1. +0 −34 configure → config.local
  2. +77 −0 configure.ac
  3. 0 m4/.gitignore
View
@@ -36,37 +36,3 @@ if [ $(which swig 2> /dev/null) ]; then
else
echo "WARNING: libneubot_python: swig not available..."
fi
SYSTEM=$(uname)
if [ "$SYSTEM" = "Darwin" ]; then
CFLAGS="-I/opt/local/include"
LDFLAGS="-L/opt/local/lib"
LIBS="-levent"
SHARED_LIBRARY_EXT="dylib"
elif [ "$SYSTEM" = "OpenBSD" ]; then
CFLAGS="-I/usr/local/include"
LDFLAGS="-L/usr/local/lib"
LIBS="-levent_core -levent_extra"
SHARED_LIBRARY_EXT="so"
else
CFLAGS=""
LDFLAGS=""
LIBS="-levent"
SHARED_LIBRARY_EXT="so"
fi
for FILE in *.in; do
NEWFILE=$(echo $FILE|sed 's/\.in$//g')
echo "Generate: $NEWFILE"
cp -p $FILE $NEWFILE # Note: we preserve the perms
sed -e "s|@CFLAGS@|$CFLAGS|g" \
-e "s|@LDFLAGS@|$LDFLAGS|g" \
-e "s|@LIBS@|$LIBS|g" \
-e "s|@SHARED_LIBRARY_EXT@|$SHARED_LIBRARY_EXT|g" \
$FILE > $NEWFILE
done
echo "Configured for: $SYSTEM"
View
@@ -0,0 +1,77 @@
# configure.ac
#
# Copyright (c) 2014, Simone Basso, Arturo Filastò, Centro Nexa
# su Internet & Società, Politecnico di Torino (DAUIN).
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#
# Autoconf requirements
AC_INIT(libight, 4.0.0, bassosimone@gmail.com)
# information on the package
AC_CONFIG_SRCDIR([src/ight_wrappers.cpp])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
LT_INIT
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
# checks for programs
AC_PROG_INSTALL
AC_PROG_CXX([clang++ g++ c++])
# checks for libraries
AC_ARG_WITH([libevent],
[AS_HELP_STRING([--with-libevent],
[event I/O library @<:@default=check@:>@])
], [
#if ! test $withval/include/event2/event.h; then
# AC_MSG_ERROR([unable to find event2/event.h])
#fi
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
], [])
AC_CHECK_HEADERS(event2/event.h, [],
AC_MSG_ERROR([unable to find libevent headers]))
AC_CHECK_LIB(event, event_new, [],
AC_MSG_ERROR([unable to find libevent library]))
# checks for header files
# checks for types
# checks for structures
# checks for compiler characteristics
# checks for library functions
# checks for system services
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AC_CONFIG_COMMANDS_POST([./config.local])
View
No changes.

0 comments on commit 8c04d84

Please sign in to comment.