| 1 | dnl -*-autoconf-*- |
| 2 | dnl |
| 3 | dnl Configuration script for `anag' |
| 4 | dnl |
| 5 | dnl (c) 2016 Mark Wooding |
| 6 | dnl |
| 7 | |
| 8 | dnl----- Licensing notice --------------------------------------------------- |
| 9 | dnl |
| 10 | dnl This file is part of Anag: a simple wordgame helper. |
| 11 | dnl |
| 12 | dnl Anag is free software; you can redistribute it and/or modify |
| 13 | dnl it under the terms of the GNU General Public License as published by |
| 14 | dnl the Free Software Foundation; either version 2 of the License, or |
| 15 | dnl (at your option) any later version. |
| 16 | dnl |
| 17 | dnl Anag is distributed in the hope that it will be useful, |
| 18 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | dnl GNU General Public License for more details. |
| 21 | dnl |
| 22 | dnl You should have received a copy of the GNU General Public License |
| 23 | dnl along with Anag; if not, write to the Free Software Foundation, |
| 24 | dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | |
| 26 | dnl-------------------------------------------------------------------------- |
| 27 | dnl Initialization. |
| 28 | |
| 29 | mdw_AUTO_VERSION |
| 30 | AC_INIT([anag], AUTO_VERSION, [mdw@distorted.org.uk]) |
| 31 | AC_CONFIG_SRCDIR([anag.c]) |
| 32 | AC_CONFIG_AUX_DIR([config]) |
| 33 | AM_INIT_AUTOMAKE([foreign]) |
| 34 | mdw_SILENT_RULES |
| 35 | |
| 36 | AC_PROG_CC |
| 37 | AX_CFLAGS_WARN_ALL |
| 38 | |
| 39 | dnl-------------------------------------------------------------------------- |
| 40 | dnl C programming environment. |
| 41 | |
| 42 | AC_CHECK_FUNCS([regcomp]) |
| 43 | AM_CONDITIONAL([HAVE_REGCOMP], [test $ac_cv_func_regcomp = yes]) |
| 44 | |
| 45 | mdw_have_pcre2=nil mdw_have_pcre=nil |
| 46 | PKG_CHECK_MODULES([PCRE2], [libpcre2-8], |
| 47 | [mdw_have_pcre2=t AM_CFLAGS="$AM_CFLAGS $PCRE2_CFLAGS"], |
| 48 | [PKG_CHECK_MODULES([PCRE], [libpcre], |
| 49 | [mdw_have_pcre=t AM_CFLAGS="$AM_CFLAGS $PCRE_CFLAGS"], [])]) |
| 50 | AM_CONDITIONAL([HAVE_PCRE2], [test $mdw_have_pcre2 = t]) |
| 51 | case $mdw_have_pcre2 in |
| 52 | t) AC_DEFINE([HAVE_PCRE2], [1], [PCRE2 library is available.]) ;; |
| 53 | esac |
| 54 | AM_CONDITIONAL([HAVE_PCRE], [test $mdw_have_pcre = t]) |
| 55 | case $mdw_have_pcre in |
| 56 | t) AC_DEFINE([HAVE_PCRE], [1], [PCRE library is available.]) ;; |
| 57 | esac |
| 58 | |
| 59 | dnl-------------------------------------------------------------------------- |
| 60 | dnl Java. |
| 61 | |
| 62 | AC_CHECK_PROGS([JAVAC], [javac jikes], [none]) |
| 63 | if test "$JAVAC" = "none"; then AC_MSG_WARN([No Java compiler found]); fi |
| 64 | AM_CONDITIONAL([HAVE_JAVAC], [test "$JAVAC" != "none"]) |
| 65 | |
| 66 | dnl-------------------------------------------------------------------------- |
| 67 | dnl Tcl/Tk. |
| 68 | |
| 69 | AC_PATH_PROGS([WISH], [wish wish8 wish8.5 wish8.4], [none]) |
| 70 | if test "$WISH" = "none"; then AC_MSG_WARN([No Tcl/Tk interpreter found]); fi |
| 71 | AM_CONDITIONAL([HAVE_WISH], [test "$WISH" != "none"]) |
| 72 | |
| 73 | dnl-------------------------------------------------------------------------- |
| 74 | dnl Other configuration. |
| 75 | |
| 76 | AC_ARG_WITH(dictionary, |
| 77 | [ --with-dictionary=DICT set default word list to be DICT], |
| 78 | [DICTIONARY=$withval], |
| 79 | [AC_CACHE_CHECK([dictionary], [mdw_cv_dictionary], |
| 80 | [for mdw_cv_dictionary in \ |
| 81 | /usr/share/dict/words \ |
| 82 | /usr/dict/words; do |
| 83 | if test -r "$mdw_cv_dictionary"; then break; fi |
| 84 | done]) |
| 85 | DICTIONARY=$mdw_cv_dictionary]) |
| 86 | |
| 87 | AC_DEFINE_UNQUOTED([DICTIONARY], ["$DICTIONARY"], |
| 88 | [Define this to be your default wordlist location.]) |
| 89 | AC_SUBST([DICTIONARY]) |
| 90 | |
| 91 | dnl-------------------------------------------------------------------------- |
| 92 | dnl Produce output. |
| 93 | |
| 94 | AC_CONFIG_HEADER([config/config.h]) |
| 95 | AC_CONFIG_FILES([Makefile]) |
| 96 | AC_OUTPUT |
| 97 | |
| 98 | dnl----- That's all, folks -------------------------------------------------- |