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