1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT([PDCurses], [3.4], [wmcbrine@gmail.com], [PDCurses])
4AC_CONFIG_SRCDIR([pdcx11.h])
5
6AC_SUBST(prefix)
7
8AC_PROG_CC
9
10AC_CONFIG_HEADER(config.h)
11dnl Checks for system first
12AC_CANONICAL_SYSTEM([])
13
14on_qnx=no
15on_osx=no
16case "$target" in
17   *hp-hpux*)
18      SYS_DEFS="-D_HPUX_SOURCE"
19      ;;
20   *ibm-aix*)
21      SYS_DEFS="-D_ALL_SOURCE"
22      ;;
23   *dec-osf*)
24      SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED"
25      ;;
26   *pc-sco*)
27      SYS_DEFS="-UM_XENIX -b elf"
28      ;;
29   *qnx*)
30      on_qnx=yes
31      SYS_DEFS="-Q"
32      ;;
33   *apple-darwin*)
34      on_osx=yes
35      MH_CHECK_OSX_ARCH()
36      SYS_DEFS="$valid_arch_flags"
37      EEXTRA="$valid_arch_flags"
38      ;;
39   *)
40      ;;
41esac
42AC_SUBST(SYS_DEFS)
43AC_SUBST(EEXTRA)
44
45MH_CHECK_MAX_SIGNALS(NSIG __sys_nsig)
46
47dnl Check for other programs.
48AC_PROG_LN_S
49AC_PROG_RANLIB
50AC_PROG_INSTALL
51AC_PROG_MAKE_SET
52
53dnl ensure that the system has System V IPC support
54MH_IPC
55
56if test $ac_cv_header_stdc != yes; then
57   AC_MSG_ERROR([Need ANSI C headers])
58fi
59
60dnl Checks for libraries.
61
62dnl we check for dlfcn.h or dl.h so we know if we can build shared objects
63AC_CHECK_HEADERS(fcntl.h \
64   sys/time.h \
65   sys/select.h \
66   dlfcn.h \
67   dl.h
68)
69
70dnl Checks for typedefs, structures, and compiler characteristics.
71AC_HEADER_TIME
72MH_CHECK_LIB(socket nls)
73AC_SUBST(MH_EXTRA_LIBS)
74MH_CHECK_CC_O
75
76dnl Checks for library functions.
77AC_TYPE_SIGNAL
78AC_CHECK_FUNCS(vsscanf usleep poll vsnprintf)
79
80dnl Check for X includes and X libraries
81AC_PATH_X
82MH_CHECK_X_INC
83MH_CHECK_X_LIB
84MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h xpm.h XF86keysym.h)
85MH_CHECK_X_KEYDEFS(XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \
86   XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin)
87MH_CHECK_X_TYPEDEF(XPointer)
88dnl
89dnl extra for xpm library
90if test $ac_cv_header_xpm_h = yes; then
91   MH_XLIBS="$MH_XLIBS -lXpm"
92fi
93dnl ---------- allow --enable-debug to compile in debug mode ---------
94AC_ARG_ENABLE(debug,
95   [  --enable-debug          turn on debugging],
96   [with_debug=$enableval],
97   [with_debug=no],
98)
99cflags_g="`echo $CFLAGS | grep -c '\-g'`"
100cflags_O="`echo $CFLAGS | grep -c '\-O'`"
101
102if test "$with_debug" = yes; then
103   if test "$cflags_g" = "0"; then
104      CFLAGS="${CFLAGS} -g"
105   fi
106   if test "$cflags_O" != "0"; then
107      CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`"
108   fi
109   CFLAGS="${CFLAGS} -DPDCDEBUG"
110else
111   if test "$cflags_O" = "0"; then
112      CFLAGS="${CFLAGS} -O"
113   fi
114   if test "$cflags_g" != "0"; then
115      CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`"
116   fi
117fi
118if test "$ac_cv_prog_CC" = "gcc"; then
119   if test "$with_debug" = yes; then
120      CFLAGS="${CFLAGS} -Wall"
121   else
122      CFLAGS="-O2 -Wall -fomit-frame-pointer"
123   fi
124fi
125if test "$on_qnx" = yes; then
126   if test "$with_debug" = yes; then
127      CFLAGS="-g"
128   else
129      CFLAGS="-Otax"
130   fi
131fi
132
133dnl --------------- check for wide character support -----------------
134dnl allow --enable-widec to include wide character support
135AC_ARG_ENABLE(widec,
136   [  --enable-widec          include support for wide characters],
137   [with_widec=$enableval],
138   [with_widec=no],
139)
140PDC_WIDE=""
141if test "$with_widec" = yes; then
142   PDC_WIDE="-DPDC_WIDE"
143   SYS_DEFS="$SYS_DEFS $PDC_WIDE"
144fi
145AC_SUBST(PDC_WIDE)
146
147dnl -------------------- check for XIM support -----------------------
148dnl allow --enable-xim to include XIM support
149AC_ARG_ENABLE(xim,
150   [  --enable-xim            include support for XIM],
151   [with_xim=$enableval],
152   [with_xim=no],
153)
154if test "$with_xim" = yes; then
155   SYS_DEFS="$SYS_DEFS -DPDC_XIM"
156fi
157
158dnl ------------------------ force UTF-8? ----------------------------
159dnl allow --enable-force-utf8 to override locale settings
160AC_ARG_ENABLE(force-utf8,
161   [  --enable-force-utf8     override locale settings; use UTF-8],
162   [force_utf8=$enableval],
163   [force_utf8=no],
164)
165if test "$force_utf8" = yes; then
166   SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8"
167fi
168
169dnl ----------------- check for Purify support -----------------------
170dnl allow --enable-purify to enable linking with Purify
171AC_ARG_ENABLE(purify,
172   [  --enable-purify         link with Purify (TM)],
173   [with_purify=$enableval],
174   [with_purify=no],
175)
176if test "$with_purify" = yes; then
177   PURIFY="purify"
178else
179   PURIFY=""
180fi
181AC_SUBST(PURIFY)
182
183dnl --------------------- check for Xaw3d library --------------------
184dnl allow --with-xaw3d to link with PDCurses
185AC_ARG_WITH(xaw3d,
186   [  --with-xaw3d            link with Xaw3d],
187   [with_xaw3d=$withval],
188   [with_xaw3d=no],
189)
190if test "$with_xaw3d" = yes; then
191   AC_DEFINE([USE_XAW3D], [1],
192      [Define if you want to use Xaw3d library]
193   )
194fi
195
196dnl --------------------- check for neXtaw library -------------------
197dnl allow --with-nextaw to link with PDCurses
198AC_ARG_WITH(nextaw,
199   [  --with-nextaw           link with neXtaw],
200   [with_nextaw=$withval],
201   [with_nextaw=no],
202)
203if test "$with_nextaw" = yes; then
204   AC_DEFINE([USE_NEXTAW], [1],
205      [Define if you want to use neXtaw library]
206   )
207fi
208
209dnl -------------- check how to make shared libraries ----------------
210dnl Force the ability of shared library usage
211USE_ABI=yes
212MH_SHARED_LIBRARY(XCurses)
213
214MH_CHECK_RPM()
215MH_GET_DISTRO_NAME()
216MH_CHECK_ARCH
217
218AC_CONFIG_FILES([Makefile xcurses-config])
219AC_OUTPUT
220
221AC_DEFINE([PDC_MAX_SIGNALS], [],
222   [Define as the system defined limit for number of signals]
223)
224
225AC_DEFINE([HAVE_DECKEYSYM_H], [],
226   [Define if you have the <DECkeySym.h> header file]
227)
228
229AC_DEFINE([HAVE_SUNKEYSYM_H], [],
230   [Define if you have the <Sunkeysym.h> header file]
231)
232
233AC_DEFINE([HAVE_XF86KEYSYM_H], [],
234   [Define if you have the <XF86keysym.h> header file]
235)
236
237AC_DEFINE([HAVE_XPM_H], [],
238   [Define if you have the <xpm.h> header file]
239)
240
241AC_DEFINE([HAVE_XK_KP_DELETE], [],
242   [Define if you have this defined in <keysym.h>]
243)
244
245AC_DEFINE([HAVE_XK_KP_INSERT], [],
246   [Define if you have this defined in <keysym.h>]
247)
248
249AC_DEFINE([HAVE_XK_KP_END], [],
250   [Define if you have this defined in <keysym.h>]
251)
252
253AC_DEFINE([HAVE_XK_KP_DOWN], [],
254   [Define if you have this defined in <keysym.h>]
255)
256
257AC_DEFINE([HAVE_XK_KP_NEXT], [],
258   [Define if you have this defined in <keysym.h>]
259)
260
261AC_DEFINE([HAVE_XK_KP_LEFT], [],
262   [Define if you have this defined in <keysym.h>]
263)
264
265AC_DEFINE([HAVE_XK_KP_RIGHT], [],
266   [Define if you have this defined in <keysym.h>]
267)
268
269AC_DEFINE([HAVE_XK_KP_HOME], [],
270   [Define if you have this defined in <keysym.h>]
271)
272
273AC_DEFINE([HAVE_XK_KP_UP], [],
274   [Define if you have this defined in <keysym.h>]
275)
276
277AC_DEFINE([HAVE_XK_KP_PRIOR], [],
278   [Define if you have this defined in <keysym.h>]
279)
280
281AC_DEFINE([HAVE_XK_KP_BEGIN], [],
282   [Define if you have this defined in <keysym.h>]
283)
284
285AC_DEFINE([USE_XAW3D], [],
286   [Define if you want to use Xaw3d library]
287)
288
289AC_DEFINE([USE_NEXTAW], [],
290   [Define if you want to use neXtaw library]
291)
292
293AC_DEFINE([XPOINTER_TYPEDEFED], [],
294   [Define XPointer is typedefed in X11/Xlib.h]
295)
296