summaryrefslogtreecommitdiff
path: root/configure.in
blob: 293205266d4035cdc93bfed3b9953dbe6422dc13 (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
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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
AC_INIT(library/gnome-keyring.h)

AM_INIT_AUTOMAKE(gnome-keyring, 2.25.92)
AM_CONFIG_HEADER(config.h)
	
dnl ****************************************************************************
dnl Library libtool versioning

GP11_MAJOR=0		# Increment for major version number, breaks old apps.
GP11_REVISION=0		# Increment for internal changes, nothing affected.
GP11_AGE=0		# Increment for interface that doesn't break anything

GCR_MAJOR=0		# Increment for major version number, breaks old apps.
GCR_REVISION=0		# Increment for internal changes, nothing affected.
GCR_AGE=0		# Increment for interface that doesn't break anything

dnl ****************************************************************************

AM_SANITY_CHECK
AM_MAINTAINER_MODE

AC_GNU_SOURCE
AC_C_CONST
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
IT_PROG_INTLTOOL([0.35.0])
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

LIB_GNOME_KEYRING_LT_VERSION=1:1:1
AC_SUBST(LIB_GNOME_KEYRING_LT_VERSION)

AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T

GTK_DOC_CHECK
DISTCHECK_CONFIGURE_FLAGS="--enable-gtk-doc"
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)

PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.8.0)
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)

PKG_CHECK_MODULES(GOBJECT, glib-2.0 >= 2.8.0 gobject-2.0 >= 2.8.0)
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)

PKG_CHECK_MODULES(GIO, glib-2.0 >= 2.8.0 gio-2.0)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)

PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

AM_GCONF_SOURCE_2
PKG_CHECK_MODULES(GCONF, gconf-2.0)
DAEMON_CFLAGS="$DAEMON_CFLAGS $GCONF_CFLAGS"
DAEMON_LIBS="$DAEMON_LIBS $GCONF_LIBS"

GETTEXT_PACKAGE=gnome-keyring
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The gettext domain name])
AC_SUBST(GETTEXT_PACKAGE)

AM_GLIB_GNU_GETTEXT

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)

# --------------------------------------------------------------------
# Debug mode

AC_ARG_ENABLE(debug, 
	    AC_HELP_STRING([--enable-debug],
	    [Compile binaries in debug mode]))

if test "$enable_debug" = "yes"; then
  CFLAGS="$CFLAGS -g -O0 -Wall"
  CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED"
  CFLAGS="$CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
  AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
  echo "enabling debug compile mode"
  debug_status="yes"
else 
  dnl AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
  echo "disabling debug compile mode"
  debug_status="no"
fi

# --------------------------------------------------------------------
# Check for socklen_t
# 

AC_MSG_CHECKING(whether socklen_t is defined)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],[
socklen_t foo;
foo = 1;
],have_socklen_t=yes,have_socklen_t=no)
AC_MSG_RESULT($have_socklen_t)

if test "x$have_socklen_t" = "xyes"; then
    AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
fi

# --------------------------------------------------------------------
# Check for various credentials.
# 

AC_MSG_CHECKING(for struct cmsgcred)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
],[
struct cmsgcred cred;

cred.cmcred_pid = 0;
],have_struct_cmsgcred=yes,have_struct_cmsgcred=no)
AC_MSG_RESULT($have_struct_cmsgcred)

if test x$have_struct_cmsgcred = xyes; then
    AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
fi

# --------------------------------------------------------------------
# Check for getpeerucred
#

AC_CHECK_FUNCS(getpeerucred, AC_DEFINE(HAVE_GETPEERUCRED,1,[Have getpeerucred]))

# --------------------------------------------------------------------
# Check for getpeereid
# 

AC_CHECK_FUNCS(getpeereid, AC_DEFINE(HAVE_GETPEEREID, 1, [Have getpeereid function]))

# --------------------------------------------------------------------
# Check for flock
#

AC_CHECK_FUNCS(flock, AC_DEFINE(HAVE_FLOCK,1,[Have flock]))

# --------------------------------------------------------------------
# Check for timegm 
#

AC_CHECK_FUNCS(timegm, AC_DEFINE(HAVE_TIMEGM,1,[Have timegm]))

dnl mkdtemp replacement from gettext
AC_REPLACE_FUNCS(mkdtemp)
AC_STAT_MACROS_BROKEN
  AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
  [AC_TRY_COMPILE(
    [#include <sys/types.h>
#include <inttypes.h>],
    [uintmax_t i = (uintmax_t) -1;],
    jm_ac_cv_header_inttypes_h=yes,
    jm_ac_cv_header_inttypes_h=no)])
  if test $jm_ac_cv_header_inttypes_h = yes; then
    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
   and declares uintmax_t. ])
  fi
  AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
  [AC_TRY_COMPILE(
    [#include <sys/types.h>
#include <stdint.h>],
    [uintmax_t i = (uintmax_t) -1;],
    jm_ac_cv_header_stdint_h=yes,
    jm_ac_cv_header_stdint_h=no)])
  if test $jm_ac_cv_header_stdint_h = yes; then
    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
   and declares uintmax_t. ])
  fi
AC_CHECK_HEADERS(fcntl.h sys/time.h time.h unistd.h)
AC_CHECK_FUNCS(gettimeofday fsync)

# --------------------------------------------------------------------
# Memory locking
#

AC_CHECK_FUNCS(mlock)

# --------------------------------------------------------------------
# socket()
#	

AC_CHECK_LIB(socket, socket)

have_socket=no
AC_CHECK_FUNCS(socket, have_socket=yes)
if test $have_socket = no; then
  # socket is not in the default libraries.  See if it's in some other.
  for lib in bsd socket inet; do
    AC_CHECK_LIB($lib, socket, [
	  DAEMON_LIBS="$DAEMON_LIBS -l$lib"
	  have_socket=yes
	  AC_DEFINE(HAVE_SOCKET)
	  break])
  done
fi

# --------------------------------------------------------------------
# DBus Checks
# 

DBUS_REQUIRED=1.0
PKG_CHECK_MODULES([DBUS], dbus-1 >= 1.0)

DBUS_VERSION=`$PKG_CONFIG --modversion dbus-1`
DBUS_MAJOR_VERSION=`echo $DBUS_VERSION | cut -d. -f1`
DBUS_MINOR_VERSION=`echo $DBUS_VERSION | cut -d. -f2`
DBUS_MICRO_VERSION=`echo $DBUS_VERSION | cut -d. -f3`
DBUS_CFLAGS="$DBUS_CFLAGS -DGKR_DBUS_MAJOR_VERSION=$DBUS_MAJOR_VERSION"
DBUS_CFLAGS="$DBUS_CFLAGS -DGKR_DBUS_MINOR_VERSION=$DBUS_MINOR_VERSION"
DBUS_CFLAGS="$DBUS_CFLAGS -DGKR_DBUS_MICRO_VERSION=$DBUS_MICRO_VERSION"

DAEMON_CFLAGS="$DAEMON_CFLAGS $DBUS_CFLAGS"
DAEMON_LIBS="$DAEMON_LIBS $DBUS_LIBS"

LIBRARY_CFLAGS="$LIBRARY_CFLAGS $DBUS_CFLAGS"
LIBRARY_LIBS="$LIBRARY_LIBS $DBUS_LIBS"

AC_ARG_WITH(dbus-services,
		  [AC_HELP_STRING([--with-dbus-services=<dir>],
		  [where D-BUS session services directory is])])
if ! test -z "$with_dbus_services" ; then
	DBUS_SERVICES_DIR="$with_dbus_services"
else
	DBUS_SERVICES_DIR="$datadir/dbus-1/services"
fi

AC_SUBST(DBUS_SERVICES_DIR)

# --------------------------------------------------------------------
# HAL Checks

HAL_REQUIRED=0.5.7

AC_ARG_ENABLE(hal, 
	AC_HELP_STRING([--disable-hal], 
	[Use HAL for keys on removable drives]))

hal_status=no
if test "$enable_hal" != "no"; then

	PKG_CHECK_MODULES(HAL, [hal >= $HAL_REQUIRED hal-storage >= $HAL_REQUIRED], 
	                  [have_hal=yes], [have_hal=no])
	if test "$enable_hal" = "yes" -a "$have_hal" = "no"; then
		AC_MSG_ERROR([could not find hal and hal-storage version >= $HAL_REQUIRED])
	fi

	if test "$have_hal" = "yes"; then
		DAEMON_CFLAGS="$DAEMON_CFLAGS $HAL_CFLAGS"
		DAEMON_LIBS="$DAEMON_LIBS $HAL_LIBS"
		AC_DEFINE_UNQUOTED(WITH_HAL, 1, [Include HAL dependent code])
		hal_status=yes
	fi
fi

AM_CONDITIONAL(WITH_HAL, test "$have_hal" = "yes")

# --------------------------------------------------------------------
# PAM Checks

AC_ARG_ENABLE(pam, 
	    AC_HELP_STRING([--disable-pam],
	    [Build GNOME keyring PAM helper]))

pam_status="no"
if test "$enable_pam" != "no"; then
	AC_CHECK_HEADER(security/pam_modules.h, have_pam=yes, have_pam=no)
	if test "$enable_pam" = "yes" -a "$have_pam" = "no"; then
		AC_MSG_ERROR(The PAM headers are missing)
	elif test "$have_pam" = "yes"; then
		old_LIBS=$LIBS
		AC_CHECK_LIB(pam, pam_start, have_pam=yes, have_pam=no)
		if test "$enable_pam" = "yes" -a "$have_pam" = "no"; then
			AC_MSG_ERROR(The PAM library is missing)
		fi
		LIBS=$old_LIBS
	fi
fi

# --------------------------------------------------------------------
# Disable ACL Prompts

AC_ARG_ENABLE(acl-prompts, 
	    AC_HELP_STRING([--disable-acl-prompts],
	    [Disable prompted for user to give access to passwords]))

if test "$enable_acl_prompts" != "no"; then
	AC_DEFINE(ENABLE_ACL_PROMPTS, 1, [Whether to prompt before giving access to passwords])
fi

# --------------------------------------------------------------------
# PAM Module Directory

AC_ARG_WITH([pam-dir],
            [AC_HELP_STRING([--with-pam-dir=DIR],
                             [directory to install pam modules in])],
             [], [with_pam_dir="${prefix}/lib/security"])
PAM_DEST_DIR="$with_pam_dir"
AC_SUBST(PAM_DEST_DIR)

AM_CONDITIONAL(WITH_PAM, test "$have_pam" = "yes")

if test "$have_pam" = "yes"; then
	pam_status="yes ($with_pam_dir)"
fi

# --------------------------------------------------------------------
# SSH Agent support
#

AC_ARG_ENABLE([ssh-agent], 
		AC_HELP_STRING([--disable-ssh-agent],
		[Don't include SSH agent in gnome-keyring]))

if test "$enable_ssh_agent" != "no"; then
	AC_DEFINE(WITH_SSH, 1, [Whether to build SSH agent or not])
	ssh_status="yes"
else
	ssh_status="no"
fi

AM_CONDITIONAL(WITH_SSH, test "$enable_ssh_agent" != "no")

# --------------------------------------------------------------------
# Trusted Root Certificates Directory
#

AC_ARG_WITH([root-certs],
            [AC_HELP_STRING([--with-root-certs=DIR],
                            [directory with trusted root certificates])])

root_status="none"
if test -n "$with_root_certs"; then
	AC_DEFINE_UNQUOTED(ROOT_CERTIFICATES, "$with_root_certs", [Directory for trusted root certificates])
	root_status="$with_root_certs"
fi

AM_CONDITIONAL(WITH_ROOT_CERTS, test -n "$with_root_certs")


# --------------------------------------------------------------------
# Check for /dev/random
#

AC_CHECK_FILE(/dev/random, AC_DEFINE(HAVE_DEVRANDOM,1,[Have /dev/random]))


# --------------------------------------------------------------------
# libgcrypt
# 

GCRYPT_VERSION=1.2.2
GCRYPT_LIBVER=1

AM_PATH_LIBGCRYPT($GCRYPT_LIBVER:$GCRYPT_VERSION,,
 	AC_MSG_ERROR([[
***  
*** libgcrypt was not found. You may want to get it from
*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
***
]]))
libgcrypt=yes
AC_DEFINE_UNQUOTED(LIBGCRYPT_VERSION, "$GCRYPT_VERSION", [Version of GCRYPT we expect])

DAEMON_CFLAGS="$DAEMON_CFLAGS $LIBGCRYPT_CFLAGS"
DAEMON_LIBS="$DAEMON_LIBS $LIBGCRYPT_LIBS"

AC_SUBST([LIBGCRYPT_CFLAGS])
AC_SUBST([LIBGCRYPT_LIBS])

# -------------------------------------------------------------------
# libtasn1
# 

GKR_LIBTASN1_VERSION=0.3.4

PKG_CHECK_MODULES(LIBTASN1,libtasn1 >= 1.0)
AC_SUBST([LIBTASN1_LIBS])
AC_SUBST([LIBTASN1_CFLAGS])

DAEMON_CFLAGS="$DAEMON_CFLAGS $LIBTASN1_CFLAGS"
DAEMON_LIBS="$DAEMON_LIBS $LIBTASN1_LIBS"

dnl ==========================================================================

dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.

AC_MSG_CHECKING(for more warnings)
if test "$GCC" = "yes"; then
	AC_MSG_RESULT(yes)
	CFLAGS="\
	-Wall \
	-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith \
	-Wcast-align -Wsign-compare \
	$CFLAGS"

	# Disable -Werror for now, because of issues with
	# strange gtk-doc programs not building cleanly.  
	# -Werror \ 

	for option in -Wno-strict-aliasing -Wno-sign-compare; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		if test $has_option = no; then
			CFLAGS="$SAVE_CFLAGS"
		fi
		AC_MSG_RESULT($has_option)
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
else
	AC_MSG_RESULT(no)
fi

# --------------------------------------------------------------------
# Tests and Unit Tests

AC_ARG_ENABLE(tests, 
	    AC_HELP_STRING([--enable-tests],
	    [Build test tools, unit tests, and -Werror]))

AC_MSG_CHECKING([build test tools, unit tests, and -Werror])
if test "$enable_tests" == "yes"; then
	AC_DEFINE_UNQUOTED(WITH_TESTS, 1, [Build with unit test support])
	AC_MSG_RESULT(yes)
	CFLAGS="$CFLAGS -Werror"
	tests_status="yes"
else
	AC_MSG_RESULT(no)
  	tests_status="no"
fi

AM_CONDITIONAL(WITH_TESTS, test "$enable_tests" == "yes")

AC_ARG_ENABLE(coverage,
		AC_HELP_STRING([--enable-coverage],
			[Build coverage testing into gnome-keyring]))
			
if test "$enable_coverage" == "yes"; then
	CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
	LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
fi

# ----------------------------------------------------------------------

GP11_LT_RELEASE=$GP11_MAJOR:$GP11_REVISION:$GP11_AGE
AC_SUBST(GP11_LT_RELEASE)
AC_SUBST(GP11_MAJOR)

GCR_LT_RELEASE=$GCR_MAJOR:$GCR_REVISION:$GCR_AGE
AC_SUBST(GCR_LT_RELEASE)
AC_SUBST(GCR_MAJOR)

AC_SUBST(DAEMON_CFLAGS)
AC_SUBST(DAEMON_LIBS)

AC_SUBST(LIBRARY_CFLAGS)
AC_SUBST(LIBRARY_LIBS)

BINDIR="$bindir"
AC_SUBST(BINDIR)

AC_OUTPUT([
Makefile
common/Makefile
common/tests/Makefile
daemon/Makefile
daemon/gnome-keyring-daemon.desktop.in
daemon/data/Makefile
daemon/keyrings/Makefile
daemon/keyrings/tests/Makefile
daemon/pkcs11/Makefile
daemon/ui/Makefile
egg/Makefile
egg/tests/Makefile
gcr/gcr.pc
gcr/Makefile
gcr/tests/Makefile
gp11/gp11.pc
gp11/Makefile
gp11/reference/Makefile
gp11/tests/Makefile
library/Makefile
library/reference/Makefile
library/tests/Makefile
pam/Makefile
pam/tests/Makefile
pkcs11/Makefile
pkcs11/gck/Makefile
pkcs11/gck/tests/Makefile
pkcs11/plex-layer/Makefile
pkcs11/roots-store/Makefile
pkcs11/roots-store/tests/Makefile
pkcs11/rpc-layer/Makefile
pkcs11/ssh-agent/Makefile
pkcs11/ssh-store/Makefile
pkcs11/ssh-store/tests/Makefile
pkcs11/user-store/Makefile
po/Makefile.in
tests/Makefile
tool/Makefile
library/gnome-keyring-1.pc
library/gnome-keyring-1-uninstalled.pc
])

# 
# gp11/tests/module/Makefile

# ------------------------------------------------------------------------------
# Summary
# 

echo
echo "OPTIONAL DEPENDENCIES"
echo "  PAM:           $pam_status"
echo "  HAL:           $hal_status"
echo
echo "CONFIGURATION"
echo "  SSH Agent:            $ssh_status"
echo "  Root Certificates:    $root_status"
echo
echo "BUILD"
echo "  Debug Build:          $debug_status"
echo "  Tests, -Werror:       $tests_status"
echo