1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT([PDCurses], [3.5], [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
15case "$target" in
16	*hp-hpux*)
17		SYS_DEFS="-D_HPUX_SOURCE"
18		;;
19	*dec-osf*)
20		SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED"
21		;;
22	*pc-sco*)
23		SYS_DEFS="-UM_XENIX -b elf"
24		;;
25	*qnx*)
26		on_qnx=yes
27		SYS_DEFS="-Q"
28		;;
29	*)
30		;;
31esac
32AC_SUBST(SYS_DEFS)
33
34MH_CHECK_MAX_SIGNALS(NSIG __sys_nsig)
35
36dnl Check for other programs.
37AC_PROG_RANLIB
38AC_PROG_INSTALL
39AC_PROG_MAKE_SET
40
41dnl ensure that the system has System V IPC support
42MH_IPC
43
44if test $ac_cv_header_stdc != yes; then
45	AC_MSG_ERROR([Need ANSI C headers])
46fi
47
48dnl Checks for libraries.
49
50AC_CHECK_HEADERS(fcntl.h \
51	sys/time.h \
52	sys/select.h
53)
54
55dnl Checks for typedefs, structures, and compiler characteristics.
56AC_HEADER_TIME
57MH_CHECK_LIB(socket nls)
58AC_SUBST(MH_EXTRA_LIBS)
59MH_CHECK_CC_O
60
61dnl Checks for library functions.
62AC_CHECK_FUNCS(vsscanf usleep poll vsnprintf)
63
64dnl Check for X includes and X libraries
65AC_PATH_X
66MH_CHECK_X_INC
67MH_CHECK_X_LIB
68MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h xpm.h)
69MH_CHECK_X_TYPEDEF(XPointer)
70dnl
71dnl extra for xpm library
72if test $ac_cv_header_xpm_h = yes; then
73	MH_XLIBS="$MH_XLIBS -lXpm"
74fi
75dnl ---------- allow --enable-debug to compile in debug mode ---------
76AC_ARG_ENABLE(debug,
77	[  --enable-debug          turn on debugging],
78	[with_debug=$enableval],
79	[with_debug=no],
80)
81cflags_g="`echo $CFLAGS | grep -c '\-g'`"
82cflags_O="`echo $CFLAGS | grep -c '\-O'`"
83
84if test "$with_debug" = yes; then
85	if test "$cflags_g" = "0"; then
86		CFLAGS="${CFLAGS} -g"
87	fi
88	if test "$cflags_O" != "0"; then
89		CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`"
90	fi
91	CFLAGS="${CFLAGS} -DPDCDEBUG"
92else
93	if test "$cflags_O" = "0"; then
94		CFLAGS="${CFLAGS} -O"
95	fi
96	if test "$cflags_g" != "0"; then
97		CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`"
98	fi
99fi
100if test "$ac_cv_prog_CC" = "gcc"; then
101	if test "$with_debug" = yes; then
102		CFLAGS="${CFLAGS} -Wall"
103	else
104		CFLAGS="-O2 -Wall -fomit-frame-pointer"
105	fi
106fi
107if test "$on_qnx" = yes; then
108	if test "$with_debug" = yes; then
109		CFLAGS="-g"
110	else
111		CFLAGS="-Otax"
112	fi
113fi
114
115dnl --------------- check for wide character support -----------------
116dnl allow --enable-widec to include wide character support
117AC_ARG_ENABLE(widec,
118	[  --enable-widec          include support for wide characters],
119	[with_widec=$enableval],
120	[with_widec=no],
121)
122PDC_WIDE=""
123if test "$with_widec" = yes; then
124	PDC_WIDE="-DPDC_WIDE"
125	SYS_DEFS="$SYS_DEFS $PDC_WIDE"
126fi
127AC_SUBST(PDC_WIDE)
128
129dnl -------------------- check for XIM support -----------------------
130dnl allow --enable-xim to include XIM support
131AC_ARG_ENABLE(xim,
132	[  --enable-xim            include support for XIM],
133	[with_xim=$enableval],
134	[with_xim=no],
135)
136if test "$with_xim" = yes; then
137	SYS_DEFS="$SYS_DEFS -DPDC_XIM"
138fi
139
140dnl ------------------------ force UTF-8? ----------------------------
141dnl allow --enable-force-utf8 to override locale settings
142AC_ARG_ENABLE(force-utf8,
143	[  --enable-force-utf8     override locale settings; use UTF-8],
144	[force_utf8=$enableval],
145	[force_utf8=no],
146)
147if test "$force_utf8" = yes; then
148	SYS_DEFS="$SYS_DEFS -DPDC_FORCE_UTF8"
149fi
150
151dnl ----------------- check for Purify support -----------------------
152dnl allow --enable-purify to enable linking with Purify
153AC_ARG_ENABLE(purify,
154	[  --enable-purify         link with Purify (TM)],
155	[with_purify=$enableval],
156	[with_purify=no],
157)
158if test "$with_purify" = yes; then
159	PURIFY="purify"
160else
161	PURIFY=""
162fi
163AC_SUBST(PURIFY)
164
165dnl --------------------- check for Xaw3d library --------------------
166dnl allow --with-xaw3d to link with PDCurses
167AC_ARG_WITH(xaw3d,
168	[  --with-xaw3d            link with Xaw3d],
169	[with_xaw3d=$withval],
170	[with_xaw3d=no],
171)
172if test "$with_xaw3d" = yes; then
173	AC_DEFINE([USE_XAW3D], [1],
174		[Define if you want to use Xaw3d library]
175	)
176fi
177
178dnl --------------------- check for neXtaw library -------------------
179dnl allow --with-nextaw to link with PDCurses
180AC_ARG_WITH(nextaw,
181	[  --with-nextaw           link with neXtaw],
182	[with_nextaw=$withval],
183	[with_nextaw=no],
184)
185if test "$with_nextaw" = yes; then
186	AC_DEFINE([USE_NEXTAW], [1],
187		[Define if you want to use neXtaw library]
188	)
189fi
190
191dnl -------------- check how to make shared libraries ----------------
192dnl Force the ability of shared library usage
193MH_SHARED_LIBRARY(XCurses)
194
195AC_CONFIG_FILES([Makefile xcurses-config])
196AC_OUTPUT
197
198AC_DEFINE([PDC_MAX_SIGNALS], [],
199	[Define as the system defined limit for number of signals]
200)
201
202AC_DEFINE([HAVE_DECKEYSYM_H], [],
203	[Define if you have the <DECkeySym.h> header file]
204)
205
206AC_DEFINE([HAVE_SUNKEYSYM_H], [],
207	[Define if you have the <Sunkeysym.h> header file]
208)
209
210AC_DEFINE([HAVE_XPM_H], [],
211	[Define if you have the <xpm.h> header file]
212)
213
214AC_DEFINE([USE_XAW3D], [],
215	[Define if you want to use Xaw3d library]
216)
217
218AC_DEFINE([USE_NEXTAW], [],
219	[Define if you want to use neXtaw library]
220)
221
222AC_DEFINE([XPOINTER_TYPEDEFED], [],
223	[Define XPointer is typedefed in X11/Xlib.h]
224)
225