1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(THE, m4_esyscmd_s([grep VER_DOT ./the.ver | cut -f 2 -d '=']), mark@rexx.org, THE) 3AC_PREFIX_DEFAULT(/usr/local) 4 5MH_PACKAGE="THE" 6 7. $srcdir/the.ver 8VERSION_NODOT=\"$VER\" 9VERSION=\"$VER_DOT\" 10VERSION_UNQUOTED=$VER_DOT 11VER_DATE=\"$VER_DATE\" 12AC_SUBST(VERSION) 13AC_SUBST(VERSION_UNQUOTED) 14AC_SUBST(VERSION_NODOT) 15AC_SUBST(VER_DATE) 16cp $srcdir/common/config.guess $srcdir 17cp $srcdir/common/config.sub $srcdir 18 19dnl ---------------------- check for C compiler ----------------- 20dnl Checks for one of the C compilers below - change if yours not there. 21 22MH_PROG_CC 23 24AC_CONFIG_HEADER(config.h) 25AC_ISC_POSIX 26 27dnl Checks for system first 28AC_CANONICAL_SYSTEM 29 30dnl 31dnl include our 32/64bit tests 32dnl 33sinclude(common/inclibarch.m4) 34dnl 35dnl Test if using g++ and if its broken WRT string.h 36if test "$ac_cv_prog_CC" = "g++"; then 37 MH_HAVE_BROKEN_CXX_WITH_STRING_H 38fi 39 40BASE_BINARY="binarybase" 41BASE_INSTALL="installbase" 42on_qnx=no 43on_cygwin="no" 44case "$target" in 45 *hp-hpux9*) 46 SYS_DEFS="-D_HPUX_SOURCE" 47 AC_DEFINE(SELECT_IN_TIME_H) 48 ;; 49 *hp-hpux*) 50 SYS_DEFS="-D_HPUX_SOURCE" 51 if test "$ac_cv_prog_CC" != "gcc"; then 52 if test "$enable_hpux_portable" = yes; then 53 SYS_DEFS="${SYS_DEFS} +DAportable" 54 fi 55 fi 56 ;; 57 *ibm-aix*) 58 SYS_DEFS="-D_ALL_SOURCE" 59 ;; 60 *ibm-OS390*) 61 SYS_DEFS="-D_ALL_SOURCE -DOS390" 62 ;; 63 *dec-osf4*) 64 SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED" 65 AC_DEFINE(HAVE_BROKEN_SYS_ACL_H) 66 ;; 67 *dec-osf*) 68 ;; 69 *sequent-dynix*) 70 ;; 71 *solaris*) 72 ;; 73 sparc*sunos*) 74 ;; 75 *linux*) 76 ;; 77 *cygwin*) 78 BASE_BINARY="cygwinbinary" 79 on_cygwin="yes" 80 ;; 81 *sgi-irix*) 82 SYS_DEFS="-DSGI_MPROT_T_UNDEFINED" 83 ;; 84 *pc-sco*) 85 SYS_DEFS="-UM_XENIX -b elf" 86 ;; 87 *nto-qnx*) 88 ;; 89 *qnx*) 90 on_qnx=yes 91 SYS_DEFS="-Q" 92 EEXTRA="-mf -N0x20000 -Q" 93 SIMPLE_CFLAGS=yes 94 ;; 95 *beos*) 96 if test "$prefix" != "/usr"; then 97 prefix=/boot/home/config 98 fi 99 ;; 100 *apple-darwin*) 101# sinclude(common/inclibarch.m4) MUST have been included before here 102 SYS_DEFS="$valid_arch_flags" 103 EEXTRA="$valid_arch_flags -flat_namespace -undefined suppress" 104 ;; 105 *darwin*) 106 EEXTRA="-flat_namespace -undefined suppress" 107 ;; 108esac 109AC_SUBST(EEXTRA) 110AC_SUBST(BASE_BINARY) 111AC_SUBST(BASE_INSTALL) 112 113MH_GET_KERNEL_NAME 114 115dnl ---------------------- check for '--with-dist' switch ----------------- 116AC_ARG_WITH(dist, 117 [ --with-dist specify this just to build a distribution], 118 [with_dist=$withval], 119 [with_dist=no], 120) 121 122dnl ---------------------- check for Curses argument ----------------- 123dnl allow --with-dwindows to link with dwindows 124AC_ARG_WITH(dwindows, 125 [ --with-dwindows build with dwindows(incomplete)], 126 [with_dwindows=$withval], 127 [with_dwindows=no], 128) 129dnl allow --with-xcurses to link with XCurses 130AC_ARG_WITH(xcurses, 131 [ --with-xcurses link with XCurses], 132 [with_xcurses=$withval], 133 [with_xcurses=no], 134) 135dnl allow --with-xcurses-static to link with static XCurses library 136AC_ARG_WITH(xcurses-static, 137 [ --with-xcurses-static link with static XCurses library], 138 [with_xcurses_static=$withval], 139 [with_xcurses_static=no], 140) 141dnl allow --with-pdcurses to link with PDCurses 142AC_ARG_WITH(pdcurses, 143 [ --with-pdcurses link with PDCurses (cygwin only)], 144 [with_pdcurses=$withval], 145 [with_pdcurses=no], 146) 147dnl allow --with-ncurses to link with ncurses 148AC_ARG_WITH(ncurses, 149 [ --with-ncurses link with ncurses], 150 [with_ncurses=$withval], 151 [with_ncurses=no], 152) 153dnl allow --with-extcurses to link with AIX Extended curses 154AC_ARG_WITH(extcurses, 155 [ --with-extcurses link with AIX Extended curses], 156 [with_extcurses=$withval], 157 [with_extcurses=no], 158) 159if test "$on_cygwin" = no -a "$with_pdcurses" = yes; then 160 AC_MSG_ERROR(--with-pdcurses only valid on cygwin platform; THE cannot be configured) 161fi 162 163dnl --------------- allow --enable-utf8 to allow UTF-8 files -------- 164AC_ARG_ENABLE(utf8, 165 [ --enable-utf8 enable UTF8 support], 166 [with_utf8=$enableval], 167 [with_utf8=no], 168) 169 170dnl 171dnl Check lots of things specific to AIX 172dnl 173dnl Check that the OS supports extended curses 174dnl Only supporting it on AIX 3.x 175dnl 176if test "$with_extcurses" = yes ; then 177 case "$target" in 178 *aix3*) 179 ;; 180 *) 181 AC_MSG_ERROR(Extended Curses support only available on AIX 3.x; THE cannot be configured) 182 ;; 183 esac 184fi 185 186if test "$with_ncurses" = no -a "$with_xcurses" = no; then 187 case "$target" in 188 *ibm-aix4.3*) 189 SYS_DEFS="${SYS_DEFS} -DHAVE_BROKEN_COLORS" 190 ;; 191 *) 192 ;; 193 esac 194fi 195dnl _XOPEN_SOURCE_EXTENDED needed for ncursesw 196dnl if test "$enable_utf8" = yes; then 197dnl SYS_DEFS="${SYS_DEFS} -D_XOPEN_SOURCE_EXTENDED" 198dnl fi 199AC_SUBST(SYS_DEFS) 200 201dnl 202dnl check for only 1 curses library specified 203dnl 204THEBIN="the" 205THETYPE="" 206WIDE_CHAR="" 207checkcurses="no" 208typeset -i curs_count 209curs_count=0 210if test "$with_ncurses" = yes; then 211 THEBIN="nthe" 212 THETYPE="ncurses" 213 checkcurses="yes" 214 curs_count=$curs_count+1 215 if test "$enable_utf8" = yes; then 216 WIDE_CHAR="-DUSE_UTF8" 217 THETYPE="ncursesw" 218 THEBIN="nwthe" 219 fi 220fi 221if test "$with_xcurses" = yes; then 222 THEBIN="xthe" 223 THETYPE="X11" 224 checkcurses="yes" 225 curs_count=$curs_count+1 226 if test "$enable_utf8" = yes; then 227 WIDE_CHAR="-DUSE_UTF8 -DUSE_WIDE_CHAR -DPDC_WIDE -DPDC_FORCE_UTF8" 228 THETYPE="X11w" 229 THEBIN="xwthe" 230 fi 231fi 232if test "$with_xcurses_static" = yes; then 233 THEBIN="xthe" 234 THETYPE="X11" 235 checkcurses="yes" 236 curs_count=$curs_count+1 237 if test "$enable_utf8" = yes; then 238 WIDE_CHAR="-DUSE_UTF8 -DUSE_WIDE_CHAR -DPDC_WIDE -DPDC_FORCE_UTF8" 239 THETYPE="X11w" 240 THEBIN="xwthe" 241 fi 242fi 243if test "$with_pdcurses" = yes; then 244 THEBIN="the" 245 THETYPE="pdcurses" 246 checkcurses="yes" 247 curs_count=$curs_count+1 248fi 249if test "$with_dwindows" = yes; then 250 THEBIN="dwthe" 251 THETYPE="dwindows" 252 curs_count=$curs_count+1 253 if test "$enable_utf8" = yes; then 254 WIDE_CHAR="-DUSE_UTF8 -DUSE_WIDE_CHAR -DPDC_WIDE -DPDC_FORCE_UTF8" 255 THETYPE="dwindowsw" 256 THEBIN="dwwthe" 257 fi 258fi 259if test "$with_extcurses" = yes; then 260 curs_count=$curs_count+1 261fi 262if test $curs_count -gt 1; then 263 AC_MSG_ERROR(More than 1 Curses library specified; THE cannot be configured) 264fi 265dnl set defines for wide character support 266AC_SUBST(THEBIN) 267AC_SUBST(THETYPE) 268AC_SUBST(WIDE_CHAR) 269 270dnl allow --with-cursesincdir to specify where Curses header file is 271AC_ARG_WITH(cursesincdir, 272 [ --with-cursesincdir=DIR specify where curses header file is], 273 [with_cursesincdir=$withval], 274 [with_cursesincdir=no], 275) 276dnl allow --with-curseslibdir to specify where Curses library file is 277AC_ARG_WITH(curseslibdir, 278 [ --with-curseslibdir=DIR specify where curses library file is], 279 [with_curseslibdir=$withval], 280 [with_curseslibdir=no], 281) 282 283dnl 284dnl include Rexx support 285dnl 286sinclude(common/increxx.m4) 287 288dnl ---------------------- check for Xaw3d library ------------------- 289dnl allow --with-xaw3d to link with XCurses 290AC_ARG_WITH(xaw3d, 291 [ --with-xaw3d link with Xaw3d], 292 [with_xaw3d=$withval], 293 [with_xaw3d=no], 294) 295 296dnl ---------------------- check for neXtaw library ------------------- 297dnl allow --with-nextaw to link with XCurses 298AC_ARG_WITH(nextaw, 299 [ --with-nextaw link with neXtaw], 300 [with_nextaw=$withval], 301 [with_nextaw=no], 302) 303 304dnl ---------------------- check for Checker ------------------------- 305dnl allow --with-checker to use Checker 306AC_ARG_WITH(checker, 307 [ --with-checker build THE with Checker], 308 [with_checker=$withval], 309 [with_checker=no], 310) 311 312dnl ---------------------- check packages ----------------------- 313dnl Check for general libraries. MUST be before MH_CHECK_CURSES 314dnl 315MH_LIBS_TO_CHECK="m s socket nls" 316MH_CHECK_LIB(${MH_LIBS_TO_CHECK}) 317AC_SUBST(MH_EXTRA_LIBS) 318 319dnl ---------------------- check Curses ------------------------- 320dnl don't check for Curses or Rexx arguments if only building for distribution 321if test "$checkcurses" = "yes"; then 322 MH_CHECK_CURSES 323fi 324 325dnl ---------------------- check packages ----------------------- 326dnl Check for X libraries if using XCurses and we don't have xcurses-config 327dnl MUST be after MH_CHECK_CURSES 328dnl 329MH_XLIBS="" 330MH_XINC_DIR="" 331dnl if test "$with_xcurses" = yes; then 332dnl if test "$ac_cv_prog_xcurses_config" = yes; then 333dnl MX_XINC_DIR=`xcurses-config --cflags` 334dnl MH_XLIBS=`xcurses-config --libs` 335dnl else 336dnl MH_CHECK_X_LIB 337dnl fi 338dnl fi 339AC_SUBST(MH_XLIBS) 340AC_SUBST(MH_XINC_DIR) 341 342dnl --------------------- Check for other programs. --------------- 343AC_PROG_MAKE_SET 344MH_CHECK_CHECKER 345 346dnl -------------------- Checks for header files. ----------------- 347AC_HEADER_STDC 348AC_CHECK_HEADERS( \ 349 errno.h \ 350 alloca.h \ 351 ctype.h \ 352 wctype.h \ 353 sys/types.h \ 354 sys/mode.h \ 355 sys/stat.h \ 356 sys/socket.h \ 357 sys/file.h \ 358 sys/wait.h \ 359 sys/acl.h \ 360 sys/time.h \ 361 sys/select.h \ 362 select.h \ 363 unistd.h \ 364 stdlib.h \ 365 memory.h \ 366 fcntl.h \ 367 locale.h \ 368 string.h \ 369 stdarg.h \ 370 stdint.h \ 371 inttypes.h \ 372 stat.h \ 373 dirent.h \ 374 time.h 375 ) 376 377MH_HAVE_PROTO 378 379dnl Checks for typedefs, structures, and compiler characteristics. 380if test "$ac_cv_prog_CC" != "g++"; then 381 AC_C_CONST 382fi 383AC_TYPE_SIZE_T 384AC_HEADER_TIME 385AC_STRUCT_TM 386MH_C_LONG_LONG 387 388dnl Checks for library functions. 389AC_FUNC_MEMCMP 390AC_FUNC_ALLOCA 391AC_TYPE_SIGNAL 392MH_FUNC_ACL_GET 393MH_CHECK_FUNCS(rename lstat readlink getacl chown strcasecmp strcmpi stricmp mkfifo select siginterrupt setlocale realpath fork) 394 395if test "$checkcurses" = "yes"; then 396 MH_CHECK_CHTYPE 397 MH_CHECK_BROKEN_SYSVR4_CURSES 398 MH_CURSES_FUNCS 399fi 400 401dnl 402dnl include our debugging switch checking 403dnl 404sinclude(common/incdebug.m4) 405 406dnl --------------- allow --enable-bounds-checking to compile in debug mode -------- 407AC_ARG_ENABLE(bounds-checking, 408 [ --enable-bounds-checking turn on bounds checking], 409 [with_bounds_checking=$enableval], 410 [with_bounds_checking=no], 411) 412 413if test "$with_bounds_checking" = yes; then 414 CFLAGS="${CFLAGS} -fbounds-check -D__BOUNDS_CHECKING_ON" 415fi 416 417dnl --------------- allow --enable-trace to log trace information -------- 418AC_ARG_ENABLE(trace, 419 [ --enable-trace turn on tracing], 420 [with_trace=$enableval;AC_DEFINE(THE_TRACE)], 421 [with_trace=no] 422) 423if test "$with_trace" = yes; then 424 MH_XTRA_OBJS="$MH_XTRA_OBJS trace.o" 425fi 426if test "$enable_utf8" = yes; then 427 MH_XTRA_OBJS="$MH_XTRA_OBJS utf8.o" 428fi 429AC_SUBST(MH_XTRA_OBJS) 430 431dnl --------------- allow --with-htmlext to specify file extension of HTML files 432AC_ARG_WITH(htmlext, 433 [ --with-htmlext specify extension of HTML files], 434 [HTML_EXT=.$withval], 435 [HTML_EXT=.html], 436) 437AC_SUBST(HTML_EXT) 438 439dnl --------------- allow --with-global-profile to specify a global profile file 440AC_ARG_WITH(global-profile, 441 [ --with-global-profile specify name of global profile file], 442 [THE_GLOBAL_PROFILE="$withval"], 443 [THE_GLOBAL_PROFILE=""], 444) 445if test x"$THE_GLOBAL_PROFILE" != x; then 446 AC_DEFINE_UNQUOTED(THE_GLOBAL_PROFILE,"$THE_GLOBAL_PROFILE") 447fi 448 449dnl 450dnl include our check for RPM 451dnl 452MH_CHECK_RPM 453MH_GET_DISTRO_NAME() 454 455dnl --------------- Force definition of pre-compiler macro UNIX ---------- 456AC_DEFINE(UNIX) 457 458dnl --------------- Force definition of this build number ---------------- 459AC_DEFINE(BUILD3001) 460 461dnl --------------- Find us an xterm if using XCurses -------------------- 462MH_FIND_XTERM 463 464dnl --------------- Get us an install package ---------------------------- 465AC_PROG_INSTALL 466 467thisdir="`pwd`" 468AC_SUBST(thisdir) 469 470dnl ---- leave the setting of CC to last 471if test "$mh_cv_checker" = yes; then 472 CC="checkergcc" 473 AC_DEFINE(CC) 474fi 475 476AC_OUTPUT(Makefile) 477 478dnl 479dnl include our status information 480dnl 481if test "$with_dist" = no; then 482 MH_SHOW_STATUS( MH_SHOW_THE, "notrailer" ) 483 echo "To build the '$THEBIN' executable, text and normal HTML documentation; 'make'" 484 echo "then to install THE in the above directories; 'make install'" 485 echo 486 echo "Individual portions of THE can be built as follows:" 487 echo "- To build the 'the' executable; 'make the'" 488 echo "- To build a text reference manual; 'make the.man'" 489 echo "- To build the help file; THE_Help.txt; 'make THE_Help.txt'" 490 echo "- To build the normal HTML reference manual; 'make html'" 491 echo "- To build a HTML reference manual in one file; 'make combined'" 492 echo "- To build a HTML reference manual in separate files; 'make helpviewer'" 493 echo "- To build a PDF reference manual; 'make pdf' - this requires htmldoc" 494 echo 495else 496 echo "" 497 echo "Source distributions (zip and dist) can now be made for $MH_PACKAGE" 498 echo "" 499 rm -f config.h 500fi 501