File: configure.ac

package info (click to toggle)
irssi-plugin-otr 1.0.2-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 268 kB
  • sloc: ansic: 2,180; makefile: 50; sh: 5
file content (116 lines) | stat: -rw-r--r-- 3,476 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
AC_INIT([irssi-otr],[1.0.2],[dgoulet@ev0ke.net],[],[https://github.com/cryptodotis/irssi-otr])
AC_CONFIG_AUX_DIR([config])
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([config])
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
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
AC_CHECK_LIB([pthread], [pthread_create], [],
	[AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
)

AC_ARG_WITH([irssi-headers],
	AS_HELP_STRING([--with-irssi-headers],
	[Directory containing the Irssi header files]),
	[IRSSI_HEADER_DIR="$withval"],
	[IRSSI_HEADER_DIR="\"\""])

# Check for Glib. It needs to be installed anyway or this macro will not be defined.
AM_PATH_GLIB_2_0([2.22.0], [],
			[AC_MSG_ERROR([Glib 2.22 is required in order to compile.
			Please install the Glib development files.])], [gmodule])

AM_PATH_LIBGCRYPT(1:1.2.0,,AC_MSG_ERROR(libgcrypt 1.2.0 or newer is required.))

AM_PATH_LIBOTR(4.1.0, [], [AC_MSG_ERROR([libotr 4.1.0 or newer is required.])])

pkg_modules="gmodule-2.0 >= 2.0.0"
PKG_CHECK_MODULES(GMODULE, [$pkg_modules])

LIBS="$LIBS"

PACKAGE_CFLAGS="$GMODULE_CFLAGS -Wall -Werror=format-security"
AC_SUBST(PACKAGE_CFLAGS)

# Checking only a few Irssi headers is enough to tell that everything is
# available. This is broken I know but tell that to the irssi guys to NOT use
# cluster fu*** of headers and local inclusion system wide...
CPPFLAGS="$CPPFLAGS $PACKAGE_CFLAGS -I$IRSSI_HEADER_DIR"
AC_CHECK_HEADERS([\
				irssi/src/common.h \
				irssi/src/core/commands.h \
				irssi/src/core/modules.h \
				irssi/src/core/servers.h \
				irssi/src/core/signals.h \
				irssi/src/core/levels.h \
				irssi/src/core/queries.h \
				irssi/src/core/settings.h \
				], [], [AC_MSG_ERROR([Irssi Header files are needed])],
[
#include <irssi/irssi-config.h>
#ifdef HAVE_IRSSI_SRC_COMMON_H
#include <irssi/src/common.h>
#endif
])

LT_INIT

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)

# Irssi searches for modules in $HOME/.irssi/modules and  $(libdir)/irssi/modules
# where the value of $(libdir) may depend on your distribution, architecture,
# and whether irssi was installed from package or from source.
# The hardcoded value should work for most systems but you need to override it for
# e.g. x86_64 Fedora.
AC_ARG_WITH([irssi-module-dir],
	AS_HELP_STRING([--with-irssi-module-dir=DIR], [Irssi module directory]),
	[IRSSI_MODULE_DIR="$withval"],
	[IRSSI_MODULE_DIR='${libdir}/irssi/modules'])

AC_SUBST(IRSSI_MODULE_DIR)

AC_CONFIG_FILES([
	Makefile
	help/Makefile
	src/Makefile
        irssi-otr.spec
])

AC_OUTPUT

#
# Mini-report on what will be built
#
AS_ECHO()

# Target architecture we're building for
target_arch=$host_cpu
[
for f in $CFLAGS; do
        if test $f = "-m32"; then
			target_arch="32-bit"
        elif test $f = "-m64"; then
			target_arch="64-bit"
        fi
done
]
AS_ECHO_N("Target architecture: ")
AS_ECHO($target_arch)

# Print the bindir and libdir this `make install' will install into.
AS_ECHO()
AS_ECHO_N("Module will be installed in: ")
AS_ECHO("`eval eval echo $IRSSI_MODULE_DIR`")
AS_ECHO()