Commit | Line | Data |
---|---|---|
b2ffb9b7 MW |
1 | dnl -*-autoconf-*- |
2 | dnl | |
3 | dnl Configuration script for nsict-utils | |
4 | dnl | |
5 | dnl (c) 2008 Mark Wooding | |
6 | dnl | |
7 | ||
8 | dnl ----- Licensing notice -------------------------------------------------- | |
9 | dnl | |
10 | dnl This program is free software; you can redistribute it and/or modify | |
11 | dnl it under the terms of the GNU General Public License as published by | |
12 | dnl the Free Software Foundation; either version 2 of the License, or | |
13 | dnl (at your option) any later version. | |
14 | dnl | |
15 | dnl This program is distributed in the hope that it will be useful, | |
16 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | dnl GNU General Public License for more details. | |
19 | dnl | |
20 | dnl You should have received a copy of the GNU General Public License | |
21 | dnl along with this program; if not, write to the Free Software Foundation, | |
22 | dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
23 | ||
24 | dnl-------------------------------------------------------------------------- | |
25 | dnl Initialization. | |
26 | ||
27 | mdw_AUTO_VERSION | |
926e521f | 28 | AC_INIT([distorted-utils], AUTO_VERSION, [mdw@distorted.org.uk]) |
b2ffb9b7 MW |
29 | AC_CONFIG_SRCDIR([shadowfix.in]) |
30 | AC_CONFIG_AUX_DIR([config]) | |
31 | AM_INIT_AUTOMAKE([foreign]) | |
8653d1c3 | 32 | mdw_SILENT_RULES |
b2ffb9b7 | 33 | |
c818aced MW |
34 | AC_ARG_WITH([logdir], |
35 | AS_HELP_STRING([--with-logdir=DIR], | |
36 | [Write log files here.]), | |
37 | [logdir=$withval], | |
38 | [logdir=/var/log | |
39 | for i in /var/log /var/adm; do | |
40 | if test -d $i; then logdir=$i; break; fi | |
41 | done]) | |
42 | AC_SUBST(logdir) | |
43 | ||
92f7c002 MW |
44 | AC_CANONICAL_HOST |
45 | ||
b2ffb9b7 MW |
46 | dnl-------------------------------------------------------------------------- |
47 | dnl C programming environment. | |
48 | ||
49 | ## Compiler. | |
50 | AC_PROG_CC | |
51 | AX_CFLAGS_WARN_ALL | |
52 | ||
53 | ## Libraries. | |
54 | OLIBS=$LIBS | |
55 | AC_SEARCH_LIBS([floor], [m]) | |
56 | AC_SUBST([MATH_LIBS], [$LIBS]) | |
57 | LIBS=$OLIBS | |
58 | ||
59 | AC_CHECK_LIB([cdb], [cdb_seek], [have_cdb=yes], [have_cdb=no]) | |
60 | AM_CONDITIONAL([HAVE_LIBCDB], [test $have_cdb = yes]) | |
61 | ||
b2ffb9b7 MW |
62 | ## Packages. |
63 | PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4], [have_mLib=yes], [have_mLib=no]) | |
64 | AM_CONDITIONAL([HAVE_MLIB], [test $have_mLib = yes]) | |
65 | ||
66 | PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1], | |
67 | [have_catacomb=yes], [have_catacomb=no]) | |
68 | AM_CONDITIONAL([HAVE_CATACOMB], [test $have_catacomb = yes]) | |
69 | ||
2e169b7e MW |
70 | ## Functions. |
71 | AC_CHECK_FUNC([prlimit], [have_prlimit=yes], [have_prlimit=no]) | |
72 | AM_CONDITIONAL([HAVE_PRLIMIT], [test $have_prlimit = yes]) | |
73 | ||
92f7c002 | 74 | ## Processor type. |
8fc36470 | 75 | case "$host_cpu" in i?86 | x86_64) x86=yes;; *) x86=no;; esac |
92f7c002 MW |
76 | AM_CONDITIONAL([X86], [test $x86 = yes -a $GCC = yes]) |
77 | ||
b2ffb9b7 MW |
78 | dnl-------------------------------------------------------------------------- |
79 | dnl Python, Perl and other scripting languages. | |
80 | ||
81 | ## Python. | |
82 | AM_PATH_PYTHON([2.4], [have_python=yes], [have_python=no]) | |
83 | AM_CONDITIONAL([HAVE_PYTHON], [test $have_python = yes]) | |
84 | ||
85 | AC_PYTHON_MODULE([cdb]) | |
86 | AM_CONDITIONAL([HAVE_PYMOD_CDB], [test $HAVE_PYMOD_CDB = yes]) | |
87 | ||
88 | ## Perl. | |
89 | AC_ARG_VAR([PERL], [Path to your favourite Perl binary.]) | |
90 | AC_PATH_PROGS([PERL], [perl perl5], [false]) | |
1506eae0 | 91 | AX_PROG_PERL_VERSION([5.004], [have_perl=yes], [have_perl=no]) |
b2ffb9b7 MW |
92 | AM_CONDITIONAL([HAVE_PERL], [test $have_perl = yes]) |
93 | ||
0da5c4d5 MW |
94 | AC_ARG_WITH([perlmoddir], |
95 | AS_HELP_STRING([--with-perlmoddir=DIR], | |
b2ffb9b7 MW |
96 | [Install Perl modules here.]), |
97 | [perlmoddir=$withval], | |
98 | [perlmoddir='${libdir}/site_perl']) | |
99 | AC_SUBST([perlmoddir]) | |
100 | ||
101 | ## Tcl. | |
102 | have_tcl=yes | |
103 | AC_ARG_VAR([TCLSH], [Path to your favourite tclsh binary.]) | |
104 | AC_PATH_PROG([TCLSH], [tclsh], [false]) | |
105 | ||
106 | AC_MSG_CHECKING([Tcl version]) | |
107 | case "$TCLSH" in false) have_tcl=no ;; esac | |
108 | case "$have_tcl" in | |
109 | yes) | |
110 | tclver=$(echo "puts \$tcl_version" | tclsh -) | |
111 | tclver_hack=$(echo "$tclver" | sed 's/\.//') | |
112 | if test "$tclver_hack" -ge 83; then | |
113 | AC_MSG_RESULT([$tclver]) | |
114 | else | |
115 | have_tcl=no | |
116 | AC_MSG_RESULT([too old ($tclver)]) | |
117 | fi | |
118 | esac | |
119 | AM_CONDITIONAL([HAVE_TCLSH], [test $have_tcl = yes]) | |
120 | ||
121 | ## Bash. | |
122 | case "$BASH" in /bin/sh) unset BASH ;; esac | |
123 | AC_ARG_VAR([BASH], [Path to the Bourne Again Shell.]) | |
124 | AC_PATH_PROG([BASH], [bash], [false]) | |
125 | AC_MSG_CHECKING([bash version]) | |
126 | bashver=$("$BASH" -c 'echo $BASH_VERSION') | |
127 | if "$BASH" 2>/dev/null -c '[[[ ${BASH_VERSINFO[0]} -ge 3 ]]]'; then | |
128 | have_bash=yes | |
129 | AC_MSG_RESULT([$bashver]) | |
130 | else | |
131 | have_bash=no | |
132 | AC_MSG_RESULT([too old ($bashver)]) | |
133 | fi | |
134 | AM_CONDITIONAL([HAVE_BASH], [test $have_bash = yes]) | |
135 | ||
136 | dnl-------------------------------------------------------------------------- | |
137 | dnl Output. | |
138 | ||
139 | AC_CONFIG_FILES([Makefile]) | |
140 | AC_OUTPUT | |
141 | ||
142 | dnl ----- That's all, folks ------------------------------------------------- |