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