1dnl $Id: configure.in,v 1.68 2011/10/20 21:02:43 tom Exp $
2dnl Process this file with autoconf to produce a configure script.
3dnl ---------------------------------------------------------------------------
4dnl Copyright 1999-2010,2011 -- Thomas E. Dickey
5dnl
6dnl Permission is hereby granted, free of charge, to any person obtaining a
7dnl copy of this software and associated documentation files (the
8dnl "Software"), to deal in the Software without restriction, including
9dnl without limitation the rights to use, copy, modify, merge, publish,
10dnl distribute, distribute with modifications, sublicense, and/or sell
11dnl copies of the Software, and to permit persons to whom the Software is
12dnl furnished to do so, subject to the following conditions:
13dnl
14dnl The above copyright notice and this permission notice shall be included
15dnl in all copies or portions of the Software.
16dnl
17dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
23dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24dnl
25dnl Except as contained in this notice, the name(s) of the above copyright
26dnl holders shall not be used in advertising or otherwise to promote the
27dnl sale, use or other dealings in this Software without prior written
28dnl authorization.
29dnl ---------------------------------------------------------------------------
30AC_PREREQ(2.13.20020210)
31AC_INIT(dialog.h)
32AC_CONFIG_HEADER(dlg_config.h:config.hin)
33
34AC_ARG_PROGRAM
35
36DESTDIR=
37AC_SUBST(DESTDIR)
38
39dnl
40dnl Checks for programs.
41dnl
42AC_PROG_CC
43AC_PROG_CPP
44AC_PROG_GCC_TRADITIONAL
45AC_PROG_MAKE_SET
46AC_PROG_RANLIB
47AC_PROG_INSTALL
48CF_PROG_LINT
49
50dnl needed for CF_WITH_LIBTOOL
51AC_CHECK_TOOL(AR, ar, ar)
52
53AC_ISC_POSIX
54AC_C_CONST
55
56CF_MAKEFLAGS
57CF_MAKE_TAGS
58CF_DISABLE_ECHO
59CF_PROG_EXT
60CF_PATHSEP
61CF_LIB_PREFIX
62CF_XOPEN_SOURCE
63CF_LARGEFILE
64
65CF_WITH_WARNINGS
66
67dnl
68dnl Allow dialog program and library to be renamed.
69AC_ARG_WITH(package,
70	[  --with-package=XXX      rename dialog to XXX, library to libXXX.a, etc],
71	[PACKAGE=$withval],
72	[PACKAGE=dialog])
73CF_VERSION_INFO(dialog,$PACKAGE)
74
75dnl
76dnl If package is renamed, it is useful to have the dlg_XXX headers in a
77dnl subdirectory (using the package name) so that multiple versions of the
78dnl headers can coexist.
79AC_ARG_ENABLE(header-subdir,
80	[  --enable-header-subdir  install dlg_XXX headers to subdirectory],
81	[SUB_INC=$enableval],
82	[SUB_INC=no])
83AC_SUBST(SUB_INC)
84
85dnl
86dnl Checks for libraries.
87dnl
88EXTRAOBJS=""
89CF_BUNDLED_INTL(makefile,enable)
90CF_MATH_LIB(,sqrt(x))
91
92CF_WITH_NO_LEAKS
93
94CF_ARG_MSG_ENABLE([if you want --trace option],
95	trace,
96	[  --disable-trace         do not support --trace option],
97	[EXTRAOBJS="$EXTRAOBJS trace\$o"
98	 AC_DEFINE(HAVE_DLG_TRACE)],,yes)
99
100LIBTOOL_MAKE="#"
101CF_WITH_LIBTOOL
102if test "$with_libtool" = "yes" ; then
103	OBJEXT="lo"
104	LIBTOOL_MAKE=
105	CF_WITH_LIBTOOL_OPTS
106fi
107AC_SUBST(LIBTOOL_MAKE)
108
109CF_WITH_CURSES_DIR
110
111use_ncurses=no
112AC_ARG_WITH(ncurses,
113	[  --with-ncurses          compile/link with ncurses library],
114	[use_ncurses=ncurses])
115AC_ARG_WITH(ncursesw,
116	[  --with-ncursesw         compile/link with wide-char ncurses library],
117	[use_ncurses=ncursesw])
118if test $use_ncurses != no ; then
119	cf_wide_curses=yes
120	if test $use_ncurses = ncursesw ; then
121		CF_UTF8_LIB
122	fi
123	CF_NCURSES_CONFIG($use_ncurses)
124else
125	cf_wide_curses=no
126	CF_CURSES_CONFIG
127fi
128
129cf_all_widgets=yes
130CF_ARG_MSG_ENABLE([if you want extra dialogs],
131	extras,
132	[  --disable-extras        do not include extra dialogs],
133	[cf_all_widgets=yes],[cf_all_widgets=no],yes)
134
135CF_ARG_MSG_ENABLE([if you want config-file support],
136	rc-file,
137	[  --disable-rc-file       do not include config-file support],
138	[EXTRAOBJS="$EXTRAOBJS rc\$o"
139	 AC_DEFINE(HAVE_RC_FILE)],,$cf_all_widgets)
140
141CF_ARG_MSG_ENABLE([if you want Xdialog-style dialogs],
142	Xdialog,
143	[  --disable-Xdialog       do not include Xdialog-style dialogs],
144	[EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o"
145	 AC_DEFINE(HAVE_XDIALOG)],,$cf_all_widgets)
146
147CF_ARG_MSG_ENABLE([if you want the form dialog],
148	form,
149	[  --disable-form          do not include the form dialog],
150	[EXTRAOBJS="$EXTRAOBJS formbox\$o"
151	 AC_DEFINE(HAVE_DLG_FORMBOX)],,$cf_all_widgets)
152
153CF_ARG_MSG_ENABLE([if you want the gauge dialog],
154	gauge,
155	[  --disable-gauge         do not include the gauge dialogs],
156	[EXTRAOBJS="$EXTRAOBJS guage\$o pause\$o prgbox\$o progressbox\$o"
157	 AC_DEFINE(HAVE_DLG_GAUGE)],,$cf_all_widgets)
158
159CF_ARG_MSG_ENABLE([if you want the tailbox dialog],
160	tailbox,
161	[  --disable-tailbox       do not include the tailbox dialog],
162	[EXTRAOBJS="$EXTRAOBJS tailbox\$o"
163	 AC_DEFINE(HAVE_DLG_TAILBOX)],,$cf_all_widgets)
164
165CF_ARG_MSG_ENABLE([if you want the mixedform dialog],
166	mixedform,
167	[  --disable-mixedform     do not include the mixedform dialog],
168	[EXTRAOBJS="$EXTRAOBJS mixedform\$o"
169	 AC_DEFINE(HAVE_DLG_MIXEDFORM)],,$cf_all_widgets)
170
171CF_ARG_MSG_ENABLE([if you want the mixedgauge dialog],
172	mixedgauge,
173	[  --disable-mixedgauge    do not include the mixedgauge dialog],
174	[EXTRAOBJS="$EXTRAOBJS mixedgauge\$o"
175	 AC_DEFINE(HAVE_MIXEDGAUGE)],,$cf_all_widgets)
176
177CF_ARG_MSG_ENABLE([if you want the wide-curses features],
178	widec,
179	[  --enable-widec          enable wide-curses features],
180	[AC_DEFINE(USE_WIDE_CURSES)],,$cf_wide_curses)
181
182AC_SUBST(EXTRAOBJS)
183
184dnl
185dnl Checks for header files.
186dnl
187AC_HEADER_STDC
188AC_HEADER_TIME
189AC_HEADER_DIRENT
190AC_CHECK_HEADERS(search.h unctrl.h unistd.h)
191CF_CURSES_TERM_H
192
193dnl
194dnl Checks for library functions.
195dnl
196AC_TYPE_SIGNAL
197AC_CHECK_FUNCS(\
198_nc_free_and_exit \
199btowc \
200mblen \
201mbrlen \
202mbrtowc \
203mbtowc \
204strcasecmp \
205strftime \
206tsearch \
207waitpid \
208wcsrtombs \
209wcstombs \
210wctob \
211wctomb \
212)
213
214CF_CURSES_FUNCS(\
215flushinp \
216getattrs \
217getbegx \
218getbegy \
219getbegyx \
220getcurx \
221getcury \
222getmaxx \
223getmaxy \
224getmaxyx \
225getparx \
226getpary \
227getparyx \
228use_default_colors \
229wchgat \
230wget_wch \
231)
232
233AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR)])
234CF_CURSES_CHTYPE
235CF_CURSES_WACS_SYMBOLS
236CF_CURSES_WGETPARENT
237CF_FUNC_WAIT
238CF_MBSTATE_T
239
240CF_HEADERS_SH(DLG,dlg_config.h)
241
242AC_TRY_LINK([#include <locale.h>],[setlocale(LC_ALL, "")],[AC_DEFINE(HAVE_SETLOCALE)])
243
244CF_DISABLE_RPATH_HACK
245
246AC_OUTPUT(dialog-config makefile $EXTRA_OUTPUT $SUB_MAKEFILE samples/install/makefile,,,sort -u)
247