Import from 1.9a8 tarball
[mozilla-nss.git] / security / nss / tests / pkcs11 / netscape / trivial / configure.in
blob8a1405a8d957994b2d76018cc5fd1d901bc93fe1
1 dnl
2 dnl ***** BEGIN LICENSE BLOCK *****
3 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 dnl
5 dnl The contents of this file are subject to the Mozilla Public License Version
6 dnl 1.1 (the "License"); you may not use this file except in compliance with
7 dnl the License. You may obtain a copy of the License at
8 dnl http://www.mozilla.org/MPL/
9 dnl
10 dnl Software distributed under the License is distributed on an "AS IS" basis,
11 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 dnl for the specific language governing rights and limitations under the
13 dnl License.
14 dnl
15 dnl The Original Code is a trivial PKCS#11 test program.
16 dnl
17 dnl The Initial Developer of the Original Code is
18 dnl Netscape Communications Corp.
19 dnl Portions created by the Initial Developer are Copyright (C) 2000
20 dnl the Initial Developer. All Rights Reserved.
21 dnl
22 dnl Contributor(s):
23 dnl
24 dnl Alternatively, the contents of this file may be used under the terms of
25 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
26 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 dnl in which case the provisions of the GPL or the LGPL are applicable instead
28 dnl of those above. If you wish to allow use of your version of this file only
29 dnl under the terms of either the GPL or the LGPL, and not to allow others to
30 dnl use your version of this file under the terms of the MPL, indicate your
31 dnl decision by deleting the provisions above and replace them with the notice
32 dnl and other provisions required by the GPL or the LGPL. If you do not delete
33 dnl the provisions above, a recipient may use your version of this file under
34 dnl the terms of any one of the MPL, the GPL or the LGPL.
35 dnl
36 dnl ***** END LICENSE BLOCK *****
38 dnl My revision info: "@(#) $RCSfile: configure.in,v $ $Revision: 1.3 $ $Date: 2006/03/02 22:48:55 $"
39 dnl Don't use AC_REVISION; it's broken
41 AC_INIT(trivial.c)
42 AC_CONFIG_HEADER(config.h)
43 AC_PROG_MAKE_SET
45 AC_ARG_WITH(nspr, [  --with-nspr[=path]      specify location of NSPR],
46 [ case "$withval" in
47   no)
48     AC_MSG_ERROR(NSPR is required);;
49   yes)
50     NSPR_INCLUDE="$includedir"
51     NSPR_LIBPATH="$libdir"
52     ;;
53   *)
54     NSPR_INCLUDE="$withval/include"
55     NSPR_LIBPATH="$withval/lib"
56     ;;
57   esac ],
58 [ NSPR_INCLUDE="$includedir"
59   NSPR_LIBPATH="$libdir" ]
62 NSPR_CFLAGS="-I$NSPR_INCLUDE"
63 NSPR_LDFLAGS="-L$NSPR_LIBPATH -lnspr4 -lplc4 -lplds4"
65 dnl This isn't optimum, but the mozilla build system and autoconf don't really mesh well..
67 AC_ARG_WITH(nss-dist,    [  --with-nss-dist[=path]  specify path to NSS dist directory],
68 [ case "$withval" in
69   no)
70     NSS_CFLAGS=""
71     nss="0"
72     ;;
73   yes)
74     AC_MSG_ERROR(You have to specify a path for --with-nss-dist)
75     ;;
76   *)
77     NSS_CFLAGS="-I$withval/private/security -I$withval/public/security"
78     nss="1"
79     ;;
80   esac ])
82 AC_ARG_WITH(nss-hdrs, [  --with-nss-hdrs[=path]  or, specify path to installed NSS headers],
83 [ if test "x$nss" != "x"; then
84     AC_MSG_ERROR(Only specify --with-nss-hdrs or --with-nss-dist, not both)
85   fi
86   case "$withval" in
87   no)
88     NSS_CFLAGS=""
89     nss="0"
90     ;;
91   yes)
92     NSS_CFLAGS="-I$includedir"
93     nss="1"
94     ;;
95   *)
96     NSS_CFLAGS="-I$withval"
97     nss="1"
98     ;;
99   esac ])
101 AC_ARG_WITH(rsa-hdrs, [  --with-rsa-hdrs[=path]  if not using NSS, specify path to RSA headers],
102 [ if test "x$nss" != "x"; then
103     AC_MSG_ERROR(Only specify --with-nss-{hdrs,dist} or --with-rsa-hdrs, not both)
104   fi
105   case "$withval" in
106   no)
107     rsa="0"
108     ;;
109   yes)
110     RSA_INCLUDE="$includedir"
111     rsa="1"
112     ;;
113   *)
114     RSA_INCLUDE="$withval"
115     rsa="1"
116     ;;
117   esac ])
119 if test "x$nss" = "x"; then
120   if test "x$rsa" = "x"; then
121     RSA_INCLUDE="$includedir"
122   fi
123   RSA_CFLAGS="-I$RSA_INCLUDE"
126 if test "x$nss" = "x1"; then
127   AC_DEFINE(WITH_NSS,1)
130 AC_SUBST(WITH_NSS)
132 if test "x$rsa" = "x1"; then
133   RSA_CFLAGS-"-I$RSA_INCLUDE"
136 AC_ARG_ENABLE(debug, [  --disable-debug         default is enabled],
137 [ case "$enableval" in
138   no)
139     DEBUG_CFLAGS="";;
140   yes)
141     DEBUG_CFLAGS="-DDEBUG";;
142   *)
143     DEBUG_CFLAGS="-DDEBUG";;
144   esac ], DEBUG_CFLAGS="-DDEBUG")
146 dnl Checks for programs.
147 AC_PROG_CC
148 AC_PROG_CPP
149 AC_PROG_INSTALL
150 AC_PROG_RANLIB
151 AC_CHECK_PROG(AR, ar, ar)
152 AC_CHECK_PROG(LD, ld, ld)
153 AC_CHECK_PROG(RM, rm, rm)
154 AC_CHECK_PROG(TAR, tar, tar)
155 AC_SUBST(CC INSTALL RANLIB AR LD RM TAR)
157 CPPFLAGS="$CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $RSA_CFLAGS $DEBUG_CFLAGS"
158 LIBS="$NSPR_LDFLAGS $LIBS"
160 AC_SUBST(CFLAGS)
162 dnl Checks for libraries.
163 AC_CHECK_LIB(nspr4, PR_Init)
165 dnl Checks for header files.
166 AC_CHECK_HEADERS(nspr.h)
167 AC_SUBST(HAVE_NSPR_H)
169 if test "x$nss" = "x1"; then
170   AC_CHECK_HEADERS(ck.h)
173 if test "x$rsa" = "x1"; then
174   AC_CHECK_HEADERS(pkcs11t.h pkcs11.h)
177 AC_SUBST(HAVE_CK_H HAVE_PKCS11T_H HAVE_PKCS11_H)
179 dnl Checks for typedefs, structures, and compiler characteristics.
180 AC_C_CONST
181 AC_SUBST(const)
183 AC_CHECK_FUNCS(memset strlen)
184 AC_SUBST(HAVE_MEMSET HAVE_STRLEN)
185 AC_OUTPUT(Makefile, [echo timestamp > stamp-h])