configure.in revision 220749
1dnl $Id: configure.in,v 1.64 2011/03/01 00:59:50 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
48
49dnl needed for CF_WITH_LIBTOOL
50AC_CHECK_TOOL(AR, ar, ar)
51
52AC_ISC_POSIX
53AC_C_CONST
54
55CF_MAKEFLAGS
56CF_MAKE_TAGS
57CF_DISABLE_ECHO
58CF_PROG_EXT
59CF_PATHSEP
60CF_LIB_PREFIX
61CF_XOPEN_SOURCE
62CF_LARGEFILE
63
64CF_WITH_WARNINGS
65
66dnl
67dnl Allow dialog program and library to be renamed.
68AC_ARG_WITH(package,
69	[  --with-package=XXX      rename dialog to XXX, library to libXXX.a, etc],
70	[PACKAGE=$withval],
71	[PACKAGE=dialog])
72CF_VERSION_INFO(dialog,$PACKAGE)
73
74dnl
75dnl If package is renamed, it is useful to have the dlg_XXX headers in a
76dnl subdirectory (using the package name) so that multiple versions of the
77dnl headers can coexist.
78AC_ARG_ENABLE(header-subdir,
79	[  --enable-header-subdir  install dlg_XXX headers to subdirectory],
80	[SUB_INC=$enableval],
81	[SUB_INC=no])
82AC_SUBST(SUB_INC)
83
84dnl
85dnl Checks for libraries.
86dnl
87EXTRAOBJS=""
88CF_BUNDLED_INTL(makefile,enable)
89CF_MATH_LIB(,sqrt(x))
90
91CF_WITH_NO_LEAKS
92
93CF_ARG_MSG_ENABLE([if you want --trace option],
94	trace,
95	[  --disable-trace         do not support --trace option],
96	[EXTRAOBJS="$EXTRAOBJS trace\$o"
97	 AC_DEFINE(HAVE_DLG_TRACE)],,yes)
98
99LIBTOOL_MAKE="#"
100CF_WITH_LIBTOOL
101if test "$with_libtool" = "yes" ; then
102	OBJEXT="lo"
103	LIBTOOL_MAKE=
104	CF_WITH_LIBTOOL_OPTS
105fi
106AC_SUBST(LIBTOOL_MAKE)
107
108CF_WITH_CURSES_DIR
109
110use_ncurses=no
111AC_ARG_WITH(ncurses,
112	[  --with-ncurses          compile/link with ncurses library],
113	[use_ncurses=ncurses])
114AC_ARG_WITH(ncursesw,
115	[  --with-ncursesw         compile/link with wide-char ncurses library],
116	[use_ncurses=ncursesw])
117if test $use_ncurses != no ; then
118	cf_wide_curses=yes
119	if test $use_ncurses = ncursesw ; then
120		CF_UTF8_LIB
121	fi
122	CF_NCURSES_CONFIG($use_ncurses)
123else
124	cf_wide_curses=no
125	CF_CURSES_CONFIG
126fi
127
128cf_all_widgets=yes
129CF_ARG_MSG_ENABLE([if you want extra dialogs],
130	extras,
131	[  --disable-extras        do not include extra dialogs],
132	[cf_all_widgets=yes],[cf_all_widgets=no],yes)
133
134CF_ARG_MSG_ENABLE([if you want config-file support],
135	rc-file,
136	[  --disable-rc-file       do not include config-file support],
137	[EXTRAOBJS="$EXTRAOBJS rc\$o"
138	 AC_DEFINE(HAVE_RC_FILE)],,$cf_all_widgets)
139
140CF_ARG_MSG_ENABLE([if you want Xdialog-style dialogs],
141	Xdialog,
142	[  --disable-Xdialog       do not include Xdialog-style dialogs],
143	[EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o"
144	 AC_DEFINE(HAVE_XDIALOG)],,$cf_all_widgets)
145
146CF_ARG_MSG_ENABLE([if you want the form dialog],
147	form,
148	[  --disable-form          do not include the form dialog],
149	[EXTRAOBJS="$EXTRAOBJS formbox\$o"
150	 AC_DEFINE(HAVE_DLG_FORMBOX)],,$cf_all_widgets)
151
152CF_ARG_MSG_ENABLE([if you want the gauge dialog],
153	gauge,
154	[  --disable-gauge         do not include the gauge dialogs],
155	[EXTRAOBJS="$EXTRAOBJS guage\$o pause\$o prgbox\$o progressbox\$o"
156	 AC_DEFINE(HAVE_DLG_GAUGE)],,$cf_all_widgets)
157
158CF_ARG_MSG_ENABLE([if you want the tailbox dialog],
159	tailbox,
160	[  --disable-tailbox       do not include the tailbox dialog],
161	[EXTRAOBJS="$EXTRAOBJS tailbox\$o"
162	 AC_DEFINE(HAVE_DLG_TAILBOX)],,$cf_all_widgets)
163
164CF_ARG_MSG_ENABLE([if you want the mixedform dialog],
165	mixedform,
166	[  --disable-mixedform     do not include the mixedform dialog],
167	[EXTRAOBJS="$EXTRAOBJS mixedform\$o"
168	 AC_DEFINE(HAVE_DLG_MIXEDFORM)],,$cf_all_widgets)
169
170CF_ARG_MSG_ENABLE([if you want the mixedgauge dialog],
171	mixedgauge,
172	[  --disable-mixedgauge    do not include the mixedgauge dialog],
173	[EXTRAOBJS="$EXTRAOBJS mixedgauge\$o"
174	 AC_DEFINE(HAVE_MIXEDGAUGE)],,$cf_all_widgets)
175
176CF_ARG_MSG_ENABLE([if you want the wide-curses features],
177	widec,
178	[  --enable-widec          enable wide-curses features],
179	[AC_DEFINE(USE_WIDE_CURSES)],,$cf_wide_curses)
180
181AC_SUBST(EXTRAOBJS)
182
183dnl
184dnl Checks for header files.
185dnl
186AC_HEADER_STDC
187AC_HEADER_TIME
188AC_HEADER_DIRENT
189AC_CHECK_HEADERS(search.h unctrl.h unistd.h)
190CF_CURSES_TERM_H
191
192dnl
193dnl Checks for library functions.
194dnl
195AC_TYPE_SIGNAL
196AC_CHECK_FUNCS(\
197_nc_free_and_exit \
198btowc \
199mblen \
200mbrlen \
201mbrtowc \
202mbtowc \
203strcasecmp \
204strftime \
205tsearch \
206waitpid \
207wcsrtombs \
208wcstombs \
209wctob \
210wctomb \
211)
212
213CF_CURSES_FUNCS(\
214flushinp \
215getattrs \
216getbegx \
217getbegy \
218getbegyx \
219getcurx \
220getcury \
221getmaxx \
222getmaxy \
223getmaxyx \
224getparx \
225getpary \
226getparyx \
227use_default_colors \
228wget_wch \
229)
230
231AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR)])
232CF_CURSES_CHTYPE
233CF_CURSES_WACS_SYMBOLS
234CF_FUNC_WAIT
235CF_MBSTATE_T
236
237CF_HEADERS_SH(DLG,dlg_config.h)
238
239AC_TRY_LINK([#include <locale.h>],[setlocale(LC_ALL, "")],[AC_DEFINE(HAVE_SETLOCALE)])
240
241CF_DISABLE_RPATH_HACK
242
243AC_OUTPUT(dialog-config makefile $EXTRA_OUTPUT $SUB_MAKEFILE samples/install/makefile,,,sort -u)
244