File: configure.ac

package info (click to toggle)
libinfinity 0.7.2-5
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 13,768 kB
  • sloc: ansic: 107,626; sh: 4,475; xml: 1,852; makefile: 1,278
file content (432 lines) | stat: -rw-r--r-- 12,047 bytes parent folder | download | duplicates (3)
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
m4_define([libinfinity_version], [0.7.2])
m4_define([libinfinity_api_version], [0.7])
m4_define([libinfinity_libtool_version], [0:0:0])

AC_PREREQ(2.60)
AC_INIT([libinfinity], [libinfinity_version], [armin@arbur.net])
AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 check-news foreign tar-pax subdir-objects])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES])
AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([libinfinity/common/inf-init.c])
AC_CONFIG_HEADER([config.h libinfinity/inf-config.h])

LIBINFINITY_VERSION=libinfinity_version
LIBINFINITY_API_VERSION=libinfinity_api_version
LIBINFINITY_LIBTOOL_VERSION=libinfinity_libtool_version
AC_SUBST(LIBINFINITY_VERSION)
AC_SUBST(LIBINFINITY_API_VERSION)
AC_SUBST(LIBINFINITY_LIBTOOL_VERSION)

AC_CANONICAL_HOST
AM_SILENT_RULES([yes])

# Remove -Wno-strict-prototypes for the feature tests
has_strict_prototypes=""
if (echo $CFLAGS | grep -- -Wstrict-prototype)
then
        has_strict_prototypes="true"
        old_CFLAGS=$CFLAGS
        CFLAGS="$CFLAGS -Wno-strict-prototypes"
fi

# Make GNU and POSIX extensions such as readdir_r, O_NOFOLLOW and
# fdopendir available
AC_USE_SYSTEM_EXTENSIONS

AC_LANG(C)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_AR
AC_PROG_LIBTOOL

# Seems to be required for building a binary from multiple source files
# automake complains without it in infinoted/.
AM_PROG_CC_C_O

###################################
# Gtk-Doc
###################################

AC_CONFIG_MACRO_DIR(m4)
GTK_DOC_CHECK(1.4)

###################################
# Platform checks
###################################

case "$host_os" in
*mingw*)
  platform='win32'
  ;;
*)
  platform='unix'
  ;;
esac

AM_CONDITIONAL([WIN32], test "$platform" = "win32")

# Check for MSG_NOSIGNAL
AC_MSG_CHECKING(for MSG_NOSIGNAL)
AC_TRY_COMPILE([#include <sys/socket.h>],
	       [ int f = MSG_NOSIGNAL; ],
	       [ AC_MSG_RESULT(yes)
	         AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,
			   [Define this symbol if you have MSG_NOSIGNAL]) ],
 	       [ AC_MSG_RESULT(no)]
)

# Check for SO_REUSEADDR
AC_MSG_CHECKING(for SO_REUSEADDR)
AC_TRY_COMPILE([#include <sys/socket.h>
                #include <stdio.h> ],
	       [ int f = SO_REUSEADDR; printf("%d\n", f); ],
	       [ AC_MSG_RESULT(yes)
	         AC_DEFINE(HAVE_SO_REUSEADDR, 1,
			   [Define this symbol if you have SO_REUSEADDR]) ],
	       [ AC_MSG_RESULT(no)]
)

# Check for dirent.d_type
AC_MSG_CHECKING(for d_type)
AC_TRY_COMPILE([#include <dirent.h>
                #include <stdio.h> ],
               [ struct dirent d; printf("%d\n", d.d_type); ],
               [ AC_MSG_RESULT(yes)
                 AC_DEFINE(HAVE_D_TYPE, 1,
                           [Define this symbol if your struct dirent has the 
                            d_type field])],
               [ AC_MSG_RESULT(no)]
)

# Check for O_NOFOLLOW
AC_MSG_CHECKING(for O_NOFOLLOW)
AC_TRY_COMPILE([#include <sys/types.h>
                #include <sys/stat.h>
                #include <fcntl.h> ],
               [ printf("%d\n", O_NOFOLLOW); ],
               [ AC_MSG_RESULT(yes)
                 AC_DEFINE(HAVE_O_NOFOLLOW, 1,
                           [Define this symbol if the O_NOFOLLOW flag is
                            supported on your system])],
               [ AC_MSG_RESULT(no)]
)

###################################
# Check for regular dependencies
###################################

infinity_libraries='glib-2.0 >= 2.38 gobject-2.0 >= 2.38 gmodule-2.0 >= 2.38 libxml-2.0 gnutls >= 2.12.0 libgsasl >= 0.2.21'

PKG_CHECK_MODULES([infinity], [$infinity_libraries])
PKG_CHECK_MODULES([inftext], [glib-2.0 >= 2.38 gobject-2.0 >= 2.38 libxml-2.0])

if test $platform = 'win32'; then
  infinity_LIBS="$infinity_LIBS -lws2_32 -ldnsapi"
else
  # Check whether we need libresolv for res_query()
  # Can't use AC_SEARCH_LIBS because res_query is a macro defined in
  # resolv.h
  AC_MSG_CHECKING(for res_query)
  AC_TRY_LINK(
    [
      #include <sys/types.h>
      #include <netinet/in.h>
      #include <arpa/nameser.h>
      #include <resolv.h>
    ],
    [res_query(NULL, 0, 0, NULL, 0);],
    [
      # res_init() available in libc
      AC_MSG_RESULT(yes)
    ],
    [
      LIBS="-lresolv"
      AC_TRY_LINK(
        [
          #include <sys/types.h>
          #include <netinet/in.h>
          #include <arpa/nameser.h>
          #include <resolv.h>
        ],
        [res_query(NULL, 0, 0, NULL, 0);],
        [
          AC_MSG_RESULT(in libresolv)
          LIBS=""
          infinity_LIBS="$infinity_LIBS -lresolv" # res_init available in libresolv
        ],
        [AC_MSG_ERROR(res_query not provided by either libc or libresolv)]
      )
    ]
  )
fi

###################################
# libinftextgtk optional package
###################################

AC_ARG_WITH([inftextgtk], AS_HELP_STRING([--with-inftextgtk],
            [Builds the libinftextgtk library [[default=auto]]]),
            [with_inftextgtk=$withval], [with_inftextgtk=auto])

gtk_requirement="gtk+-3.0 >= 3.10.0"
if test "x$with_inftextgtk" = "xauto"
then
  PKG_CHECK_MODULES([inftextgtk], [$gtk_requirement], [with_inftextgtk=yes], [with_inftextgtk=no])
elif test "x$with_inftextgtk" = "xyes"
then
  PKG_CHECK_MODULES([inftextgtk], [$gtk_requirement])
fi

if test "x$with_inftextgtk" = "xyes"
then
  AC_CHECK_LIB([m], [atan2], [inftextgtk_LIBS="$inftextgtk_LIBS -lm"], AC_MSG_ERROR(libm not found))
fi

AM_CONDITIONAL([WITH_INFTEXTGTK], test "x$with_inftextgtk" = "xyes")

AC_SUBST(gtk_requirement)

###############################
# libinfgtk optional package
###############################

AC_ARG_WITH([infgtk], AS_HELP_STRING([--with-infgtk],
            [Builds the libinfgtk library [[default=auto]]]),
            [with_infgtk=$withval], [with_infgtk=auto])

if test "x$with_infgtk" = "xauto"
then
  PKG_CHECK_MODULES([infgtk], [$gtk_requirement], [with_infgtk=yes], [with_infgtk=no])
elif test "x$with_infgtk" = "xyes"
then
  PKG_CHECK_MODULES([infgtk], [$gtk_requirement])
fi

AM_CONDITIONAL([WITH_INFGTK], test "x$with_infgtk" = "xyes")

###############################
# infinoted optional package
###############################

AC_ARG_WITH([infinoted], AS_HELP_STRING([--with-infinoted],
            [Build the infinote standalone server [[default=yes]]]),
            [with_infinoted=$withval], [with_infinoted=yes])

if test "x$with_infinoted" = "xyes"
then
  PKG_CHECK_MODULES([infinoted], [glib-2.0 >= 2.38 gobject-2.0 >= 2.38 gmodule-2.0 >= 2.38 gnutls >= 2.12.0])
fi

AM_CONDITIONAL([WITH_INFINOTED], test "x$with_infinoted" = "xyes")

####################
# Check for avahi
####################

AC_ARG_WITH([avahi], AS_HELP_STRING([--with-avahi],
            [Enables avahi support [[default=auto]]]),
            [use_avahi=$withval], [use_avahi=auto])

if test "x$use_avahi" = "xauto"
then
  PKG_CHECK_MODULES([avahi], [avahi-client], [use_avahi=yes], [use_avahi=no])
elif test "x$use_avahi" = "xyes"
then
  PKG_CHECK_MODULES([avahi], [avahi-client])
fi

if test "x$use_avahi" = "xyes"
then
  AC_DEFINE([LIBINFINITY_HAVE_AVAHI], 1, [Whether avahi support is enabled])
fi

AM_CONDITIONAL([LIBINFINITY_HAVE_AVAHI], test "x$use_avahi" = "xyes")

####################
# Check for gio
####################

AC_ARG_WITH([gio], AS_HELP_STRING([--with-gio],
            [Enables avahi support [[default=auto]]]),
            [use_gio=$withval], [use_gio=auto])

if test "x$use_gio" = "xauto"
then
  PKG_CHECK_MODULES([gio], [gio-2.0 >= 2.40], [use_gio=yes], [use_gio=no])
elif test "x$use_avahi" = "xyes"
then
  PKG_CHECK_MODULES([gio], [gio-2.0 >= 2.40])
fi

if test "x$use_gio" = "xyes"
then
  AC_DEFINE([LIBINFINITY_HAVE_GIO], 1, [Whether gio support is enabled])
fi

AM_CONDITIONAL([LIBINFINITY_HAVE_GIO], test "x$use_gio" = "xyes")

####################
# Check for libdaemon
####################

AC_ARG_WITH([libdaemon], AS_HELP_STRING([--with-libdaemon],
            [Enables daemonizing support in infinoted [[default=auto]]]),
            [use_libdaemon=$withval], [use_libdaemon=auto])

if test "x$use_libdaemon" = "xauto"
then
  PKG_CHECK_MODULES([libdaemon], [libdaemon], [use_libdaemon=yes], [use_libdaemon=no])
elif test "x$use_libdaemon" = "xyes"
then
  PKG_CHECK_MODULES([libdaemon], [libdaemon])
fi

if test "x$use_libdaemon" = "xyes"
then
  AC_DEFINE([LIBINFINITY_HAVE_LIBDAEMON], 1, [Whether libdaemon support is enabled])
fi

AM_CONDITIONAL([LIBINFINITY_HAVE_LIBDAEMON], test "x$use_libdaemon" = "xyes")

########################
# Check for libsystemd #
########################

AC_ARG_WITH([libsystemd], AS_HELP_STRING([--with-libsystemd],
	    [Enables sd_notify support in infinoted [[default=auto]]]),
	    [use_libsystemd=$withval], [use_libsystemd=auto])

if test "x$use_libsystemd" = "xauto"
then
  PKG_CHECK_MODULES([libsystemd], [libsystemd], [use_libsystemd=yes], [use_libsystemd=no])
elif test "x$use_libsystemd" = "xyes"
then
  PKG_CHECK_MODULES([libsystemd], [libsystemd])
fi

if test "x$use_libsystemd" = "xyes"
then
  AC_DEFINE([LIBINFINITY_HAVE_LIBSYSTEMD], 1, [Whether libsystemd support is enabled])
fi

AM_CONDITIONAL([LIBINFINITY_HAVE_LIBSYSTEMD], test "x$use_libsystemd" = "xyes")

#################
# Check for pam #
#################

AC_MSG_CHECKING(for pam)
AC_CHECK_LIB([ pam ],
             [ pam_start ],
             [ AC_MSG_RESULT(yes)
               AC_DEFINE(LIBINFINITY_HAVE_PAM, 1,
                         [Define this symbol if you have pam])
               use_pam=yes
               infinity_LIBS="$infinity_LIBS -lpam" ],
             [ AC_MSG_RESULT(no)
               use_pam=no ]
)

# Check for PAM_FAIL_DELAY
AC_MSG_CHECKING(for PAM_FAIL_DELAY)
AC_TRY_COMPILE([#include <security/pam_appl.h>
                #include <stdio.h> ],
               [ int f = PAM_FAIL_DELAY; printf("%d\n", f); ],
               [ AC_MSG_RESULT(yes)
                 AC_DEFINE(HAVE_PAM_FAIL_DELAY, 1,
                           [Define this symbol if your pam
                            has PAM_FAIL_DELAY])],
               [ AC_MSG_RESULT(no)]
)

############
# gettext
############

GETTEXT_PACKAGE="libinfinity-libinfinity_api_version"
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
                   [The domain name to use with gettext.])

ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
AM_GLIB_GNU_GETTEXT
AM_GLIB_DEFINE_LOCALEDIR(INF_LOCALEDIR)

###########
# GObject Introspection
###########

GOBJECT_INTROSPECTION_CHECK([1.0])

###########
# Output
###########

if test -n $has_strict_prototypes
then
        CFLAGS=$old_CFLAGS
fi

AC_CONFIG_FILES([
  Makefile
    libinfinity/Makefile
    libinftext/Makefile
    libinfgtk/Makefile
    libinftextgtk/Makefile

    infinoted/Makefile
      infinoted/plugins/Makefile

    pixmaps/Makefile
      pixmaps/16x16/Makefile
      pixmaps/22x22/Makefile
      pixmaps/scalable/Makefile

    test/Makefile
      test/util/Makefile
      test/session/Makefile
      test/cleanup/Makefile
      test/certs/Makefile

    docs/Makefile
      docs/reference/Makefile
      docs/reference/version.xml.in
      docs/reference/api_version.xml.in
        docs/reference/libinfinity/Makefile
        docs/reference/libinftext/Makefile
        docs/reference/libinfgtk/Makefile
        docs/reference/libinftextgtk/Makefile
        docs/reference/libinfinoted-plugin-manager/Makefile

    po/Makefile.in
])

# These are separate for the macros to be expanded
# (note no square brackets)
AC_CONFIG_FILES(
  libinfinity-libinfinity_api_version.pc:libinfinity.pc.in
  libinftext-libinfinity_api_version.pc:libinftext.pc.in
  libinfgtk-libinfinity_api_version.pc:libinfgtk.pc.in
  libinftextgtk-libinfinity_api_version.pc:libinftextgtk.pc.in
  libinfinoted-plugin-manager-libinfinity_api_version.pc:libinfinoted-plugin-manager.pc.in
)

AC_OUTPUT

echo "
Build optional packages:
  libinfgtk: $with_infgtk
  libinftextgtk: $with_inftextgtk
  infinoted: $with_infinoted

Enable support for:
  avahi: $use_avahi
  libdaemon: $use_libdaemon
  libsystemd: $use_libsystemd
  pam: $use_pam
"

# vim:set et: