# Required initializer AC_INIT AM_INIT_AUTOMAKE(nss_compat_ossl, 1.0) # Find the compiler # We want these before the checks, so the checks can modify their values. test -z "$CFLAGS" && CFLAGS= auto_cflags=1 test -z "$CC" && cc_specified=yes AC_PROG_CC AC_PROG_LIBTOOL # Check for typedefs, structures, and compiler characteristics. AC_C_CONST # Check for header files AC_HEADER_STDC AC_CHECK_HEADERS( \ unistd.h ) AC_CHECKING(for NSPR) # check for --with-nspr AC_MSG_CHECKING(for --with-nspr) AC_ARG_WITH(nspr, [ --with-nspr=PATH Netscape Portable Runtime (NSPR) directory], [ if test -e "$withval"/include/nspr.h -a -d "$withval"/lib then AC_MSG_RESULT([using $withval]) NSPRDIR=$withval nspr_inc="-I$NSPRDIR/include" nspr_lib="-L$NSPRDIR/lib" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # check for --with-nspr-inc AC_MSG_CHECKING(for --with-nspr-inc) AC_ARG_WITH(nspr-inc, [ --with-nspr-inc=PATH Netscape Portable Runtime (NSPR) include file directory], [ if test -e "$withval"/nspr.h then AC_MSG_RESULT([using $withval]) nspr_inc="-I$withval" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # check for --with-nspr-lib AC_MSG_CHECKING(for --with-nspr-lib) AC_ARG_WITH(nspr-lib, [ --with-nspr-lib=PATH Netscape Portable Runtime (NSPR) library directory], [ if test -d "$withval" then AC_MSG_RESULT([using $withval]) nspr_lib="-L$withval" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # if NSPR is not found yet, try pkg-config # last resort if test -z "$nspr_inc" -o -z "$nspr_lib"; then AC_MSG_CHECKING(for nspr with pkg-config) AC_PATH_PROG(PKG_CONFIG, pkg-config) if test -n "$PKG_CONFIG"; then if $PKG_CONFIG --exists nspr; then nspr_inc=`$PKG_CONFIG --cflags-only-I nspr` nspr_libdir=`$PKG_CONFIG --libs-only-L nspr` nspr_libs=`$PKG_CONFIG --libs nspr` nspr_lib="${nspr_libdir} ${nspr_libs}" else AC_MSG_ERROR([NSPR not found, specify with --with-nspr.]) fi fi fi AC_CHECKING(for NSS) # check for --with-nss AC_MSG_CHECKING(for --with-nss) AC_ARG_WITH(nss, [ --with-nss=PATH Network Security Services (NSS) directory], [ if test -e "$withval"/include/nss.h -a -d "$withval"/lib then AC_MSG_RESULT([using $withval]) NSSDIR=$withval nss_inc="-I$NSSDIR/include" nss_lib="-L$NSSDIR/lib" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # check for --with-nss-inc AC_ARG_WITH(nss-inc, [ --with-nss-inc=PATH Network Security Services (NSS) include directory], [ if test -e "$withval"/nss.h then AC_MSG_RESULT([using $withval]) nss_inc="-I$withval" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # check for --with-nss-lib AC_MSG_CHECKING(for --with-nss-lib) AC_ARG_WITH(nss-lib, [ --with-nss-lib=PATH Network Security Services (NSS) library directory], [ if test -d "$withval" then AC_MSG_RESULT([using $withval]) nss_lib="-L$withval" else echo AC_MSG_ERROR([$withval not found]) fi ], AC_MSG_RESULT(no)) # if NSS is not found yet, try pkg-config # last resort if test -z "$nss_inc" -o -z "$nss_lib"; then AC_MSG_CHECKING(for nss with pkg-config) AC_PATH_PROG(PKG_CONFIG, pkg-config) if test -n "$PKG_CONFIG"; then if $PKG_CONFIG --exists nss; then nss_inc=`$PKG_CONFIG --cflags-only-I nss` nss_libdir=`$PKG_CONFIG --libs-only-L nss` nss_libs=`$PKG_CONFIG --libs nss` nss_lib="${nss_libdir} ${nss_libs}" else AC_MSG_ERROR([NSS not found, specify with --with-nss.]) fi fi fi # Substitute values AC_SUBST(nspr_inc) AC_SUBST(nspr_lib) AC_SUBST(nss_inc) AC_SUBST(nss_lib) # Write config.status and the Makefile AC_OUTPUT(Makefile src/Makefile)