summaryrefslogtreecommitdiffabout
path: root/configure.ac
blob: cc85145d026f64ac065df78027fff9b7f7737370 (plain)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# This file is part of Wydawca -*- autoconf -*-
# Copyright (C) 2007-2020 Sergey Poznyakoff
#
# Wydawca is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Wydawca is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with wydawca.  If not, see <http://www.gnu.org/licenses/>.

AC_PREREQ(2.63)
AC_INIT([wydawca], 4.0.1, [bug-wydawca@gnu.org.ua], [wydawca],
        [http://www.gnu.org.ua/software/wydawca])
AC_CONFIG_SRCDIR([src/wydawca.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([1.15 gnits tar-ustar dist-bzip2 dist-xz std-options silent-rules subdir-objects])

# Enable silent rules by default:
AM_SILENT_RULES([yes])

# Checks for programs.
AC_PROG_CC
dnl AC_PROG_RANLIB
AC_USE_SYSTEM_EXTENSIONS

LT_PREREQ(2.2.5a)
LT_CONFIG_LTDL_DIR([libltdl])
LT_INIT([dlopen])
LTDL_INIT([recursive])
LT_WITH_LTDL
AC_CONFIG_FILES([libltdl/Makefile])
AC_SUBST(WYDAWCA_MODDIR,'$(libdir)/$(PACKAGE)') 

# Checks for libraries.
AC_CHECK_LIB(rt, clock_gettime)

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([stdlib.h string.h sys/file.h unistd.h sys/inotify.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIGNAL	
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_STDBOOL
AC_SYS_LARGEFILE

AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,
                 [#include <sys/types.h>
#include <time.h>
])

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([fchdir setegid setregid setresgid setresuid seteuid \
 setreuid vsyslog sysconf getdtablesize inotify_init])

# Check for POSIX threads support
AX_PTHREAD([],
 [AC_MSG_ERROR([POSIX threads support is required, but not available])])

AX_THREAD_NAMES

# **********************	
# Mailutils
# **********************	

AM_GNU_MAILUTILS(3.3, [mailer], [status_mailutils=yes], [status_mailutils=no])
AM_CONDITIONAL([COND_MAILUTILS],[test $status_mailutils = yes])
AC_SUBST(WY_MAILUTILS,[$status_mailutils])

# **********************	
# MySQL	
# **********************	

AC_SUBST(SQLLIB)		
AH_TEMPLATE(HAVE_MYSQL,[Define if you have libmysql])

WY_CHECK_LIB(mysqlclient, 
             mysql_real_connect, 
	     [-lm],
             [ AC_DEFINE(HAVE_MYSQL)
	       SQLLIB="$wd_cv_lib_mysqlclient" ],
	     [ AC_MSG_FAILURE([The required library libmysqlclient is not found or is unusable]) ],
             [/usr/lib/mysql /usr/local/lib/mysql])

# **********************	
# GPGME
# **********************	

AC_SUBST(GPGMELIB)
AH_TEMPLATE(HAVE_GPGME,[Define if you have gpgme])

AC_CHECK_HEADERS(gpgme.h)
WY_CHECK_LIB([gpgme],[main],[],
             [GPGMELIB="$wd_cv_lib_gpgme"
              AC_DEFINE(HAVE_GPGME) ],
	     [ AC_MSG_FAILURE([The requested library libgpgme is not found or is unusable])],
	     [/usr/pkg/lib /opt/lib /sw/lib])

saved_LDADD=$LDADD
LDADD="$LDADD $GPGMELIB"
AC_CHECK_FUNC(gpgme_set_offline)
AH_BOTTOM(
[#ifndef HAVE_GPGME_SET_OFFLINE
# define gpgme_set_offline(c,f)
#endif
])
LDADD=$saved_LDADD	     

# **********************	
# TCP wrappers
# **********************	
AC_ARG_WITH(tcp-wrappers,
	AC_HELP_STRING([--with-tcp-wrappers],
	               [compile with TCP wrappers support (default)]),
	[status_tcpwrap=${withval}],
	[status_tcpwrap=yes])

if test "$status_tcpwrap" = yes; then
  AC_CHECK_LIB(nsl, main)
  AC_CHECK_LIB(wrap, main,, [status_tcpwrap=no])
  if test "$status_tcpwrap" = yes; then
    AC_CHECK_HEADERS(tcpd.h,,[status_tcpwrap=no])
  fi
fi
if test "$status_tcpwrap" = yes; then
  AC_DEFINE_UNQUOTED([WITH_LIBWRAP],1,[Defined if compiling with libwrap])
fi  

# **********************	
# Inotify
# **********************	
AC_ARG_WITH(inotify,
	AC_HELP_STRING([--with-inotify],
	               [compile with inotify(7) support (Linux-specific)]),
	[status_inotify=${withval}],
	[status_inotify=probe])
if test $status_inotify != no; then
  if test "$ac_cv_header_sys_inotify_h" = yes &&
	     test "$ac_cv_func_inotify_init" = yes; then
    status_inotify=yes
  elif test $status_inotify = probe; then
    status_inotify=no
  else
    AC_MSG_FAILURE([Requested inotify(7) support is not available])
  fi
fi
if test $status_inotify = yes; then
  AC_DEFINE([WITH_INOTIFY],1,[Set to 1 if inotify(7) is to be used])
fi  
AM_CONDITIONAL([COND_INOTIFY],[test $status_inotify = yes])
AC_SUBST(WY_INOTIFY,[$status_inotify])
	
# Grecs subsystem

GRECS_SETUP([grecs],[tree-api git2chg getopt tests shared install-headers
                     std-pp-setup])
AC_CONFIG_LINKS(include/wydawca/wordsplit.h:grecs/wordsplit/wordsplit.h)

AH_BOTTOM([
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#  define __attribute__(x)
#endif

])
	
# Initialize the test suite.
AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile tests/atlocal tests/etc/Makefile])
AM_MISSING_PROG([AUTOM4TE], [autom4te])

# Initialize documentation helpers.
IMPRIMATUR_INIT(, [frenchspacing])

# *********************************************************************
# GPG v2 (for the testsuite)
# The testsuite needs to create GPG keys, which would be prohibitively
# slow without the %transient-key statement, which appeared in GPG 2.1
# *********************************************************************
AC_ARG_VAR([GPG],[Name of the gpg version 2 binary])
AC_MSG_CHECKING([for the GPG v2 binary])
uGPG=$GPG
unset GPG
gpgver() {
    GPG_VERSION_STRING=$($1 --version|head -n 1|sed -e 's/.* //')
    oIFS=$IFS
    IFS="."
    set -- $GPG_VERSION_STRING
    GPG_VERSION_MAJOR=$1
    GPG_VERSION_MINOR=$2
    IFS=$oIFS
}
for prog in $uGPG gpg2 gpg
do
   gpgver $prog
   if test -n "$GPG_VERSION_MAJOR" -a -n "$GPG_VERSION_MINOR"; then
       if test $GPG_VERSION_MAJOR -eq 2; then
           if test $GPG_VERSION_MINOR -ge 1; then
	       GPG=$prog
	       break
	   fi
       elif test $GPG_VERSION_MAJOR -gt 2; then
           GPG=$prog
           break
       fi
   fi
done
AC_MSG_RESULT([${GPG:-none}${GPG:+, $GPG_VERSION_STRING}])
AM_CONDITIONAL([COND_GPG2],[test -n "$GPG"])

AC_CONFIG_FILES([Makefile
                 doc/Makefile
		 include/Makefile
		 include/wydawca/Makefile
		 src/Makefile
		 modules/Makefile
		 modules/logstat/Makefile
		 modules/mailutils/Makefile
                 etc/Makefile])
		 
AC_OUTPUT

Return to:

Send suggestions and report system problems to the System administrator.