File: configure.ac

package info (click to toggle)
pidgin-encryption 3.1-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,916 kB
  • ctags: 961
  • sloc: sh: 10,460; ansic: 8,821; makefile: 376; yacc: 318
file content (449 lines) | stat: -rw-r--r-- 10,352 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
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
# -*- shell-script -*-
#
# Simple configure.in for pidgin-encryption
#

#
# Init autoconf
#

AC_INIT(./encrypt.c)
AC_PREREQ(2.52)
AC_CANONICAL_SYSTEM

#
# Init automake
# The third argument to AM_INIT_AUTOMAKE surpresses the PACKAGE and
# VERSION macors
#

PIDGIN_ENC_VERSION="`cat $srcdir/VERSION`"

AM_INIT_AUTOMAKE(pidgin-encryption, $PIDGIN_ENC_VERSION, 'no-define')
AC_DEFINE_UNQUOTED(ENC_VERSION, "$PIDGIN_ENC_VERSION",
    [Version of pidgin-encryption plugin])

AC_DEFINE_UNQUOTED(ENC_PACKAGE, "$PACKAGE",
    [Version of pidgin-encryption plugin])
 
# before gettexting, in case iconv matters
case "$host_os" in
darwin*)
        AC_MSG_CHECKING([for fink])
        if test -d /sw; then
                AC_MSG_RESULT([found, adding /sw to search paths])
                CFLAGS="$CFLAGS -I/sw/include"
        else
                AC_MSG_RESULT([not found])
        fi
        ;;
*)
        ;;
esac
 
ALL_LINGUAS="bg cs da de es fr hu it ja lt nl nn pl pt_BR pt_PT ro ru sl sv ta tr uk zh_CN zh_TW"
AM_GNU_GETTEXT_VERSION(0.10.40)
AM_GNU_GETTEXT


#
# Setup the header file
#

AH_TOP([/* Pidgin-encryption header file */

#ifndef _PIDGIN_ENCRYPTION_CONFIG_H
#define _PIDGIN_ENCRYPTION_CONFIG_H
])
AH_BOTTOM([
#endif /* _PIDGIN_ENCRYPTION_CONFIG_H */
])


#
# Look for the C compiler
#

CFLAGS_save="$CFLAGS"
AC_PROG_CC
CFLAGS="$CFLAGS_save"


#
# Utility function
#

check_for_header() {
    file="$1"
    bases="$2"
    variations=". $3"

    result=
    for dir in $bases; do
	if test -z "$result"; then
	    for variant in $variations; do
		if test -z "$result" -a -f "$dir/$variant/$file"; then
		    result="$dir/$variant"
		fi
	    done
	fi
    done

    if test -z "$result"; then
	AC_MSG_RESULT([not found!])
	AC_MSG_ERROR([*** Cannot continue])
    fi
}

check_for_lib() {
    func="$1"
    lib="$2"
    bases="$3"
    variations="$4"

    LIBS_save="$LIBS"
    LDFLAGS_save="$LDFLAGS"

    found=0
    result=
    LIBS="-l$lib $LIBS_save"
    AC_CHECK_FUNC($func, result="$dir/$variant")
    if test -z "$result"; then
	for dir in $bases; do
	    if test -z "$result"; then
		for variant in $variations; do
		    echo checking: $dir/$variant
		    if test -z "$result"; then
			if test -d "$dir/$variant"; then
			    LDFLAGS="-L$dir/$variant $LDFLAGS_save"
			    AC_CHECK_FUNC($func, result="$dir/$variant")
			fi
			cmd="unset ac_cv_func_$func"
			eval $cmd
			unset cmd
		    fi
		done
	    fi
	done
    fi

    if test -z "$result"; then
	AC_MSG_RESULT([could not find $lib])
	AC_MSG_ERROR([*** Cannot continue])
    fi

    LDFLAGS="-L$result $LDFLAGS_save"
}


#
# Check for Pidgin
#

PKG_CHECK_MODULES(PIDGIN, pidgin,
[
	AC_DEFINE(HAVE_PIDGIN, 1, [Define if we have found pidgin.])
])

AC_SUBST(PIDGIN_CFLAGS)
PIDGIN_DATADIR=`pkg-config --variable=datadir pidgin`
AC_SUBST(PIDGIN_DATADIR)

#
# Check for libpurple
#

PKG_CHECK_MODULES(PURPLE, purple,
[
	AC_DEFINE(HAVE_PURPLE, 1, [Define if we have found purple.])
])

AC_SUBST(PURPLE_CFLAGS)
PIDGIN_DATADIR=`pkg-config --variable=datadir purple`
AC_SUBST(PURPLE_DATADIR)

dnl #
dnl # Check for NSS if it's specified, or if GNUTLS checks failed.
dnl #
if test "x$enable_nss" != "xno"; then

	AC_ARG_WITH(nspr-includes,
		[  --with-nspr-includes=PREFIX     Specify location of Mozilla nspr4 includes.],
		[with_nspr_includes="$withval"])

	AC_ARG_WITH(nspr-libs,
		[  --with-nspr-libs=PREFIX         Specify location of Mozilla nspr4 libs.],
		[with_nspr_libs="$withval"])

	AC_ARG_WITH(nss-includes,
		[  --with-nss-includes=PREFIX      Specify location of Mozilla nss3 includes.],
		[with_nss_includes="$withval"])

	AC_ARG_WITH(nss-libs,
		[  --with-nss-libs=PREFIX          Specify location of Mozilla nss3 libs.],
		[with_nss_libs="$withval"])


	if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
	   test -n "$with_nss_includes"  || test -n "$with_nss_libs"  ||
	   test "x$enable_nss" = "xstatic"; then

		nss_manual_check="yes"
	else
		nss_manual_check="no"
	fi

	enable_nss="no"

	if test "x$nss_manual_check" = "xno"; then
		if `$PKG_CONFIG --exists mozilla-nss`; then
			PKG_CHECK_MODULES(NSS, mozilla-nss, have_nss="yes", have_nss="no")
			mozilla_nspr="mozilla-nspr"
			mozilla_nss="mozilla-nss"
		else
			if `$PKG_CONFIG --exists nss`; then
				PKG_CHECK_MODULES(NSS, nss, have_nss="yes")
				mozilla_nspr="nspr"
				mozilla_nss="nss"
			fi
		fi

		if test "x$have_nss" = "xyes"; then

			AC_DEFINE(HAVE_NSS, 1, [Define if you have Mozilla NSS])
			AC_DEFINE(HAVE_SSL, 1, [Define if you have SSL])

			msg_nss="Mozilla NSS"
			enable_nss="yes"
		else
			nss_manual_check="yes"
		fi
	fi

	if test "x$nss_manual_check" = "xyes"; then
		mozilla_nss=""
		have_nspr_includes="no"

		if test "x$with_nspr_includes" != "xno"; then
			CPPFLAGS_save=$CPPFLAGS

			AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
			AC_MSG_RESULT("")

			CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
			AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
			CPPFLAGS=$CPPFLAGS_save

			if test "x$moz_nspr_includes" != "xno" -a \
			        "x$moz_nspr_includes" != "x"; then

				have_nspr_includes="yes"
				NSPR_CFLAGS="-I$with_nspr_includes"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nspr4 includes)
			AC_MSG_RESULT(no)

			enable_nss="no"
		fi

		have_nspr_libs="no"

		if test "x$with_nspr_libs"     != "xno" -a \
		        "x$have_nspr_includes" != "xno"; then

			CFLAGS_save=$CFLAGS
			LDFLAGS_save=$LDFLAGS

			if test "$enable_nss" = "static"; then
				if test -z "$with_nspr_libs"; then
					AC_MSG_ERROR(
						[Static linkage requested, but path to nspr libraries not set.]
						[Please specify the path to libnspr4.a]
						[Example: --with-nspr-libs=/usr/lib])

					enable_nss="no"
				else
					nsprlibs="$LIBDL $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
				fi
			else
				nsprlibs="$LIBDL -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
			fi

			AC_CACHE_CHECK([for Mozilla nspr libraries], moz_nspr_libs,
			[
				LIBS_save=$LIBS
				CFLAGS="$CFLAGS $NSPR_CFLAGS"

				LIBS="$nsprlibs"

				if test "x$with_nspr_libs" != "x"; then
					LDFLAGS="$LDFLAGS -L$with_nspr_libs"
				else
					LDFLAGS="$LDFLAGS"
				fi

				AC_TRY_LINK_FUNC(PR_Init,
					[moz_nspr_libs="yes"],
					[moz_nspr_libs="no"])

				CFLAGS=$CFLAGS_save
				LDFLAGS=$LDFLAGS_save
				LIBS=$LIBS_save
			])

			if test "x$moz_nspr_libs" != "xno"; then
				have_nspr_libs="yes"
				NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
			else
				NSPR_CFLAGS=""
				enable_nss="no"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nspr4 libraries)
			AC_MSG_RESULT(no)
		fi

		have_nss_includes="no"

		if test "x$with_nss_includes" != "xno" -a \
				"x$have_nspr_libs"    != "xno"; then

			CPPFLAGS_save=$CPPFLAGS

			AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
			AC_MSG_RESULT("")

			if test "x$with_nspr_includes" != "x"; then
				CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
			else
				CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
			fi

			AC_CHECK_HEADERS(nss.h ssl.h smime.h keyhi.h,
				[moz_nss_includes="yes"],
				[moz_nss_includes="no"])

			CPPFLAGS=$CPPFLAGS_save

			if test "x$moz_nss_includes" = "xyes"; then
				have_nss_includes="yes"
				NSS_CFLAGS="-I$with_nss_includes"
			else
				NSPR_CFLAGS=""
				NSPR_LIBS=""
				enable_nss="no"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nss3 includes)
			AC_MSG_RESULT(no)
			enable_nss="no"
		fi

		if test "x$with_nss_libs"     != "xno" -a \
				"x$have_nss_includes" != "xno"; then

			LDFLAGS_save=$LDFLAGS

			if test "$enable_nss" = "static"; then
				if test -z "$with_nss_libs"; then
					AC_MSG_ERROR(
						[Static linkage requested, but path to nss libraries not set.]
						[Please specify the path to libnss3.a]
						[Example: --with-nspr-libs=/usr/lib/mozilla])
					enable_nss="no"
				else
					nsslibs="-ldb1 $with_nss_libs/libnssckfw.a $with_nss_libs/libasn1.a $with_nss_libs/libcrmf.a $with_nss_libs/libswfci.a $with_nss_libs/libjar.a $with_nss_libs/libpkcs12.a $with_nss_libs/libpkcs7.a $with_nss_libs/libpki1.a $with_nss_libs/libsmime.a $with_nss_libs/libssl.a $with_nss_libs/libnss.a $with_nss_libs/libpk11wrap.a $with_nss_libs/libsoftokn.a $with_nss_libs/libfreebl.a $with_nss_libs/libnsspki.a $with_nss_libs/libnssdev.a $with_nss_libs/libcryptohi.a $with_nss_libs/libcerthi.a $with_nss_libs/libcertdb.a $with_nss_libs/libsecutil.a $with_nss_libs/libnssb.a"

					case "$host" in
						*solaris*)
							nsslibs="$nsslibs $with_nss_libs/libfreeb1.a"
							;;
					esac
				fi
			else
				nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
			fi

			AC_CACHE_CHECK([for Mozilla nss libraries], moz_nss_libs,
			[
				LIBS_save=$LIBS
				LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
				LIBS="$nsslibs $nsprlibs"

				AC_TRY_LINK_FUNC(NSS_Init,
					[moz_nss_libs="yes"],
					[moz_nss_libs="no"])

				if test "x$moz_nss_libs" = "xno"; then
					nsslibs="-lssl3 -lsmime3 -lnss3 -lsoftokn3"
					LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
					AC_TRY_LINK_FUNC(NSS_Init,
						[moz_nss_libs="yes"],
						[moz_nss_libs="no"])
				fi

				LDFLAGS=$LDFLAGS_save
				LIBS=$LIBS_save
			])

			if test "x$moz_nss_libs" != "xno"; then
				AC_DEFINE(HAVE_NSS)
				AC_DEFINE(HAVE_SSL)

				NSS_LIBS="-L$with_nss_libs $nsslibs"

				if test "$enable_nss" = "static"; then
					msg_nss="Mozilla NSS (static)"
				else
					msg_nss="Mozilla NSS"
				fi

				enable_nss="yes"
			else
				NSS_CFLAGS=""
				NSPR_CFLAGS=""
				NSPR_LIBS=""
				enable_nss="no"
			fi
		else
			AC_MSG_CHECKING(for Mozilla nss libraries)
			AC_MSG_RESULT(no)
		fi

		NSS_CFLAGS="$NSPR_CFLAGS $NSS_CFLAGS"
		NSS_LIBS="$NSPR_LIBS $NSS_LIBS"
	fi

	AC_SUBST(NSS_CFLAGS)
	AC_SUBST(NSS_LIBS)
fi

AM_PATH_GTK_2_0(2.0.0,,AC_MSG_ERROR([
*** GTK+ 2.0 is required to build Pidgin-Encryption; please make sure you have the GTK+
*** development headers installed. The latest version of GTK+ is
*** always available at http://www.gtk.org/.]))
CPPFLAGS="$GTK_CFLAGS $CPPFLAGS"


#
# A little tomfoolery to make this buildable both in the pidgin
# structure and standalone
#
want_plugins=yes
AM_CONDITIONAL(PLUGINS, test "$want_plugins" = "yes")

#
# Setup libtool
#

AM_PROG_LIBTOOL


#
# Party on
#

AM_CONFIG_HEADER(pre-config.h)

AC_OUTPUT([Makefile pixmaps/Makefile intl/Makefile po/Makefile.in])