michael@0: dnl michael@0: dnl This Source Code Form is subject to the terms of the Mozilla Public michael@0: dnl License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: AC_INIT(trivial.c) michael@0: AC_CONFIG_HEADER(config.h) michael@0: AC_PROG_MAKE_SET michael@0: michael@0: AC_ARG_WITH(nspr, [ --with-nspr[=path] specify location of NSPR], michael@0: [ case "$withval" in michael@0: no) michael@0: AC_MSG_ERROR(NSPR is required);; michael@0: yes) michael@0: NSPR_INCLUDE="$includedir" michael@0: NSPR_LIBPATH="$libdir" michael@0: ;; michael@0: *) michael@0: NSPR_INCLUDE="$withval/include" michael@0: NSPR_LIBPATH="$withval/lib" michael@0: ;; michael@0: esac ], michael@0: [ NSPR_INCLUDE="$includedir" michael@0: NSPR_LIBPATH="$libdir" ] michael@0: ) michael@0: michael@0: NSPR_CFLAGS="-I$NSPR_INCLUDE" michael@0: NSPR_LDFLAGS="-L$NSPR_LIBPATH -lnspr4 -lplc4 -lplds4" michael@0: michael@0: dnl This isn't optimum, but the mozilla build system and autoconf don't really mesh well.. michael@0: michael@0: AC_ARG_WITH(nss-dist, [ --with-nss-dist[=path] specify path to NSS dist directory], michael@0: [ case "$withval" in michael@0: no) michael@0: NSS_CFLAGS="" michael@0: nss="0" michael@0: ;; michael@0: yes) michael@0: AC_MSG_ERROR(You have to specify a path for --with-nss-dist) michael@0: ;; michael@0: *) michael@0: NSS_CFLAGS="-I$withval/private/security -I$withval/public/security" michael@0: nss="1" michael@0: ;; michael@0: esac ]) michael@0: michael@0: AC_ARG_WITH(nss-hdrs, [ --with-nss-hdrs[=path] or, specify path to installed NSS headers], michael@0: [ if test "x$nss" != "x"; then michael@0: AC_MSG_ERROR(Only specify --with-nss-hdrs or --with-nss-dist, not both) michael@0: fi michael@0: case "$withval" in michael@0: no) michael@0: NSS_CFLAGS="" michael@0: nss="0" michael@0: ;; michael@0: yes) michael@0: NSS_CFLAGS="-I$includedir" michael@0: nss="1" michael@0: ;; michael@0: *) michael@0: NSS_CFLAGS="-I$withval" michael@0: nss="1" michael@0: ;; michael@0: esac ]) michael@0: michael@0: AC_ARG_WITH(rsa-hdrs, [ --with-rsa-hdrs[=path] if not using NSS, specify path to RSA headers], michael@0: [ if test "x$nss" != "x"; then michael@0: AC_MSG_ERROR(Only specify --with-nss-{hdrs,dist} or --with-rsa-hdrs, not both) michael@0: fi michael@0: case "$withval" in michael@0: no) michael@0: rsa="0" michael@0: ;; michael@0: yes) michael@0: RSA_INCLUDE="$includedir" michael@0: rsa="1" michael@0: ;; michael@0: *) michael@0: RSA_INCLUDE="$withval" michael@0: rsa="1" michael@0: ;; michael@0: esac ]) michael@0: michael@0: if test "x$nss" = "x"; then michael@0: if test "x$rsa" = "x"; then michael@0: RSA_INCLUDE="$includedir" michael@0: fi michael@0: RSA_CFLAGS="-I$RSA_INCLUDE" michael@0: fi michael@0: michael@0: if test "x$nss" = "x1"; then michael@0: AC_DEFINE(WITH_NSS,1) michael@0: fi michael@0: michael@0: AC_SUBST(WITH_NSS) michael@0: michael@0: if test "x$rsa" = "x1"; then michael@0: RSA_CFLAGS-"-I$RSA_INCLUDE" michael@0: fi michael@0: michael@0: AC_ARG_ENABLE(debug, [ --disable-debug default is enabled], michael@0: [ case "$enableval" in michael@0: no) michael@0: DEBUG_CFLAGS="";; michael@0: yes) michael@0: DEBUG_CFLAGS="-DDEBUG";; michael@0: *) michael@0: DEBUG_CFLAGS="-DDEBUG";; michael@0: esac ], DEBUG_CFLAGS="-DDEBUG") michael@0: michael@0: dnl Checks for programs. michael@0: AC_PROG_CC michael@0: AC_PROG_CPP michael@0: AC_PROG_INSTALL michael@0: AC_PROG_RANLIB michael@0: AC_CHECK_PROG(AR, ar, ar) michael@0: AC_CHECK_PROG(LD, ld, ld) michael@0: AC_CHECK_PROG(RM, rm, rm) michael@0: AC_CHECK_PROG(TAR, tar, tar) michael@0: AC_SUBST(CC INSTALL RANLIB AR LD RM TAR) michael@0: michael@0: CPPFLAGS="$CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $RSA_CFLAGS $DEBUG_CFLAGS" michael@0: LIBS="$NSPR_LDFLAGS $LIBS" michael@0: michael@0: AC_SUBST(CFLAGS) michael@0: michael@0: dnl Checks for libraries. michael@0: AC_CHECK_LIB(nspr4, PR_Init) michael@0: michael@0: dnl Checks for header files. michael@0: AC_CHECK_HEADERS(nspr.h) michael@0: AC_SUBST(HAVE_NSPR_H) michael@0: michael@0: if test "x$nss" = "x1"; then michael@0: AC_CHECK_HEADERS(ck.h) michael@0: fi michael@0: michael@0: if test "x$rsa" = "x1"; then michael@0: AC_CHECK_HEADERS(pkcs11t.h pkcs11.h) michael@0: fi michael@0: michael@0: AC_SUBST(HAVE_CK_H HAVE_PKCS11T_H HAVE_PKCS11_H) michael@0: michael@0: dnl Checks for typedefs, structures, and compiler characteristics. michael@0: AC_C_CONST michael@0: AC_SUBST(const) michael@0: michael@0: AC_CHECK_FUNCS(memset strlen) michael@0: AC_SUBST(HAVE_MEMSET HAVE_STRLEN) michael@0: AC_OUTPUT(Makefile, [echo timestamp > stamp-h])