File: configure.ac

package info (click to toggle)
cryptonit 0.9.7-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,520 kB
  • ctags: 3,232
  • sloc: cpp: 20,084; sh: 9,373; ansic: 5,325; makefile: 321; perl: 33; sed: 16
file content (526 lines) | stat: -rw-r--r-- 14,961 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
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
AC_PREREQ(2.59)
AC_INIT([cryptonit],[0.9.7],[cryptonit@lists.idealx.org])

AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE([dist-bzip2])
AC_LANG([C++])
AC_LANG([C]) 
AC_HEADER_STDC

AC_PROG_CC
AC_DIAGNOSE([obsolete],[AM_PROG_CC_STDC:
	your code should no longer depend upon `am_cv_prog_cc_stdc', but upon
	`ac_cv_prog_cc_stdc'.  Remove this warning and the assignment when
	you adjust the code.  You can also remove the above call to
	AC_PROG_CC if you already called it elsewhere.])
am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc

dnl AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

CXXFLAGS='-O2'

dnl Allow user to specify flags
AC_ARG_WITH(cxxflags,
        [  --with-cxxflags           Specify additional flags to pass to compiler],
        [
                if test "x$withval" != "xno" ; then
                        CXXFLAGS="$CXXFLAGS $withval"
                fi
        ]       
)
AC_ARG_WITH(cppflags,
        [  --with-cppflags         Specify additional flags to pass to preprocessor] ,
        [
                if test "x$withval" != "xno"; then
                        CPPFLAGS="$CPPFLAGS $withval"
                fi
        ]
)
AC_ARG_WITH(ldflags,
        [  --with-ldflags          Specify additional flags to pass to linker],
        [
                if test "x$withval" != "xno" ; then
                        LDFLAGS="$LDFLAGS $withval"
                fi
        ]       
)
AC_ARG_WITH(libs,
        [  --with-libs             Specify additional libraries to link with],
        [
                if test "x$withval" != "xno" ; then
                        LIBS="$LIBS $withval"
                fi
        ]       
)
AC_ARG_WITH(ssl-dir,
	[  --with-ssl-dir=PATH	  Use OpenSSL in PATH],
	[

                if test "x$withval" = "xno" ; then
                        AC_MSG_ERROR([*** OpenSSL is required ***])
                fi

		USE_SSL_DIR="1"
                if test -d "$withval/lib"; then
			if test "$withval" != "xno" ; then
				SSL_LDFLAGS="-L${withval}/lib"
			fi
		else
			SSL_LDFLAGS="-L${withval}"
		fi

                if test -d "$withval/include"; then
                        SSL_CPPFLAGS="-I${withval}/include"
                else
                        SSL_CPPFLAGS="-I${withval}"
                fi
	]
)
AC_ARG_WITH(ldap-dir,
	[  --with-ldap-dir=PATH	  Use OpenLDAP in PATH],
	[

                if test "x$withval" = "xno" ; then
                        AC_MSG_ERROR([*** OpenLDAP is required ***])
                fi

		USE_LDAP_DIR="1"
                if test -d "$withval/lib"; then
			if test "$withval" != "xno" ; then
				LDAP_LDFLAGS="-L${withval}/lib"
			fi
		else
			LDAP_LDFLAGS="-L${withval}"
		fi

                if test -d "$withval/include"; then
                        LDAP_CPPFLAGS="-I${withval}/include"
                else
                        LDAP_CPPFLAGS="-I${withval}"
                fi
	]
)
AC_ARG_ENABLE(self-decrypting,
	[  --enable-self-decrypting	  Enable sef decrypting, use specific plateform code],
	[
        	if test "$enableval" = "yes" ; then
			USE_SELF_DECRYPTING="1"
		fi 
	]
)
AC_ARG_ENABLE(debug,
	[  --enable-debug	  Enable debug informations],
	[	if test "$enableval" = "yes" ; then
			USE_DEBUG="1"
		fi
	]
)

if test "$build_alias" != "$host_alias"; then
   CROSS_COMPIL="1"
   WINDRES="$host_alias-windres"
   AC_SUBST(WINDRES)
fi[] dnl

AM_CONDITIONAL(CROSS_COMPIL, test "$CROSS_COMPIL" = "1")


if test "$USE_DEBUG" = 1; then
   AC_SUBST(DEBUG)
   AC_DEFINE(DEBUG, 1, [Enable debug mode])
   CPPFLAGS="$CPPFLAGS -DDEBUG"
   CXXFLAGS="$CXXFLAGS -g -Wall"
   WX_CONFIG_NAME="wx-config"
fi 

if test "$USE_SELF_DECRYPTING" = 1; then
   AC_SUBST(USE_SELF_DECRYPTING)
   AC_DEFINE(USE_SELF_DECRYPTING, 1, [Enable self decrypting code])
fi 

AM_CONDITIONAL(USE_SELF_DECRYPTING, test "$USE_SELF_DECRYPTING" = "1")

dnl Set PACKAGE_LOCALE_DIR in config.h.
if test "x${prefix}" = "xNONE"; then
  AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale", [Package locale directory])
else
  AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale", [Package locale directory])
fi [] dnl

dnl Set PACKAGE_DATA_DIR in config.h.
if test "x${datadir}" = 'x${prefix}/share'; then
  if test "x${prefix}" = "xNONE"; then
    AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", [Package data directory])
  else
    AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}", [Package data directory])
  fi [] dnl
else
  AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}", [Package data directory])
fi [] dnl

dnl Set PACKAGE_SOURCE_DIR in config.h.
SOURCEDIR=`cd $srcdir; exec pwd`
AC_SUBST(SOURCEDIR)
AC_DEFINE_UNQUOTED([PACKAGE_SOURCE_DIR], "$SOURCEDIR", [Package source directory])

AC_CHECK_FUNCS(mkstemp)

dnl ------------------------------------------------------------------------
dnl		hash_map STL extension
dnl ------------------------------------------------------------------------
AC_DEFUN([AC_CXX_HAVE_HASH_MAP],
[AC_CACHE_CHECK(whether the compiler has hash_map,
ac_cv_cxx_have_hash_map,
[ AC_DIAGNOSE([obsolete],[Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])dnl
AC_LANG_SAVE
  AC_LANG([C++])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hash_map>
using namespace std;
]], [[hash_map<int, int> t; return 0;]])],[ac_cv_cxx_have_hash_map=yes],[ac_cv_cxx_have_hash_map=no])
  AC_LANG_POP([])
])
if test "$ac_cv_cxx_have_hash_map" = yes; then
   AC_DEFINE(HAVE_HASH_MAP,,[define if the compiler has hash_map])
fi
])

AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP],
[AC_CACHE_CHECK(whether the compiler has ext/hash_map,
ac_cv_cxx_have_ext_hash_map,
[ AC_DIAGNOSE([obsolete],[Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])dnl
AC_LANG_SAVE
  AC_LANG([C++])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
using namespace __gnu_cxx;
]], [[hash_map<int, int> t; return 0;]])],[ac_cv_cxx_have_ext_hash_map=yes],[ac_cv_cxx_have_ext_hash_map=no])
  AC_LANG_POP([])
])
if test "$ac_cv_cxx_have_ext_hash_map" = yes; then
   AC_DEFINE(HAVE_EXT_HASH_MAP,,[define if the compiler has ext/hash_map])
fi
])


AC_CXX_HAVE_HASH_MAP
if test "$ac_cv_cxx_have_hash_map" = no; then
   AC_CXX_HAVE_EXT_HASH_MAP
   if test "$ac_cv_cxx_have_ext_hash_map" = no; then
      AC_MSG_ERROR([*** hash_map STL extension is required ***])
   fi
fi




dnl ------------------------------------------------------------------------
dnl		hash_set STL extension
dnl ------------------------------------------------------------------------
AC_DEFUN([AC_CXX_HAVE_HASH_SET],
[AC_CACHE_CHECK(whether the compiler has hash_set,
ac_cv_cxx_have_hash_set,
[ AC_DIAGNOSE([obsolete],[Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])dnl
AC_LANG_SAVE
  AC_LANG([C++])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hash_set>
using namespace std;
]], [[hash_set<int, int> t; return 0;]])],[ac_cv_cxx_have_hash_set=yes],[ac_cv_cxx_have_hash_set=no])
  AC_LANG_POP([])
])
if test "$ac_cv_cxx_have_hash_set" = yes; then
   AC_DEFINE(HAVE_HASH_SET,,[define if the compiler has hash_set])
fi
])

AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET],
[AC_CACHE_CHECK(whether the compiler has ext/hash_set,
ac_cv_cxx_have_ext_hash_set,
[ AC_DIAGNOSE([obsolete],[Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])dnl
AC_LANG_SAVE
  AC_LANG([C++])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_set>
using namespace __gnu_cxx;
]], [[hash_set<int, int> t; return 0;]])],[ac_cv_cxx_have_ext_hash_set=yes],[ac_cv_cxx_have_ext_hash_set=no])
  AC_LANG_POP([])
])
if test "$ac_cv_cxx_have_ext_hash_set" = yes; then
   AC_DEFINE(HAVE_EXT_HASH_SET,,[define if the compiler has ext/hash_set])
fi
])


AC_CXX_HAVE_HASH_SET
if test "$ac_cv_cxx_have_hash_set" = no; then
   AC_CXX_HAVE_EXT_HASH_SET
   if test "$ac_cv_cxx_have_ext_hash_set" = no; then
      AC_MSG_ERROR([*** hash_set STL extension is required ***])
   fi
fi




dnl ------------------------------------------------------------------------
dnl		wxWindows
dnl ------------------------------------------------------------------------

dnl AM_OPTIONS_WXCONFIG
AM_OPTIONS_WXCONFIG

AM_PATH_WXCONFIG(2.6.0, WXFOUND=1)

if test "$WXFOUND" != 1; then
    AC_MSG_ERROR([
        Please check that wx-config is in path, the directory
        where wxWindows libraries are installed (returned by
        'wx-config --libs' command) is in LD_LIBRARY_PATH or
        equivalent variable and wxWindows is version 2.4.0 or above.
    ])
fi


if test "$USE_DEBUG" = 1; then
   GUI_CPPFLAGS="$GUI_CPPFLAGS -DDEBUG"
   GUI_CXXFLAGS="$GUI_CXXFLAGS -g -Wall"
fi

GUI_CPPFLAGS="$GUI_CPPFLAGS $WX_CPPFLAGS"
AC_SUBST(GUI_CPPFLAGS)

GUI_CXXFLAGS="$GUI_CXXFLAGS $WX_CXXFLAGS"
AC_SUBST(GUI_CXXFLAGS)

GUI_LDADD="$GUI_LDADD $WX_LIBS"
AC_SUBST(GUI_LDADD)

dnl Get include path for windres
WX_INCLUDE_PATH="`$WX_CONFIG_WITH_ARGS --prefix`/include"
AC_SUBST(WX_INCLUDE_PATH)


dnl ------------------------------------------------------------------------
dnl		GetText
dnl ------------------------------------------------------------------------
dnl AM_GNU_GETTEXT([use-libtool],,)
dnl AM_GNU_GETTEXT(,,,)
dnl AM_GNU_GETTEXT
AM_GNU_GETTEXT([external])


dnl check for xgettext/msgmerge
dnl MAKE_XLATE='TRANSLATIONS := yes'
dnl AC_PATH_PROG(XGETTEXT,xgettext)
dnl AC_PATH_PROG(MSGMERGE,msgmerge)
dnl case ".$XGETTEXT.$MSGMERGE." in *..*)
dnl         AC_MSG_WARN([cannot rebuild message translations.
dnl                     You must install xgettext/msgmerge in order to do it.])
dnl         MAKE_XLATE='TRANSLATIONS := no'
dnl esac
dnl AC_SUBST(MAKE_XLATE)

dnl compile/install binary translations
AC_PATH_PROG(MSGFMT,msgfmt)
case "$MSGFMT" in '')
        AC_MSG_WARN([cannot compile message translations.
                    Binary translations will not be installed.  You need
                    the 'msgfmt' program to compile message translations.])
esac
AM_CONDITIONAL(MAKE_MO, test "$MSGFMT" != "" )



dnl ------------------------------------------------------------------------
dnl		OpenSSL
dnl ------------------------------------------------------------------------
dnl Determine OpenSSL header version
AC_DEFUN([AC_CHECK_OPENSSL_VERSION], [
AC_MSG_CHECKING([OpenSSL header version])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/opensslv.h>
#define DATA "conftest.sslincver"
int main(void) {
  FILE *fd;
  int rc;
  char buffer[256];
  
  fd = fopen(DATA,"w");
  if(fd == NULL)
    exit(1);
  if( (rc = snprintf(buffer, 256, "%lx (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) < 0) {
    printf("Can't find OpenSSL version number.\n");
    exit(1);
  }
  else {
    if( OPENSSL_VERSION_NUMBER >= 0x0090700fL ) {
      fprintf(fd, "%s (%lx)\n", OPENSSL_VERSION_TEXT, OPENSSL_VERSION_NUMBER);
      exit(0);
    }
    else {
      printf("Your OpenSSL version is inferior at 0.9.7: %s (%lx)\n", OPENSSL_VERSION_TEXT, OPENSSL_VERSION_NUMBER);
      exit(1);
    }
  }
}
]])],[
                 ssl_header_ver=`cat conftest.sslincver`
                 AC_MSG_RESULT($ssl_header_ver)
         ],[
                 dnl AC_MSG_RESULT(error)
                 AC_MSG_ERROR(OpenSSL version header mismatch or not found.)
         ],[])
])



dnl All test are desactivated if we are cross-compiling
if test "$CROSS_COMPIL" != "1"; then



if test "$USE_SSL_DIR" = "1"; then

   CPPFLAGS_OLD="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"

   LDADD_OLD="$LDADD"
   LDADD="$LDADD $SSL_LDFLAGS"

   AC_CHECK_HEADER(openssl/ssl.h,
                AC_DEFINE([HAVE_SSL_H], [], [SSL header]),
                AC_MSG_ERROR([Can't find SSL header file]))

   AC_CHECK_OPENSSL_VERSION

   AC_CHECK_LIB(ssl, X509_verify,
	     SSL_LDFLAGS="$SSL_LDFLAGS -lcrypto",
             AC_MSG_ERROR([Can't find SSL library]))


   CPPFLAGS="$CPPFLAGS_OLD"
   LDADD="$LDADD_OLD"

else

dnl ---- SSL header ----  
AC_CHECK_OPENSSL_VERSION


dnl ---- SSL Library ----
dnl AC_CHECK_LIB([ssl],[main],[dnl		LDFLAGS="$LDFLAGS -lssl"],[dnl                AC_MSG_ERROR(Can't find SSL library)],[])ac_cv_lib_ssl=ac_cv_lib_ssl_main

AC_CHECK_HEADER(openssl/crypto.h,
                AC_DEFINE([HAVE_CRYPTO_H], [], [Crypto header]),
                AC_MSG_ERROR([Can't find crypto header file]))
		
AC_CHECK_LIB(crypto, X509_verify,
             SSL_LDFLAGS="$SSL_LDFLAGS -lcrypto",
	     AC_MSG_ERROR([Can't find Crypto library]))
	     
AC_CHECK_HEADER(openssl/ssl.h,
                AC_DEFINE([HAVE_SSL_H], [], [SSL header]),
                AC_MSG_ERROR([Can't find SSL header file]))

SAVE_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -lcrypto"			  
AC_CHECK_LIB(ssl, SSL_connect,
	     SSL_LDFLAGS="-lssl $SSL_LDFLAGS",
             AC_MSG_ERROR([Can't find SSL library]))
LDFLAGS="$SAVE_LDFLAGS"

dnl ---- Crypto header ----

dnl ---- Crypto librarie ----
dnl AC_CHECK_LIB([crypto],[main],[dnl		LDFLAGS="$LDFLAGS -lcrypto"],[dnl                AC_MSG_ERROR(Can't find crypto library)],[])ac_cv_lib_crypto=ac_cv_lib_crypto_main

fi

AC_SUBST(SSL_CPPFLAGS)
AC_SUBST(SSL_LDFLAGS)

dnl ------------------------------------------------------------------------
dnl		OpenLDAP
dnl ------------------------------------------------------------------------

if test "$USE_LDAP_DIR" = "1"; then
   AC_MSG_WARN(Bypassing OpenLDAP headers and libraries check since --with-ldap-dir option used.)
else

AC_CHECK_HEADER(ldap.h,	
		AC_DEFINE([HAVE_LDAP_H], [], [LDAP Header]),
		AC_MSG_ERROR([Can't find LDAP header file]))

AC_CHECK_LIB(ldap, ldap_init,
	     LDAP_LDFLAGS="$LDAP_FLAGS -lldap",
	     AC_MSG_ERROR([Can't find LDAP library]))

fi

AC_SUBST(LDAP_LDFLAGS)
AC_SUBST(LDAP_CPPFLAGS)


else
  AC_MSG_WARN(Checks for OpenSSL and OpenLDAP are bypassed we are cross-compiling)
fi dnl if test "$CROSS_COMPIL" != "1"; then


dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

if test -n "$GCC"
then
  CFLAGS="$CFLAGS -Wall -Wpointer-arith -finline-functions -ffast-math"
  case "$CFLAGS" in
    -g*) ;;
    *\ -g*) ;;
    *) CFLAGS="$CFLAGS -fomit-frame-pointer" ;;
  esac
  case "$host" in
    *-*-freebsd*)
	;;
    *)
	CFLAGS="$CFLAGS -funroll-all-loops"
	;;
  esac
fi



dnl This is the result of a libtools.m4 macro
if test "$compiler_rtti_exceptions" = "yes"; then
    SSL_CXXFLAGS="$SSL_CXXFLAGS -fno-rtti -fno-exceptions"
    GUI_CXXFLAGS="$GUI_CXXFLAGS -fno-rtti -fno-exceptions"
fi

CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
AC_SUBST(CXXFLAGS)

AC_CONFIG_FILES([   m4/Makefile
po/Makefile.in
Makefile
src/Makefile
src/pkcs11/Makefile
src/gui/Makefile
])
AC_OUTPUT
dnl END ** Do _not_ move or remove this line ! **