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