forked from OpenSC/OpenSC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
857 lines (764 loc) · 23.5 KB
/
configure.ac
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
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
dnl -*- mode: m4; -*-
AC_PREREQ(2.60)
define([PRODUCT_NAME], [OpenSC])
define([PRODUCT_TARNAME], [opensc])
define([PRODUCT_BUGREPORT], [https://github.com/OpenSC/OpenSC/issues])
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [15])
define([PACKAGE_VERSION_FIX], [0])
define([PACKAGE_SUFFIX], [])
define([PACKAGE_VERSION_REVISION], [0])
define([VS_FF_LEGAL_COPYRIGHT], [OpenSC Project])
define([VS_FF_LEGAL_COMPANY_NAME], [OpenSC Project])
define([VS_FF_LEGAL_COMPANY_URL], [https://github.com/OpenSC])
define([VS_FF_COMMENTS], [Provided under the terms of the GNU Lesser General Public License (LGPLv2.1+).])
define([VS_FF_PRODUCT_NAME], [OpenSC smartcard framework])
define([VS_FF_PRODUCT_UPDATES], [https://github.com/OpenSC/OpenSC/releases])
define([VS_FF_PRODUCT_URL], [https://github.com/OpenSC/OpenSC])
m4_include(version.m4)
m4_sinclude(version.m4.ci)
AC_INIT([PRODUCT_NAME],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX],[PRODUCT_BUGREPORT],[PRODUCT_TARNAME])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(foreign 1.10)
OPENSC_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
OPENSC_VERSION_MINOR="PACKAGE_VERSION_MINOR"
OPENSC_VERSION_FIX="PACKAGE_VERSION_FIX"
OPENSC_VERSION_REVISION="PACKAGE_VERSION_REVISION"
OPENSC_VS_FF_LEGAL_COPYRIGHT="VS_FF_LEGAL_COPYRIGHT"
OPENSC_VS_FF_COMPANY_NAME="VS_FF_LEGAL_COMPANY_NAME"
OPENSC_VS_FF_COMPANY_URL="VS_FF_LEGAL_COMPANY_URL"
OPENSC_VS_FF_COMMENTS="VS_FF_COMMENTS"
OPENSC_VS_FF_PRODUCT_NAME="VS_FF_PRODUCT_NAME"
OPENSC_VS_FF_PRODUCT_UPDATES="VS_FF_PRODUCT_UPDATES"
OPENSC_VS_FF_PRODUCT_URL="VS_FF_PRODUCT_URL"
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Oldest interface removed: OLDEST++)
# (Interfaces added: CURRENT++, REVISION=0)
OPENSC_LT_CURRENT="4"
OPENSC_LT_OLDEST="4"
OPENSC_LT_REVISION="0"
OPENSC_LT_AGE="0"
OPENSC_LT_AGE="$((${OPENSC_LT_CURRENT}-${OPENSC_LT_OLDEST}))"
AC_CONFIG_SRCDIR([src/libopensc/sc.c])
# silent build by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CANONICAL_HOST
AC_PROG_CC
# AC_PROG_CXX is needed to built the win32 custom action. Indeed dutil.h use [extern "C"] definition which fails on pure c compiler
AC_PROG_CXX
PKG_PROG_PKG_CONFIG
AC_C_BIGENDIAN
AC_ARG_ENABLE(
[optimization],
[AS_HELP_STRING([--disable-optimization],[disable compile optimization @<:@enabled@:>@])],
,
[enable_optimization="yes"]
)
AC_ARG_WITH(
[cygwin-native],
[AS_HELP_STRING([--with-cygwin-native],[compile native win32])],
,
[with_cygwin_native="no"]
)
if test "${enable_optimization}" = "no"; then
CFLAGS="-O0 -g"
fi
dnl Check for some target-specific stuff
test -z "${WIN32}" && WIN32="no"
test -z "${CYGWIN}" && CYGWIN="no"
case "${host}" in
*-*-solaris*)
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -R/usr/local/lib"
;;
*-mingw*|*-winnt*)
WIN32="yes"
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
WIN_LIBPREFIX="lib"
;;
*-cygwin*)
AC_MSG_CHECKING([cygwin mode to use])
CYGWIN="yes"
if test "${with_cygwin_native}" = "yes"; then
AC_MSG_RESULT([Using native win32])
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
CFLAGS="${CFLAGS} -mno-cygwin"
WIN32="yes"
else
AC_MSG_RESULT([Using cygwin])
CPPFLAGS="${CPPFLAGS} -DCRYPTOKI_FORCE_WIN32"
WIN_LIBPREFIX="cyg"
AC_DEFINE([USE_CYGWIN], [1], [Define if you are on Cygwin])
fi
;;
esac
case "${host}" in
*-mingw*|*-winnt*|*-cygwin*)
DEBUG_FILE="%TEMP%\\\opensc-debug.log"
PROFILE_DIR_DEFAULT="obtained from windows registers"
PROFILE_DIR="\"\""
;;
*)
DEBUG_FILE="/tmp/opensc-debug.log"
PROFILE_DIR="\$(pkgdatadir)"
PROFILE_DIR_DEFAULT="\$(pkgdatadir)"
;;
esac
AC_DEFINE_UNQUOTED([DEBUG_FILE], ["${DEBUG_FILE}"], [Debug file])
AC_DEFINE_UNQUOTED([PROFILE_DIR], ["${PROFILE_DIR}"], [Directory of profiles])
AC_DEFINE_UNQUOTED([PROFILE_DIR_DEFAULT], ["${PROFILE_DIR_DEFAULT}"], [Default directory of profiles])
AC_ARG_ENABLE(
[strict],
[AS_HELP_STRING([--disable-strict],[disable strict compile mode @<:@disabled@:>@])],
,
[enable_strict="yes"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])],
,
[enable_pedantic="no"]
)
AC_ARG_ENABLE(
[thread_locking],
[AS_HELP_STRING([--disable-thread-locking],[disable OS thread locking @<:@enabled@:>@])],
,
[enable_thread_locking="yes"]
)
AC_ARG_ENABLE(
[zlib],
[AS_HELP_STRING([--enable-zlib],[enable zlib linkage @<:@detect@:>@])],
,
[enable_zlib="detect"]
)
AC_ARG_ENABLE(
[readline],
[AS_HELP_STRING([--enable-readline],[enable readline linkage @<:@detect@:>@])],
,
[enable_readline="detect"]
)
AC_ARG_ENABLE(
[openssl],
[AS_HELP_STRING([--enable-openssl],[enable openssl linkage @<:@detect@:>@])],
,
[enable_openssl="detect"]
)
AC_ARG_ENABLE(
[openct],
[AS_HELP_STRING([--enable-openct],[enable openct linkage @<:@disabled@:>@])],
,
[enable_openct="no"]
)
AC_ARG_ENABLE(
[pcsc],
[AS_HELP_STRING([--disable-pcsc],[disable pcsc support @<:@enabled@:>@])],
,
[enable_pcsc="yes"]
)
AC_ARG_ENABLE(
[ctapi],
[AS_HELP_STRING([--enable-ctapi],[enable CT-API support @<:@disabled@:>@])],
,
[enable_ctapi="no"]
)
AC_ARG_ENABLE(
[minidriver],
[AS_HELP_STRING([--enable-minidriver],[enable minidriver on Windows @<:@disabled@:>@])],
,
[enable_minidriver="no"]
)
AC_ARG_ENABLE(
[sm],
[AS_HELP_STRING([--disable-sm],[disable secure messaging support and SM modules @<:@enabled@:>@])],
,
[enable_sm="yes"]
)
AC_ARG_ENABLE(
[man],
[AS_HELP_STRING([--disable-man],[disable installation of manuals @<:@enabled for none Windows@:>@])],
,
[enable_man="detect"]
)
AC_ARG_ENABLE(
[doc],
[AS_HELP_STRING([--enable-doc],[enable installation of documents @<:@disabled@:>@])],
,
[enable_doc="no"]
)
AC_ARG_ENABLE(
[dnie-ui],
[AS_HELP_STRING([--enable-dnie-ui],[enable use of external user interface program to request DNIe pin@<:@disabled@:>@])],
,
[enable_dnie_ui="no"]
)
AC_ARG_WITH(
[xsl-stylesheetsdir],
[AS_HELP_STRING([--with-xsl-stylesheetsdir=PATH],[docbook xsl-stylesheets for svn build @<:@detect@:>@])],
[xslstylesheetsdir="${withval}"],
[xslstylesheetsdir="detect"]
)
AC_ARG_WITH(
[pcsc-provider],
[AS_HELP_STRING([--with-pcsc-provider=PATH],[Path to system pcsc provider @<:@system default@:>@])],
,
[with_pcsc_provider="detect"]
)
AC_ARG_WITH(
[pkcs11-provider],
[AS_HELP_STRING([--with-pkcs11-provider=PATH],[Path to the default PKCS11 provider @<:@default=OpenSC@:>@])],
,
[with_pkcs11_provider="detect"]
)
dnl ./configure check
reader_count=""
for rdriver in "${enable_pcsc}" "${enable_openct}" "${enable_ctapi}"; do
test "${rdriver}" = "yes" && reader_count="${reader_count}x"
done
if test "${reader_count}" != "x"; then
AC_MSG_ERROR([Only one of --enable-pcsc, --enable-openct, --enable-ctapi can be specified!])
fi
dnl Checks for programs.
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_SED
AC_PROG_MAKE_SET
dnl Add libtool support.
ifdef(
[LT_INIT],
[
LT_INIT([win32-dll])
LT_LANG([Windows Resource])
],
[
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_RC
AC_PROG_LIBTOOL
]
)
dnl These required for repository checkout
AC_ARG_VAR([XSLTPROC], [xsltproc utility])
AC_ARG_VAR([git], [git])
AC_CHECK_PROGS([XSLTPROC],[xsltproc])
AC_CHECK_PROGS([GIT],[git])
AC_MSG_CHECKING([xsl-stylesheets])
if test "${xslstylesheetsdir}" = "detect"; then
xslstylesheetsdir="no"
for f in \
/usr/share/xml/docbook/stylesheet/nwalsh \
/usr/share/xml/docbook/stylesheet/nwalsh/current \
/opt/local/share/xsl/docbook-xsl \
/sw/share/xml/xsl/docbook-xsl \
/usr/share/sgml/docbook/*; do
test -e "${f}/html/docbook.xsl" && xslstylesheetsdir="${f}"
done
elif test "${xslstylesheetsdir}" != "no"; then
test -e "${xslstylesheetsdir}/html/docbook.xsl" || AC_MSG_ERROR([invalid])
fi
AC_MSG_RESULT([${xslstylesheetsdir}])
AC_MSG_CHECKING([git checkout])
GIT_CHECKOUT="no"
if test -n "${GIT}" -a -d "${srcdir}/.git"; then
AC_DEFINE([HAVE_CONFIG_VERSION_H], [1], [extra version available in config-version.h])
GIT_CHECKOUT="yes"
fi
AC_MSG_RESULT([${GIT_CHECKOUT}])
dnl C Compiler features
AC_C_INLINE
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_ASSERT
AC_CHECK_HEADERS([ \
errno.h fcntl.h stdlib.h \
inttypes.h string.h strings.h \
sys/time.h unistd.h getopt.h sys/mman.h
])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([ \
getpass gettimeofday memset mkdir \
strdup strerror getopt_long getopt_long_only \
strlcpy strlcat
])
AC_CHECK_SIZEOF(void *)
if test "${ac_cv_sizeof_void_p}" = 8; then
LIBRARY_BITNESS="64"
else
LIBRARY_BITNESS="32"
fi
dnl See if socket() is found from libsocket
AC_CHECK_LIB(
[socket],
[socket],
[
LIBS="${LIBS} -lsocket"
AC_CHECK_LIB(
[resolv],
[res_query],
[LIBS="${LIBS} -lresolv"]
)
]
)
if test "${WIN32}" = "no"; then
dnl dl support
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
dnl Special check for pthread support.
AX_PTHREAD(
[AC_DEFINE(
[HAVE_PTHREAD],
[1],
[Define if you have POSIX threads libraries and header files.]
)],
[AC_MSG_ERROR([POSIX thread support required])]
)
CC="${PTHREAD_CC}"
fi
if test "${enable_thread_locking}" = "yes"; then
CPPFLAGS="${CPPFLAGS} -DPKCS11_THREAD_LOCKING"
fi
if test "${enable_minidriver}" = "yes"; then
dnl win32 special test for minidriver
AC_CHECK_HEADER(
[cardmod.h],
,
[AC_MSG_ERROR([cardmod.h is not found and required for minidriver])]
)
AC_DEFINE([ENABLE_MINIDRIVER], [1], [Enable minidriver support])
fi
if test "${enable_dnie_ui}" = "yes"; then
AC_DEFINE([ENABLE_DNIE_UI], [1], [Enable the use of external user interface program to request DNIe user pin])
case "${host}" in
*-apple-*)
if test "${enable_dnie_ui}" = "yes"; then
LDFLAGS="${LDFLAGS} -framework Carbon"
fi
;;
esac
fi
AC_ARG_VAR([ZLIB_CFLAGS], [C compiler flags for zlib])
AC_ARG_VAR([ZLIB_LIBS], [linker flags for zlib])
if test -z "${ZLIB_LIBS}"; then
AC_CHECK_LIB(
[z],
[inflate],
[ZLIB_LIBS="-lz"]
)
fi
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${ZLIB_CFLAGS}"
AC_CHECK_HEADERS([zlib.h])
CFLAGS="${saved_CFLAGS}"
test -n "${ZLIB_LIBS}" -a "${ac_cv_header_zlib_h}" = "yes" && have_zlib="yes"
case "${enable_zlib}" in
no)
have_zlib="no"
;;
detect)
if test "${have_zlib}" = "yes"; then
enable_zlib="yes"
else
enable_zlib="no"
fi
;;
esac
if test "${enable_zlib}" = "yes"; then
if test "${have_zlib}" = "yes"; then
AC_DEFINE([ENABLE_ZLIB], [1], [Use zlib libraries and header files])
else
AC_MSG_ERROR([zlib linkage required, but no zlib was found])
fi
fi
AC_ARG_VAR([READLINE_CFLAGS], [C compiler flags for readline])
AC_ARG_VAR([READLINE_LIBS], [linker flags for readline])
if test -z "${READLINE_LIBS}"; then
for l in "" -lncurses -ltermcap; do
unset ac_cv_lib_readline_readline
AC_CHECK_LIB(
[readline],
[readline],
[READLINE_LIBS="-lreadline ${l}"],
,
["${l}"]
)
test -n "${READLINE_LIBS}" && break;
done
fi
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${READLINE_CFLAGS}"
AC_CHECK_HEADERS([readline/readline.h])
CFLAGS="${saved_CFLAGS}"
test -n "${READLINE_LIBS}" -a "${ac_cv_header_readline_readline_h}" = "yes" && have_readline="yes"
case "${enable_readline}" in
no)
have_readline="no"
;;
detect)
if test "${have_readline}" = "yes"; then
enable_readline="yes"
else
enable_readline="no"
fi
;;
esac
if test "${enable_readline}" = "yes"; then
if test "${have_readline}" = "yes"; then
AC_DEFINE([ENABLE_READLINE], [1], [Use readline libraries and header files])
else
AC_MSG_ERROR([readline linkage required, but no readline was found])
fi
fi
PKG_CHECK_MODULES(
[OPENSSL],
[libcrypto >= 0.9.7],
[have_openssl="yes"],
[PKG_CHECK_MODULES(
[OPENSSL],
[openssl >= 0.9.7],
[have_openssl="yes"],
[AC_CHECK_LIB(
[crypto],
[RSA_version],
[
have_openssl="yes"
OPENSSL_LIBS="-lcrypto"
],
[have_openssl="no"]
)]
)]
)
case "${enable_openssl}" in
no)
have_openssl="no"
;;
detect)
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
AC_CHECK_HEADERS([openssl/crypto.h],,[have_openssl="no"])
CFLAGS="${saved_CFLAGS}"
if test "${have_openssl}" = "yes"; then
enable_openssl="yes"
else
enable_openssl="no"
fi
;;
esac
if test "${enable_openssl}" = "yes"; then
if test "${have_openssl}" = "yes"; then
AC_DEFINE([ENABLE_OPENSSL], [1], [Have OpenSSL libraries and header files])
else
AC_MSG_ERROR([OpenSSL linkage required, but no OpenSSL was found])
fi
else
OPENSSL_CFLAGS=""
OPENSSL_LIBS=""
fi
if test "${enable_sm}" = "yes"; then
AC_DEFINE([ENABLE_SM], [1], [Enable secure messaging support])
case "${host}" in
*-mingw*|*-winnt*|*-cygwin*)
DEFAULT_SM_MODULE="smm-local.dll"
DEFAULT_SM_MODULE_PATH="\# module_path = \"\";"
;;
*-apple-*)
DEFAULT_SM_MODULE="libsmm-local.3.dylib"
DEFAULT_SM_MODULE_PATH="module_path = \$(libdir);"
;;
*)
DEFAULT_SM_MODULE="libsmm-local.so.3"
DEFAULT_SM_MODULE_PATH="module_path = \$(libdir);"
;;
esac
AC_DEFINE_UNQUOTED([DEFAULT_SM_MODULE], ["${DEFAULT_SM_MODULE}"], [Default SM module])
AC_DEFINE_UNQUOTED([DEFAULT_SM_MODULE_PATH], ["${DEFAULT_SM_MODULE_PATH}"], [Default SM module path])
fi
if test "${enable_openct}" = "yes"; then
PKG_CHECK_MODULES(
[OPENCT],
[libopenct],
[AC_DEFINE([ENABLE_OPENCT], [1], [Have OpenCT libraries and header files])],
[AC_MSG_ERROR([openct requested but not available])]
)
fi
if test "${enable_ctapi}" = "yes"; then
AC_DEFINE([ENABLE_CTAPI], [1], [Enable CT-API support])
fi
if test "${enable_pcsc}" = "yes"; then
if test "${WIN32}" != "yes"; then
PKG_CHECK_EXISTS(
[libpcsclite],
[PKG_CHECK_MODULES([PCSC], [libpcsclite])]
)
if test -z "${PCSC_CFLAGS}"; then
case "${host}" in
*-*-darwin*)
# Locate the latest SDK.
SDKS_PATH="$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs"
if test -d $SDKS_PATH; then
SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -t. -k2 -r | head -1)}"
PCSC_CFLAGS="-I$SDK_PATH/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers"
else
PCSC_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers"
fi
;;
*)
PCSC_CFLAGS="-I/usr/include/PCSC"
;;
esac
fi
fi
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${PCSC_CFLAGS}"
# We must cope with mingw32 that does not have winscard.h mingw64 has it.
AC_CHECK_HEADERS([winscard.h],,[test "${WIN32}" != "yes" && AC_MSG_ERROR([winscard.h is required for pcsc])])
AC_CHECK_HEADERS([pcsclite.h])
CFLAGS="${saved_CFLAGS}"
if test "${with_pcsc_provider}" = "detect"; then
case "${host}" in
*-*-darwin*)
DEFAULT_PCSC_PROVIDER="/System/Library/Frameworks/PCSC.framework/PCSC"
;;
*-mingw*|*-winnt*|*-cygwin*)
DEFAULT_PCSC_PROVIDER="winscard.dll"
;;
*)
DEFAULT_PCSC_PROVIDER="libpcsclite.so.1"
;;
esac
else
DEFAULT_PCSC_PROVIDER="${with_pcsc_provider}"
fi
AC_DEFINE_UNQUOTED([DEFAULT_PCSC_PROVIDER], ["${DEFAULT_PCSC_PROVIDER}"], [Default PC/SC provider])
AC_DEFINE([ENABLE_PCSC], [1], [Define if PC/SC is to be enabled])
fi
if test "${with_pkcs11_provider}" = "detect"; then
case "${host}" in
*-*-darwin*)
DEFAULT_PKCS11_PROVIDER="opensc-pkcs11.so"
;;
*-mingw*|*-winnt*|*-cygwin*)
DEFAULT_PKCS11_PROVIDER="opensc-pkcs11.dll"
;;
*)
DEFAULT_PKCS11_PROVIDER="opensc-pkcs11.so"
;;
esac
else
DEFAULT_PKCS11_PROVIDER="${with_pkcs11_provider}"
fi
AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_PROVIDER], ["${DEFAULT_PKCS11_PROVIDER}"], [Default PKCS11 provider])
if test "${enable_man}" = "detect"; then
if test "${WIN32}" = "yes"; then
enable_man="no"
elif test -n "${XSLTPROC}" -a "${xslstylesheetsdir}" != "no"; then
enable_man="yes"
else
enable_man="no"
fi
fi
if test "${enable_man}" = "yes" -o "${enable_doc}" = "yes"; then
AC_MSG_CHECKING([XSLTPROC requirement])
test -n "${XSLTPROC}" || AC_MSG_ERROR([Missing XSLTPROC])
test "${xslstylesheetsdir}" != "no" || AC_MSG_ERROR([Missing xslstylesheetsdir])
AC_MSG_RESULT([ok])
fi
OPENSC_FEATURES=""
if test "${enable_thread_locking}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} locking"
fi
if test "${enable_zlib}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} zlib"
OPTIONAL_ZLIB_CFLAGS="${ZLIB_CFLAGS}"
OPTIONAL_ZLIB_LIBS="${ZLIB_LIBS}"
fi
if test "${enable_readline}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} readline"
OPTIONAL_READLINE_CFLAGS="${READLINE_CFLAGS}"
OPTIONAL_READLINE_LIBS="${READLINE_LIBS}"
fi
if test "${enable_openssl}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} openssl"
OPTIONAL_OPENSSL_CFLAGS="${OPENSSL_CFLAGS}"
OPTIONAL_OPENSSL_LIBS="${OPENSSL_LIBS}"
fi
if test "${enable_openct}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} openct"
OPTIONAL_OPENCT_CFLAGS="${OPENCT_CFLAGS}"
OPTIONAL_OPENCT_LIBS="${OPENCT_LIBS}"
fi
if test "${enable_pcsc}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} pcsc(${DEFAULT_PCSC_PROVIDER})"
OPTIONAL_PCSC_CFLAGS="${PCSC_CFLAGS}"
fi
if test "${enable_ctapi}" = "yes"; then
OPENSC_FEATURES="${OPENSC_FEATURES} ctapi"
fi
AC_DEFINE_UNQUOTED([OPENSC_VERSION_MAJOR], [${OPENSC_VERSION_MAJOR}], [OpenSC version major component])
AC_DEFINE_UNQUOTED([OPENSC_VERSION_MINOR], [${OPENSC_VERSION_MINOR}], [OpenSC version minor component])
AC_DEFINE_UNQUOTED([OPENSC_VERSION_FIX], [${OPENSC_VERSION_FIX}], [OpenSC version fix component])
AC_DEFINE_UNQUOTED([OPENSC_VERSION_REVISION], [${OPENSC_VERSION_REVISION}], [OpenSC version Git describe revision])
AC_DEFINE_UNQUOTED([OPENSC_FEATURES], ["${OPENSC_FEATURES}"], [Enabled OpenSC features])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_LEGAL_COPYRIGHT], [${OPENSC_VS_FF_LEGAL_COPYRIGHT}], [OpenSC version-info LegalCopyright value])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_COMPANY_NAME], [${OPENSC_VS_FF_COMPANY_NAME}], [OpenSC version-info CompanyName value])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_COMMENTS], [${OPENSC_VS_FF_COMMENTS}], [OpenSC version-info Comments])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_PRODUCT_NAME], [${OPENSC_VS_FF_PRODUCT_NAME}], [OpenSC version-info ProductName])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_PRODUCT_UPDATES], [${OPENSC_VS_FF_PRODUCT_UPDATES}], [OpenSC version-info UpdateURL])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_PRODUCT_URL], [${OPENSC_VS_FF_PRODUCT_URL}], [OpenSC version-info ProductURL])
AC_DEFINE_UNQUOTED([OPENSC_VS_FF_COMPANY_URL], [${OPENSC_VS_FF_COMPANY_URL}], [OpenSC version-info UpdateURL])
pkcs11dir="\$(libdir)/pkcs11"
AC_SUBST([pkcs11dir])
AC_SUBST([xslstylesheetsdir])
AC_SUBST([OPENSC_VERSION_MAJOR])
AC_SUBST([OPENSC_VERSION_MINOR])
AC_SUBST([OPENSC_VERSION_FIX])
AC_SUBST([OPENSC_VERSION_REVISION])
AC_SUBST([OPENSC_VS_FF_LEGAL_COPYRIGHT])
AC_SUBST([OPENSC_VS_FF_COMPANY_NAME])
AC_SUBST([OPENSC_VS_FF_COMMENTS])
AC_SUBST([OPENSC_VS_FF_PRODUCT_NAME])
AC_SUBST([OPENSC_VS_FF_PRODUCT_UPDATES])
AC_SUBST([OPENSC_VS_FF_PRODUCT_URL])
AC_SUBST([OPENSC_VS_FF_COMPANY_URL])
AC_SUBST([OPENSC_LT_CURRENT])
AC_SUBST([OPENSC_LT_REVISION])
AC_SUBST([OPENSC_LT_AGE])
AC_SUBST([OPENSC_LT_OLDEST])
AC_SUBST([WIN_LIBPREFIX])
AC_SUBST([DEFAULT_PCSC_PROVIDER])
AC_SUBST([DEFAULT_PKCS11_PROVIDER])
AC_SUBST([OPTIONAL_ZLIB_CFLAGS])
AC_SUBST([OPTIONAL_ZLIB_LIBS])
AC_SUBST([OPTIONAL_READLINE_CFLAGS])
AC_SUBST([OPTIONAL_READLINE_LIBS])
AC_SUBST([OPTIONAL_OPENSSL_CFLAGS])
AC_SUBST([OPTIONAL_OPENSSL_LIBS])
AC_SUBST([OPTIONAL_OPENCT_CFLAGS])
AC_SUBST([OPTIONAL_OPENCT_LIBS])
AC_SUBST([OPTIONAL_PCSC_CFLAGS])
AC_SUBST([LIBRARY_BITNESS])
AC_SUBST([DEFAULT_SM_MODULE])
AC_SUBST([DEFAULT_SM_MODULE_PATH])
AC_SUBST([DEBUG_FILE])
AC_SUBST([PROFILE_DIR])
AC_SUBST([PROFILE_DIR_DEFAULT])
AM_CONDITIONAL([ENABLE_MAN], [test "${enable_man}" = "yes"])
AM_CONDITIONAL([ENABLE_THREAD_LOCKING], [test "${enable_thread_locking}" = "yes"])
AM_CONDITIONAL([ENABLE_ZLIB], [test "${enable_zlib}" = "yes"])
AM_CONDITIONAL([ENABLE_READLINE], [test "${enable_readline}" = "yes"])
AM_CONDITIONAL([ENABLE_OPENSSL], [test "${enable_openssl}" = "yes"])
AM_CONDITIONAL([ENABLE_OPENCT], [test "${enable_openct}" = "yes"])
AM_CONDITIONAL([ENABLE_DOC], [test "${enable_doc}" = "yes"])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AM_CONDITIONAL([CYGWIN], [test "${CYGWIN}" = "yes"])
AM_CONDITIONAL([ENABLE_MINIDRIVER], [test "${enable_minidriver}" = "yes"])
AM_CONDITIONAL([ENABLE_SM], [test "${enable_sm}" = "yes"])
AM_CONDITIONAL([ENABLE_DNIE_UI], [test "${enable_dnie_ui}" = "yes"])
AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"])
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes";
CFLAGS="${CFLAGS} -pedantic -Wextra"
fi
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wextra -Wno-unused-parameter"
fi
if test "$GCC" = "yes"; then
# This should be resolved not ignored.
CFLAGS="-fno-strict-aliasing ${CFLAGS}"
fi
CFLAGS="${CFLAGS} -Werror=declaration-after-statement"
AC_CONFIG_FILES([
Makefile
doc/Makefile
doc/tools/Makefile
etc/Makefile
src/Makefile
src/common/Makefile
src/libopensc/Makefile
src/libopensc/libopensc.pc
src/libsm/Makefile
src/pkcs11/Makefile
src/pkcs11/versioninfo-pkcs11.rc
src/pkcs11/versioninfo-pkcs11-spy.rc
src/pkcs15init/Makefile
src/scconf/Makefile
src/tests/Makefile
src/tests/regression/Makefile
src/tools/Makefile
src/tools/versioninfo-tools.rc
src/smm/Makefile
src/minidriver/Makefile
src/minidriver/versioninfo-minidriver.rc
src/minidriver/opensc-minidriver.inf
win32/Makefile
win32/versioninfo.rc
win32/versioninfo-customactions.rc
win32/winconfig.h
win32/OpenSC.iss
win32/OpenSC.wxs
MacOSX/Makefile
MacOSX/build-package
MacOSX/Distribution.xml
MacOSX/resources/ReadMe.html
MacOSX/resources/Welcome.html
])
AC_OUTPUT
cat <<EOF
OpenSC has been configured with the following options:
Version: ${PACKAGE_VERSION}
Version fix: ${OPENSC_VERSION_FIX}
Version revision: ${OPENSC_VERSION_REVISION}
Copyright: ${OPENSC_VS_FF_LEGAL_COPYRIGHT}
Company: ${OPENSC_VS_FF_COMPANY_NAME}
Company URL: ${OPENSC_VS_FF_COMPANY_URL}
Comments: ${OPENSC_VS_FF_COMMENTS}
Product name: ${OPENSC_VS_FF_PRODUCT_NAME}
Product updates: ${OPENSC_VS_FF_PRODUCT_UPDATES}
Product URL: ${OPENSC_VS_FF_PRODUCT_URL}
User binaries: $(eval eval eval echo "${bindir}")
Configuration files: $(eval eval eval echo "${sysconfdir}")
XSL stylesheets: ${xslstylesheetsdir}
man support: ${enable_man}
doc support: ${enable_doc}
thread locking support: ${enable_thread_locking}
zlib support: ${enable_zlib}
readline support: ${enable_readline}
OpenSSL support: ${enable_openssl}
PC/SC support: ${enable_pcsc}
OpenCT support: ${enable_openct}
CT-API support: ${enable_ctapi}
minidriver support: ${enable_minidriver}
SM support: ${enable_sm}
SM default module: ${DEFAULT_SM_MODULE}
DNIe UI support: ${enable_dnie_ui}
Debug file: ${DEBUG_FILE}
PC/SC default provider: ${DEFAULT_PCSC_PROVIDER}
PKCS11 default provider: ${DEFAULT_PKCS11_PROVIDER}
Host: ${host}
Compiler: ${CC}
Preprocessor flags: ${CPPFLAGS}
Compiler flags: ${CFLAGS}
Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
READLINE_CFLAGS: ${READLINE_CFLAGS}
READLINE_LIBS: ${READLINE_LIBS}
ZLIB_CFLAGS: ${ZLIB_CFLAGS}
ZLIB_LIBS: ${ZLIB_LIBS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
OPENCT_CFLAGS: ${OPENCT_CFLAGS}
OPENCT_LIBS: ${OPENCT_LIBS}
PCSC_CFLAGS: ${PCSC_CFLAGS}
EOF