ncurses 5.6 - patch 20070128
[ncurses.git] / tack / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 2007 Free Software Foundation, Inc.                        *
3 dnl                                                                          *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
5 dnl copy of this software and associated documentation files (the            *
6 dnl "Software"), to deal in the Software without restriction, including      *
7 dnl without limitation the rights to use, copy, modify, merge, publish,      *
8 dnl distribute, distribute with modifications, sublicense, and/or sell       *
9 dnl copies of the Software, and to permit persons to whom the Software is    *
10 dnl furnished to do so, subject to the following conditions:                 *
11 dnl                                                                          *
12 dnl The above copyright notice and this permission notice shall be included  *
13 dnl in all copies or substantial portions of the Software.                   *
14 dnl                                                                          *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 dnl                                                                          *
23 dnl Except as contained in this notice, the name(s) of the above copyright   *
24 dnl holders shall not be used in advertising or otherwise to promote the     *
25 dnl sale, use or other dealings in this Software without prior written       *
26 dnl authorization.                                                           *
27 dnl***************************************************************************
28 dnl
29 dnl Author: Thomas E. Dickey    2007
30 dnl
31 dnl $Id: configure.in,v 1.2 2007/01/14 00:02:41 tom Exp $
32 dnl This is a simple configuration-script for tack which makes it simpler to
33 dnl build outside the ncurses tree (provided that ncurses was configured using
34 dnl the --with-ticlib option).
35 dnl
36 dnl See http://invisible-island.net/autoconf/ for additional information.
37 dnl ---------------------------------------------------------------------------
38 AC_PREREQ(2.13.20020210)
39 AC_INIT(tack.c)
40 AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
41
42 CF_INHERIT_SCRIPT(config.guess)
43 CF_INHERIT_SCRIPT(config.sub)
44 CF_CHECK_CACHE
45
46 AC_PROG_MAKE_SET
47 AC_PROG_CC
48 AC_PROG_CPP
49 AC_PROG_AWK
50 CF_PROG_INSTALL
51 AC_PROG_LN_S
52 CF_MAKE_TAGS
53
54 dnl Things that we don't need (or must override) if we're not building ncurses
55 CC_G_OPT="-g"                           AC_SUBST(CC_G_OPT)
56 CC_SHARED_OPTS=unknown                  AC_SUBST(CC_SHARED_OPTS)
57 CPPFLAGS="$CPPFLAGS"                    AC_SUBST(CPPFLAGS)
58 DESTDIR=""                              AC_SUBST(DESTDIR)
59 DFT_DEP_SUFFIX=""                       AC_SUBST(DFT_DEP_SUFFIX)
60 DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`    AC_SUBST(DFT_OBJ_SUBDIR)
61 DFT_UPR_MODEL="NORMAL"                  AC_SUBST(DFT_UPR_MODEL)
62 ECHO_LINK='@ echo linking $@ ... ;'     AC_SUBST(ECHO_LINK)
63 EXTRA_LDFLAGS=""                        AC_SUBST(EXTRA_LDFLAGS)
64 LD="ld"                                 AC_SUBST(LD)
65 LDFLAGS_SHARED=""                       AC_SUBST(LDFLAGS_SHARED)
66 LD_MODEL=""                             AC_SUBST(LD_MODEL)
67 LD_SHARED_OPTS=""                       AC_SUBST(LD_SHARED_OPTS)
68 LIBTOOL=""                              AC_SUBST(LIBTOOL)
69 LIB_CLEAN=""                            AC_SUBST(LIB_CLEAN)
70 LIB_COMPILE=""                          AC_SUBST(LIB_COMPILE)
71 LIB_INSTALL=""                          AC_SUBST(LIB_INSTALL)
72 LIB_LINK=""                             AC_SUBST(LIB_LINK)
73 LIB_SUFFIX=""                           AC_SUBST(LIB_SUFFIX)
74 LIB_UNINSTALL=""                        AC_SUBST(LIB_UNINSTALL)
75 LINK_PROGS=""                           AC_SUBST(LINK_PROGS)
76 LINT=lint                               AC_SUBST(LINT)
77 LINT_OPTS=""                            AC_SUBST(LINT_OPTS)
78 LOCAL_LDFLAGS=""                        AC_SUBST(LOCAL_LDFLAGS)
79 MATH_LIB="-lm"                          AC_SUBST(MATH_LIB)
80 TICS_ARGS=""                            AC_SUBST(TICS_ARGS)
81 TINFO_ARGS='$(LIBS_CURSES)'             AC_SUBST(TINFO_ARGS)
82 cf_cv_abi_version=""                    AC_SUBST(cf_cv_abi_version)
83 cf_cv_rel_version=""                    AC_SUBST(cf_cv_rel_version)
84
85 NCURSES_TREE="#"
86 AC_SUBST(NCURSES_TREE)
87
88 cf_cv_screen=curses
89 cf_cv_libtype=
90
91 AC_EXEEXT
92 AC_OBJEXT
93
94 CF_ANSI_CC_REQD
95 CF_ENABLE_WARNINGS
96 CF_GCC_ATTRIBUTES
97 CF_XOPEN_SOURCE
98
99 CF_WITH_CURSES_DIR
100
101 dnl SunOS 4.x
102 AC_ARG_WITH(5lib,
103         [  --with-5lib             use SunOS sysv-libraries],
104         [LIBS="-L/usr/5lib $LIBS"
105          CPPFLAGS="$CPPFLAGS -I/usr/5include"])
106
107 dnl ---------------------------------------------------------------------------
108 dnl NcursesW, installed in conventional location
109 AC_ARG_WITH(ncursesw,
110         [  --with-ncursesw         use wide ncurses-libraries (installed)],
111         [cf_cv_screen=ncursesw],[
112
113 dnl Ncurses, installed in conventional location
114 AC_ARG_WITH(ncurses,
115         [  --with-ncurses          use ncurses-libraries (installed)],
116         [cf_cv_screen=ncurses],[
117
118 AC_ARG_WITH(pdcurses,
119         [  --with-pdcurses         compile/link with pdcurses X11 library],
120         [cf_cv_screen=pdcurses])])])
121
122 case $cf_cv_screen in
123 curses)
124         CF_CURSES_CPPFLAGS
125         CF_NCURSES_VERSION
126         CF_CURSES_LIBS
127         ;;
128 ncurses)
129         CF_NCURSES_CPPFLAGS
130         CF_NCURSES_LIBS
131         ;;
132 ncursesw)
133         cf_cv_libtype=w
134         CF_NCURSES_CPPFLAGS(ncursesw)
135         CF_NCURSES_LIBS(ncursesw)
136         ;;
137 esac
138
139 dnl If we've not specified a library, assume we're using sysvr4 libraries
140 dnl installed conventionally (e.g., SunOS 5.x - solaris).
141
142 dnl Autoconf builds up the $LIBS in reverse order
143
144 # look for curses-related headers
145 AC_CHECK_HEADERS( \
146         nc_alloc.h \
147         nomacros.h \
148         )
149
150 AC_TYPE_SIGNAL
151
152 AC_STDC_HEADERS
153 AC_HEADER_TIME
154 AC_CHECK_HEADERS( \
155 getopt.h \
156 locale.h \
157 stdarg.h \
158 sys/ioctl.h \
159 sys/select.h \
160 sys/time.h \
161 termios.h \
162 unistd.h \
163 )
164
165 AC_CHECK_FUNCS( \
166 tgetent \
167 tigetnum \
168 tigetstr \
169 strstr \
170 )
171
172 CF_SYS_TIME_SELECT
173
174 TICS_ARGS="$LIBS"
175 LIBS=
176
177 dnl ---------------------------------------------------------------------------
178
179 AC_OUTPUT(Makefile,[
180 CF_PRG_RULES([$srcdir/mk-test.awk ECHO_LINK="$ECHO_LINK"], .)
181         cat >>Makefile <<TEST_EOF
182
183 # These rules are generated so we do not rely on suffix rules, which do not
184 # work consistently for different make-programs (the '\$(MODEL)/' confuses
185 # some, and the '\$x' confuses others).
186 TEST_EOF
187 LIST=`sed -e 's/[[      ]].*//' -e '/^[[#@]]/d' $srcdir/modules`
188 for N in $LIST
189 do
190         cat >>Makefile <<TEST_EOF
191
192 \$(MODEL)/$N.o : $N.c \\
193         tack.h \\
194         ncurses_cfg.h
195         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
196 TEST_EOF
197 done
198 ],[
199 AWK="$AWK"
200 ],cat)