Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 dnl
2 dnl This Source Code Form is subject to the terms of the Mozilla Public
3 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
4 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 AC_INIT(trivial.c)
7 AC_CONFIG_HEADER(config.h)
8 AC_PROG_MAKE_SET
10 AC_ARG_WITH(nspr, [ --with-nspr[=path] specify location of NSPR],
11 [ case "$withval" in
12 no)
13 AC_MSG_ERROR(NSPR is required);;
14 yes)
15 NSPR_INCLUDE="$includedir"
16 NSPR_LIBPATH="$libdir"
17 ;;
18 *)
19 NSPR_INCLUDE="$withval/include"
20 NSPR_LIBPATH="$withval/lib"
21 ;;
22 esac ],
23 [ NSPR_INCLUDE="$includedir"
24 NSPR_LIBPATH="$libdir" ]
25 )
27 NSPR_CFLAGS="-I$NSPR_INCLUDE"
28 NSPR_LDFLAGS="-L$NSPR_LIBPATH -lnspr4 -lplc4 -lplds4"
30 dnl This isn't optimum, but the mozilla build system and autoconf don't really mesh well..
32 AC_ARG_WITH(nss-dist, [ --with-nss-dist[=path] specify path to NSS dist directory],
33 [ case "$withval" in
34 no)
35 NSS_CFLAGS=""
36 nss="0"
37 ;;
38 yes)
39 AC_MSG_ERROR(You have to specify a path for --with-nss-dist)
40 ;;
41 *)
42 NSS_CFLAGS="-I$withval/private/security -I$withval/public/security"
43 nss="1"
44 ;;
45 esac ])
47 AC_ARG_WITH(nss-hdrs, [ --with-nss-hdrs[=path] or, specify path to installed NSS headers],
48 [ if test "x$nss" != "x"; then
49 AC_MSG_ERROR(Only specify --with-nss-hdrs or --with-nss-dist, not both)
50 fi
51 case "$withval" in
52 no)
53 NSS_CFLAGS=""
54 nss="0"
55 ;;
56 yes)
57 NSS_CFLAGS="-I$includedir"
58 nss="1"
59 ;;
60 *)
61 NSS_CFLAGS="-I$withval"
62 nss="1"
63 ;;
64 esac ])
66 AC_ARG_WITH(rsa-hdrs, [ --with-rsa-hdrs[=path] if not using NSS, specify path to RSA headers],
67 [ if test "x$nss" != "x"; then
68 AC_MSG_ERROR(Only specify --with-nss-{hdrs,dist} or --with-rsa-hdrs, not both)
69 fi
70 case "$withval" in
71 no)
72 rsa="0"
73 ;;
74 yes)
75 RSA_INCLUDE="$includedir"
76 rsa="1"
77 ;;
78 *)
79 RSA_INCLUDE="$withval"
80 rsa="1"
81 ;;
82 esac ])
84 if test "x$nss" = "x"; then
85 if test "x$rsa" = "x"; then
86 RSA_INCLUDE="$includedir"
87 fi
88 RSA_CFLAGS="-I$RSA_INCLUDE"
89 fi
91 if test "x$nss" = "x1"; then
92 AC_DEFINE(WITH_NSS,1)
93 fi
95 AC_SUBST(WITH_NSS)
97 if test "x$rsa" = "x1"; then
98 RSA_CFLAGS-"-I$RSA_INCLUDE"
99 fi
101 AC_ARG_ENABLE(debug, [ --disable-debug default is enabled],
102 [ case "$enableval" in
103 no)
104 DEBUG_CFLAGS="";;
105 yes)
106 DEBUG_CFLAGS="-DDEBUG";;
107 *)
108 DEBUG_CFLAGS="-DDEBUG";;
109 esac ], DEBUG_CFLAGS="-DDEBUG")
111 dnl Checks for programs.
112 AC_PROG_CC
113 AC_PROG_CPP
114 AC_PROG_INSTALL
115 AC_PROG_RANLIB
116 AC_CHECK_PROG(AR, ar, ar)
117 AC_CHECK_PROG(LD, ld, ld)
118 AC_CHECK_PROG(RM, rm, rm)
119 AC_CHECK_PROG(TAR, tar, tar)
120 AC_SUBST(CC INSTALL RANLIB AR LD RM TAR)
122 CPPFLAGS="$CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $RSA_CFLAGS $DEBUG_CFLAGS"
123 LIBS="$NSPR_LDFLAGS $LIBS"
125 AC_SUBST(CFLAGS)
127 dnl Checks for libraries.
128 AC_CHECK_LIB(nspr4, PR_Init)
130 dnl Checks for header files.
131 AC_CHECK_HEADERS(nspr.h)
132 AC_SUBST(HAVE_NSPR_H)
134 if test "x$nss" = "x1"; then
135 AC_CHECK_HEADERS(ck.h)
136 fi
138 if test "x$rsa" = "x1"; then
139 AC_CHECK_HEADERS(pkcs11t.h pkcs11.h)
140 fi
142 AC_SUBST(HAVE_CK_H HAVE_PKCS11T_H HAVE_PKCS11_H)
144 dnl Checks for typedefs, structures, and compiler characteristics.
145 AC_C_CONST
146 AC_SUBST(const)
148 AC_CHECK_FUNCS(memset strlen)
149 AC_SUBST(HAVE_MEMSET HAVE_STRLEN)
150 AC_OUTPUT(Makefile, [echo timestamp > stamp-h])