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