[7d4fbcd] | 1 | dnl Process this file with autoconf to produce a configure script. |
---|
[290e2d0] | 2 | AC_INIT([BarnOwl],[1.10dev],[bug-barnowl@mit.edu]) |
---|
[cecb125] | 3 | AM_INIT_AUTOMAKE([1.7.0 -Wall -Wno-portability foreign]) |
---|
[487cc2b] | 4 | AM_MAINTAINER_MODE([enable]) |
---|
[636de2a] | 5 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
---|
[7d4fbcd] | 6 | |
---|
[8073852] | 7 | AC_CONFIG_MACRO_DIR([m4]) |
---|
[37f27bc] | 8 | AC_CONFIG_HEADER([config.h]) |
---|
[7d4fbcd] | 9 | |
---|
| 10 | AC_PROG_CC |
---|
[d1d68e0] | 11 | AC_PROG_CC_C99 |
---|
[7d4fbcd] | 12 | |
---|
[4097723] | 13 | AC_ARG_WITH([stack-protector], |
---|
| 14 | [AS_HELP_STRING([--with-stack-protector], |
---|
| 15 | [Enable gcc -fstack-protector])], |
---|
| 16 | [], |
---|
| 17 | [with_stack_protector=check]) |
---|
| 18 | |
---|
| 19 | AS_IF([test "x$with_stack_protector" != xno], |
---|
[f2a96c0] | 20 | [AX_CHECK_COMPILE_FLAG([-fstack-protector], |
---|
[ce35060] | 21 | [AM_CFLAGS="$AM_CFLAGS -fstack-protector"], |
---|
[ce27cc1] | 22 | [if test "x$with_stack_protector" != xcheck; then |
---|
| 23 | AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.]) |
---|
| 24 | fi |
---|
| 25 | ])]) |
---|
[87afe92] | 26 | |
---|
[d54035d] | 27 | AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No libncursesw found.)) |
---|
[59077f9] | 28 | AC_CHECK_LIB(panelw, update_panels,, AC_MSG_ERROR(No libpanelw found.)) |
---|
[363eb9d] | 29 | AC_SEARCH_LIBS([gethostbyname], [nsl]) |
---|
| 30 | AC_SEARCH_LIBS([socket], [socket]) |
---|
| 31 | AC_SEARCH_LIBS([res_search], [resolv]) |
---|
[2c270e6] | 32 | |
---|
| 33 | AC_ARG_WITH([zephyr], |
---|
[438009c] | 34 | [AS_HELP_STRING([--with-zephyr], |
---|
[ec21c62] | 35 | [Enable Zephyr support])], |
---|
[2c270e6] | 36 | [], |
---|
| 37 | [with_zephyr=check]) |
---|
| 38 | |
---|
[ddbb43ad] | 39 | AC_ARG_WITH([krb4], |
---|
| 40 | AS_HELP_STRING([--with-krb4], |
---|
| 41 | [Build with kerberos IV])) |
---|
| 42 | |
---|
[2c270e6] | 43 | AS_IF([test "x$with_zephyr" != xno], |
---|
[35a9ec7] | 44 | [have_krb4=no |
---|
| 45 | |
---|
| 46 | AS_IF([test "x$with_krb4" != "xno"], |
---|
[ddbb43ad] | 47 | [AC_MSG_CHECKING([for Kerberos IV]) |
---|
| 48 | AS_IF([krb5-config krb4 --libs >/dev/null 2>&1], |
---|
| 49 | [AC_MSG_RESULT([yes]) |
---|
[35a9ec7] | 50 | have_krb4=yes |
---|
[ddbb43ad] | 51 | AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV]) |
---|
[ce35060] | 52 | AM_CFLAGS="${AM_CFLAGS} `krb5-config krb4 --cflags`" |
---|
[ddbb43ad] | 53 | LIBS="${LIBS} `krb5-config krb4 --libs`" |
---|
| 54 | ], |
---|
| 55 | [AC_MSG_RESULT([no]) |
---|
| 56 | AS_IF([test "x$with_krb4" = "xyes"], |
---|
[35a9ec7] | 57 | [AC_MSG_ERROR([Kerberos IV requested but not found])])])]) |
---|
| 58 | |
---|
| 59 | AS_IF([test "x$have_krb4" != xyes], |
---|
[1f121cb] | 60 | [PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], |
---|
| 61 | [AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}" |
---|
| 62 | LIBS="${LIBS} ${LIBCRYPTO_LIBS}" |
---|
[58b6ce5] | 63 | ], |
---|
| 64 | [PKG_CHECK_MODULES([OPENSSL], [openssl], |
---|
| 65 | [AM_CFLAGS="${AM_CFLAGS} ${OPENSSL_CFLAGS}" |
---|
| 66 | LIBS="${LIBS} ${OPENSSL_LIBS}" |
---|
| 67 | ])])]) |
---|
[35a9ec7] | 68 | |
---|
[806f769] | 69 | AC_CHECK_LIB([zephyr], [ZGetSender], |
---|
[16c0416] | 70 | [LIBS="$LIBS -lzephyr" |
---|
| 71 | AC_DEFINE([HAVE_LIBZEPHYR], [1], |
---|
[2c270e6] | 72 | [Define if you have libzephyr]) |
---|
| 73 | AC_CHECK_LIB([zephyr], [ZInitLocationInfo], |
---|
| 74 | AC_DEFINE([HAVE_LIBZEPHYR_ZINITLOCATIONINFO], [1], |
---|
| 75 | [Have ZInitLocationInfo]),) |
---|
[cc1eeac] | 76 | AC_CHECK_LIB([com_err], [com_err]) |
---|
| 77 | AC_CHECK_HEADERS([com_err.h]) |
---|
[2c270e6] | 78 | ], |
---|
| 79 | [if test "x$with_zephyr" != xcheck; then |
---|
| 80 | AC_MSG_FAILURE( |
---|
[438009c] | 81 | [--with-zephyr was given, but libzephyr does not seem to be available.]) |
---|
[2c270e6] | 82 | fi |
---|
| 83 | ])]) |
---|
[ac70242] | 84 | |
---|
[263320f] | 85 | AC_CHECK_FUNCS([use_default_colors]) |
---|
| 86 | AC_CHECK_FUNCS([resizeterm], [], [AC_MSG_ERROR([No resizeterm found])]) |
---|
[7d03c8d] | 87 | AC_CHECK_FUNCS([des_string_to_key DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1]) |
---|
| 88 | AC_CHECK_FUNCS([des_ecb_encrypt DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1]) |
---|
| 89 | AC_CHECK_FUNCS([des_key_sched DES_key_sched], [HAVE_DES_KEY_SCHED=1]) |
---|
[e51b410] | 90 | |
---|
[7d4fbcd] | 91 | dnl Checks for header files. |
---|
| 92 | AC_HEADER_STDC |
---|
| 93 | AC_HEADER_SYS_WAIT |
---|
[fe73d0c] | 94 | AC_CHECK_HEADERS(stdbool.h strings.h sys/ioctl.h sys/filio.h unistd.h) |
---|
[7d4fbcd] | 95 | |
---|
| 96 | dnl Add CFLAGS for embeded perl |
---|
[1c89df8] | 97 | PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts` |
---|
| 98 | AC_MSG_NOTICE([Adding perl CFLAGS ${PERL_CFLAGS}]) |
---|
[ce35060] | 99 | AM_CFLAGS="${AM_CFLAGS} ${PERL_CFLAGS}" |
---|
[7d4fbcd] | 100 | |
---|
[e51b410] | 101 | dnl Find the location of perl XSUBPP |
---|
[8ee73f8d] | 102 | AC_MSG_CHECKING(for the perl xsubpp precompiler) |
---|
[eb5e8fc] | 103 | XSUBPPDIR="`cd "$srcdir" && perl -MExtUtils::MakeMaker -e 'print ExtUtils::MakeMaker->new({NAME => qw(owl)})->tool_xsubpp;' | grep \^XSUBPPDIR | sed -e 's/XSUBPPDIR = //g;'`" |
---|
[8ee73f8d] | 104 | if test -n "${XSUBPPDIR}"; then |
---|
| 105 | AC_MSG_RESULT(${XSUBPPDIR}) |
---|
| 106 | else |
---|
| 107 | AC_MSG_ERROR(not found) |
---|
| 108 | fi |
---|
| 109 | |
---|
[4ad3480] | 110 | if test -f "${XSUBPPDIR}/typemap"; then |
---|
| 111 | XSUBPPFLAGS="-typemap ${XSUBPPDIR}/typemap" |
---|
| 112 | else |
---|
| 113 | XSUBPPFLAGS="" |
---|
| 114 | fi |
---|
| 115 | |
---|
[8061a6a] | 116 | dnl Add LIBS for embedded perl |
---|
[3f21b8e] | 117 | FOO=`perl -MExtUtils::Embed -e ldopts` |
---|
[c08a725] | 118 | AC_MSG_NOTICE([Adding perl LIBS ${FOO}]) |
---|
| 119 | LIBS=${LIBS}\ ${FOO} |
---|
[4c97193] | 120 | AC_CHECK_LIB([perl], [perl_alloc],, AC_MSG_ERROR([No libperl found])) |
---|
[7d4fbcd] | 121 | |
---|
[0de04fa] | 122 | AX_PROG_PERL_MODULES([AnyEvent],, |
---|
| 123 | [AC_MSG_ERROR([cannot find perl module AnyEvent.])]) |
---|
[2d3ed95] | 124 | AX_PROG_PERL_MODULES([Class::Accessor::Fast],, |
---|
| 125 | [AC_MSG_ERROR([cannot find perl module Class::Accessor::Fast.])]) |
---|
[0de04fa] | 126 | AX_PROG_PERL_MODULES([Glib],, |
---|
| 127 | [AC_MSG_ERROR([cannot find perl module Glib.])]) |
---|
[2d3ed95] | 128 | AX_PROG_PERL_MODULES([PAR],, |
---|
| 129 | [AC_MSG_WARN([PAR.pm not found. Loadable modules will be disabled.])]) |
---|
[06e04a9] | 130 | AX_PROG_PERL_MODULES([ExtUtils::Depends],, |
---|
| 131 | [AC_MSG_ERROR([cannot find perl module ExtUtils::Depends])]) |
---|
[2d3ed95] | 132 | |
---|
[8061a6a] | 133 | dnl Add CFLAGS and LIBS for glib-2.0 |
---|
[4f746f8] | 134 | PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.16 gobject-2.0 gthread-2.0]) |
---|
[34509d5] | 135 | |
---|
[7c09b21] | 136 | AC_MSG_NOTICE([Adding glib-2.0 CFLAGS ${GLIB_CFLAGS}]) |
---|
[ce35060] | 137 | AM_CFLAGS="${GLIB_CFLAGS} ${AM_CFLAGS}" |
---|
[8061a6a] | 138 | AC_MSG_NOTICE([Adding glib-2.0 LIBS ${GLIB_LIBS}]) |
---|
| 139 | LIBS="${GLIB_LIBS} ${LIBS}" |
---|
[34509d5] | 140 | |
---|
[37f27bc] | 141 | if test "x${prefix}" = "xNONE"; then |
---|
| 142 | prefix="${ac_default_prefix}" |
---|
| 143 | fi |
---|
[7d4fbcd] | 144 | |
---|
[06e04a9] | 145 | dnl Add CFLAGS for glib-perl |
---|
| 146 | GLIB_PERL_CFLAGS=`perl -MExtUtils::Depends -e 'my $e = ExtUtils::Depends->new("BarnOwl","Glib"); my %h = $e->get_makefile_vars; print $h{"INC"}'` |
---|
| 147 | AC_MSG_NOTICE([Adding glib-perl CFLAGS ${GLIB_PERL_CFLAGS}]) |
---|
| 148 | AM_CFLAGS="${GLIB_PERL_CFLAGS} ${AM_CFLAGS}" |
---|
| 149 | |
---|
[37f27bc] | 150 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
[c50f589] | 151 | |
---|
[ce35060] | 152 | AX_CFLAGS_WARN_ALL([AM_CFLAGS]) |
---|
[f2a96c0] | 153 | AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes -Wwrite-strings],[AM_CFLAGS]) |
---|
[79245bc] | 154 | |
---|
[4479497] | 155 | dnl Shut gcc up about zero-length format strings; the warning's apparently for |
---|
| 156 | dnl efficiency reasons, which is bogus for custom functions. |
---|
[f2a96c0] | 157 | AX_APPEND_COMPILE_FLAGS([-Wno-format-zero-length],[AM_CFLAGS]) |
---|
[4479497] | 158 | |
---|
[f2a96c0] | 159 | AX_APPEND_COMPILE_FLAGS([-Wno-pointer-sign -Wno-empty-body -Wno-unused-value],[LIBFAIM_CFLAGS]) |
---|
[215c119] | 160 | |
---|
[7d03c8d] | 161 | AM_CONDITIONAL([ENABLE_ZCRYPT], [test "$HAVE_DES_STRING_TO_KEY" && dnl |
---|
| 162 | test "$HAVE_DES_KEY_SCHED" && dnl |
---|
| 163 | test "$HAVE_DES_ECB_ENCRYPT"]) |
---|
| 164 | |
---|
[d1d68e0] | 165 | AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600" |
---|
[569f0bd] | 166 | dnl Define _BSD_SOURCE because zephyr needs caddr_t. |
---|
| 167 | AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE" |
---|
| 168 | dnl Define __EXTENSIONS__ for strcasecmp on Solaris. |
---|
[ce35060] | 169 | AM_CFLAGS="$AM_CFLAGS -D__EXTENSIONS__" |
---|
[04af908] | 170 | |
---|
[ce35060] | 171 | AC_SUBST([AM_CFLAGS]) |
---|
[215c119] | 172 | AC_SUBST([LIBFAIM_CFLAGS]) |
---|
| 173 | |
---|
[15bd5ef] | 174 | AC_SUBST(XSUBPPDIR) |
---|
[4ad3480] | 175 | AC_SUBST(XSUBPPFLAGS) |
---|
[8ee73f8d] | 176 | |
---|
[ac70242] | 177 | AC_PROG_INSTALL |
---|
[37f27bc] | 178 | AC_PROG_RANLIB |
---|
[db4b293] | 179 | AC_CHECK_PROG([HAVE_ZIP], [zip], [yes], [no]) |
---|
| 180 | if test "x${HAVE_ZIP}" = "xno"; then |
---|
| 181 | AC_MSG_ERROR([cannot find a 'zip' binary.]) |
---|
| 182 | fi |
---|
[ac70242] | 183 | |
---|
[12a6616] | 184 | AC_CONFIG_LIBOBJ_DIR([compat]) |
---|
[2cbe7c3] | 185 | AC_CHECK_DECLS([memrchr]) |
---|
[12a6616] | 186 | AC_REPLACE_FUNCS([memrchr]) |
---|
| 187 | |
---|
[24ece84] | 188 | AC_SUBST([abs_builddir]) |
---|
| 189 | AC_SUBST([abs_srcdir]) |
---|
| 190 | |
---|
[12a6616] | 191 | AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile perl/modules/Makefile]) |
---|
[b9c8d28] | 192 | AC_OUTPUT |
---|