Permalink
Browse files

Fix: Finally fix the build system

Autoconf/make was clashing with the real libotr.so of the system so the
module object was renamed to "otr.so".

Also, this commit copies the libotr.m4 from the upstream version and add
it locally so it does not have to use the aclocal/ directory of the
system when bootstrapping.

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
  • Loading branch information...
dgoulet committed Nov 27, 2012
1 parent 570ac3e commit b06dba364ab2ac731b50af5f3f9db588a7e1fb7f
Showing with 147 additions and 13 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 README.md
  3. +1 −3 bootstrap
  4. +134 −0 config/libotr.m4
  5. +5 −4 configure.ac
  6. +5 −5 src/Makefile.am
@@ -27,3 +27,4 @@ libtool
tags
config/
!config/libotr.m4
@@ -44,7 +44,7 @@ Instructions
---------
To load the OTR module at startup, use the following and make sure
**libotr.so** is located in the **modules/** directory of the Irssi home
**otr.so** is located in the **modules/** directory of the Irssi home
(usually ~/.irssi).
`echo "load otr" >> ~/.irssi/startup`
@@ -1,10 +1,8 @@
#! /bin/sh
ACLOCAL_FLAGS="-I /usr/local/share/aclocal"
set -x
if [ ! -e config ]; then
mkdir config
fi
autoreconf -i -s $ACLOCAL_FLAGS
autoreconf -i -s
@@ -0,0 +1,134 @@
dnl
dnl Off-the-Record Messaging library
dnl Copyright (C) 2004-2007 Ian Goldberg, Chris Alexander, Nikita Borisov
dnl <otr@cypherpunks.ca>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of version 2.1 of the GNU Lesser General
dnl Public License as published by the Free Software Foundation.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
dnl
dnl AM_PATH_LIBOTR([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for libotr, and define LIBOTR_CFLAGS and LIBOTR_LIBS as appropriate.
dnl enables arguments --with-libotr-prefix=
dnl --with-libotr-inc-prefix=
dnl
dnl You must already have found libgcrypt with AM_PATH_LIBGCRYPT
dnl
dnl Adapted from alsa.m4, originally by
dnl Richard Boulton <richard-alsa@tartarus.org>
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
dnl Jaroslav Kysela <perex@suse.cz>
AC_DEFUN([AM_PATH_LIBOTR],
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
libotr_save_CFLAGS="$CFLAGS"
libotr_save_LDFLAGS="$LDFLAGS"
libotr_save_LIBS="$LIBS"
libotr_found=yes
dnl
dnl Get the cflags and libraries for libotr
dnl
AC_ARG_WITH(libotr-prefix,
[ --with-libotr-prefix=PFX Prefix where libotr is installed(optional)],
[libotr_prefix="$withval"], [libotr_prefix=""])
AC_ARG_WITH(libotr-inc-prefix,
[ --with-libotr-inc-prefix=PFX Prefix where libotr includes are (optional)],
[libotr_inc_prefix="$withval"], [libotr_inc_prefix=""])
dnl Add any special include directories
AC_MSG_CHECKING(for libotr CFLAGS)
if test "$libotr_inc_prefix" != "" ; then
LIBOTR_CFLAGS="$LIBOTR_CFLAGS -I$libotr_inc_prefix"
CFLAGS="$CFLAGS $LIBOTR_CFLAGS"
fi
AC_MSG_RESULT($LIBOTR_CFLAGS)
dnl add any special lib dirs
AC_MSG_CHECKING(for libotr LIBS)
if test "$libotr_prefix" != "" ; then
LIBOTR_LIBS="$LIBOTR_LIBS -L$libotr_prefix"
LDFLAGS="$LDFLAGS $LIBOTR_LIBS"
fi
dnl add the libotr library
LIBOTR_LIBS="$LIBOTR_LIBS -lotr"
LIBS="$LIBOTR_LIBS $LIBS"
AC_MSG_RESULT($LIBOTR_LIBS)
dnl Check for a working version of libotr that is of the right version.
min_libotr_version=ifelse([$1], ,3.0.0,$1)
no_libotr=""
libotr_min_major_version=`echo $min_libotr_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
libotr_min_minor_version=`echo $min_libotr_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
libotr_min_sub_version=`echo $min_libotr_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_MSG_CHECKING(for libotr headers version $libotr_min_major_version.x >= $min_libotr_version)
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE([
#include <stdlib.h>
#include <libotr/version.h>
], [
# if(OTRL_VERSION_MAJOR != $libotr_min_major_version)
# error not present
# else
# if(OTRL_VERSION_MINOR > $libotr_min_minor_version)
exit(0);
# else
# if(OTRL_VERSION_MINOR < $libotr_min_minor_version)
# error not present
# endif
# if(OTRL_VERSION_SUB < $libotr_min_sub_version)
# error not present
# endif
# endif
# endif
exit(0);
],
[AC_MSG_RESULT(found.)],
[AC_MSG_RESULT(not present.)
ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libotr not found.)])
libotr_found=no]
)
AC_LANG_RESTORE
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
AC_CHECK_LIB([otr], [otrl_message_receiving],,
[ifelse([$3], , [AC_MSG_ERROR(No linkable libotr was found.)])
libotr_found=no],
$LIBGCRYPT_LIBS
)
LDFLAGS="$libotr_save_LDFLAGS"
LIBS="$libotr_save_LIBS"
if test "x$libotr_found" = "xyes" ; then
ifelse([$2], , :, [$2])
else
LIBOTR_CFLAGS=""
LIBOTR_LIBS=""
ifelse([$3], , :, [$3])
fi
dnl That should be it. Now just export our symbols:
AC_SUBST(LIBOTR_CFLAGS)
AC_SUBST(LIBOTR_LIBS)
])
@@ -1,4 +1,4 @@
AC_INIT([irssi-otr],[1.0.0],[dgoulet@ev0ke.net],[],[Web])
AC_INIT([irssi-otr],[1.0.0-alpha1],[dgoulet@ev0ke.net],[],[https://github.com/dgoulet/irssi-otr])
AC_CONFIG_AUX_DIR([config])
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
@@ -9,6 +9,8 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_GREP
AC_PROG_CC
# We do not want to create a .a for the module, so disable by default.
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
# Check for pthread
@@ -33,7 +35,7 @@ AM_PATH_LIBOTR(4.0.0, [], [AC_MSG_ERROR([libotr 4.0.0 or newer is required.])])
pkg_modules="gmodule-2.0 >= 2.0.0"
PKG_CHECK_MODULES(GMODULE, [$pkg_modules])
AC_SUBST(PACKAGE_LIBS)
LIBS="$LIBS $GMODULE_LIBS"
PACKAGE_CFLAGS="$GMODULE_CFLAGS -Wall -Werror=format-security"
@@ -62,10 +64,9 @@ AC_CHECK_HEADERS([\
LT_INIT
CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing -fstack-protector-all -D_FORTIFY_SOURCE=2 -O1 -Wl,-z,relro,-z,now -fPIE -pie"
CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing -fstack-protector-all -D_FORTIFY_SOURCE=2 -O1 -Wl,-z,relro,-z,now -fPIE -pie $PACKAGE_CFLAGS"
DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/include"
AC_SUBST(DEFAULT_INCLUDES)
AC_CONFIG_FILES([
@@ -1,4 +1,4 @@
AM_CFLAGS = $(PACKAGE_CFLAGS)
AM_CFLAGS = $(LIBOTR_CFLAGS) $(LIBGCRYPT_CFLAGS) $(PACKAGE_FLAGS)
IRSSI_DIST=/usr/include/irssi
IRSSI_INCLUDE = -I$(IRSSI_DIST) \
@@ -13,10 +13,10 @@ IRSSI_INCLUDE = -I$(IRSSI_DIST) \
INCLUDES = -I$(top_srcdir)/src $(IRSSI_INCLUDE)
lib_LTLIBRARIES = libotr.la
lib_LTLIBRARIES = otr.la
libotr_la_SOURCES = key.c key.h cmd.c cmd.h otr.c otr-ops.c \
otr_la_SOURCES = key.c key.h cmd.c cmd.h otr.c otr-ops.c \
utils.h utils.c otr.h module.c irssi_otr.h \
otr-formats.c otr-formats.h
libotr_la_LDFLAGS = -module -avoid-version -shared
libotr_la_LIBADD = $(LIBOTR_LIBS) $(LIBGCRYPT_LIBS)
otr_la_LDFLAGS = -avoid-version -module
otr_la_LDFLAGS += $(LIBOTR_LIBS) $(LIBGCRYPT_LIBS)

0 comments on commit b06dba3

Please sign in to comment.