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