summaryrefslogtreecommitdiff
path: root/security/nss/tests/pkcs11/netscape/trivial/configure.in
blob: 62950b97a65867720b264ddee1fecff71b4d5f7b (plain)
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
dnl
dnl ***** BEGIN LICENSE BLOCK *****
dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
dnl
dnl The contents of this file are subject to the Mozilla Public License Version
dnl 1.1 (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl http://www.mozilla.org/MPL/
dnl
dnl Software distributed under the License is distributed on an "AS IS" basis,
dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
dnl for the specific language governing rights and limitations under the
dnl License.
dnl
dnl The Original Code is a trivial PKCS#11 test program.
dnl
dnl The Initial Developer of the Original Code is
dnl Netscape Communications Corp.
dnl Portions created by the Initial Developer are Copyright (C) 2000
dnl the Initial Developer. All Rights Reserved.
dnl
dnl Contributor(s):
dnl
dnl Alternatively, the contents of this file may be used under the terms of
dnl either the GNU General Public License Version 2 or later (the "GPL"), or
dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
dnl in which case the provisions of the GPL or the LGPL are applicable instead
dnl of those above. If you wish to allow use of your version of this file only
dnl under the terms of either the GPL or the LGPL, and not to allow others to
dnl use your version of this file under the terms of the MPL, indicate your
dnl decision by deleting the provisions above and replace them with the notice
dnl and other provisions required by the GPL or the LGPL. If you do not delete
dnl the provisions above, a recipient may use your version of this file under
dnl the terms of any one of the MPL, the GPL or the LGPL.
dnl
dnl ***** END LICENSE BLOCK *****

dnl My revision info: "@(#) $RCSfile$ $Revision$ $Date$"
dnl Don't use AC_REVISION; it's broken

AC_INIT(trivial.c)
AC_CONFIG_HEADER(config.h)
AC_PROG_MAKE_SET

AC_ARG_WITH(nspr, [  --with-nspr[=path]      specify location of NSPR],
[ case "$withval" in
  no)
    AC_MSG_ERROR(NSPR is required);;
  yes)
    NSPR_INCLUDE="$includedir"
    NSPR_LIBPATH="$libdir"
    ;;
  *)
    NSPR_INCLUDE="$withval/include"
    NSPR_LIBPATH="$withval/lib"
    ;;
  esac ],
[ NSPR_INCLUDE="$includedir"
  NSPR_LIBPATH="$libdir" ]
)

NSPR_CFLAGS="-I$NSPR_INCLUDE"
NSPR_LDFLAGS="-L$NSPR_LIBPATH -lnspr4 -lplc4 -lplds4"

dnl This isn't optimum, but the mozilla build system and autoconf don't really mesh well..

AC_ARG_WITH(nss-dist,    [  --with-nss-dist[=path]  specify path to NSS dist directory],
[ case "$withval" in
  no)
    NSS_CFLAGS=""
    nss="0"
    ;;
  yes)
    AC_MSG_ERROR(You have to specify a path for --with-nss-dist)
    ;;
  *)
    NSS_CFLAGS="-I$withval/private/security -I$withval/public/security"
    nss="1"
    ;;
  esac ])

AC_ARG_WITH(nss-hdrs, [  --with-nss-hdrs[=path]  or, specify path to installed NSS headers],
[ if test "x$nss" != "x"; then
    AC_MSG_ERROR(Only specify --with-nss-hdrs or --with-nss-dist, not both)
  fi
  case "$withval" in
  no)
    NSS_CFLAGS=""
    nss="0"
    ;;
  yes)
    NSS_CFLAGS="-I$includedir"
    nss="1"
    ;;
  *)
    NSS_CFLAGS="-I$withval"
    nss="1"
    ;;
  esac ])

AC_ARG_WITH(rsa-hdrs, [  --with-rsa-hdrs[=path]  if not using NSS, specify path to RSA headers],
[ if test "x$nss" != "x"; then
    AC_MSG_ERROR(Only specify --with-nss-{hdrs,dist} or --with-rsa-hdrs, not both)
  fi
  case "$withval" in
  no)
    rsa="0"
    ;;
  yes)
    RSA_INCLUDE="$includedir"
    rsa="1"
    ;;
  *)
    RSA_INCLUDE="$withval"
    rsa="1"
    ;;
  esac ])

if test "x$nss" = "x"; then
  if test "x$rsa" = "x"; then
    RSA_INCLUDE="$includedir"
  fi
  RSA_CFLAGS="-I$RSA_INCLUDE"
fi

if test "x$nss" = "x1"; then
  AC_DEFINE(WITH_NSS,1)
fi

AC_SUBST(WITH_NSS)

if test "x$rsa" = "x1"; then
  RSA_CFLAGS-"-I$RSA_INCLUDE"
fi

AC_ARG_ENABLE(debug, [  --disable-debug         default is enabled],
[ case "$enableval" in
  no)
    DEBUG_CFLAGS="";;
  yes)
    DEBUG_CFLAGS="-DDEBUG";;
  *)
    DEBUG_CFLAGS="-DDEBUG";;
  esac ], DEBUG_CFLAGS="-DDEBUG")

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_CHECK_PROG(AR, ar, ar)
AC_CHECK_PROG(LD, ld, ld)
AC_CHECK_PROG(RM, rm, rm)
AC_CHECK_PROG(TAR, tar, tar)
AC_SUBST(CC INSTALL RANLIB AR LD RM TAR)

CPPFLAGS="$CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $RSA_CFLAGS $DEBUG_CFLAGS"
LIBS="$NSPR_LDFLAGS $LIBS"

AC_SUBST(CFLAGS)

dnl Checks for libraries.
AC_CHECK_LIB(nspr4, PR_Init)

dnl Checks for header files.
AC_CHECK_HEADERS(nspr.h)
AC_SUBST(HAVE_NSPR_H)

if test "x$nss" = "x1"; then
  AC_CHECK_HEADERS(ck.h)
fi

if test "x$rsa" = "x1"; then
  AC_CHECK_HEADERS(pkcs11t.h pkcs11.h)
fi

AC_SUBST(HAVE_CK_H HAVE_PKCS11T_H HAVE_PKCS11_H)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_SUBST(const)

AC_CHECK_FUNCS(memset strlen)
AC_SUBST(HAVE_MEMSET HAVE_STRLEN)
AC_OUTPUT(Makefile, [echo timestamp > stamp-h])