1dnl Process this file with autoconf to produce a configure script. 2dnl configure.in for xpuzzles. 3AC_INIT() 4 5dnl Checks for programs. 6AC_ARG_WITH(gcc, 7[ --with-gcc use GCC to compile]) 8dnl AC_ARG_WITH(debug, 9dnl [ --with-debug compile with -g, if no optimize]) 10 11test -n "$CC" && cc_specified=yes 12case ${with_gcc} in 13 yes ) CC=gcc ;; 14dnl yes ) CC=g++ ;; 15 no ) CC=cc ;; 16 * ) AC_PROG_CC;; 17dnl * ) AC_PROG_CXX ;; 18esac 19 20dnl case ${with_debug} in 21dnl yes ) CFLAGS="${CFLAGS} -g" ;; 22dnl no ) CFLAGS="${CFLAGS} -O" ;; 23dnl esac 24 25if test "${CC}" = "gcc" ; then 26 CFLAGS="${CFLAGS} -Wall" 27fi 28 29AC_PROG_LN_S 30AC_PROG_CPP 31AC_AIX 32AC_PROG_INSTALL 33dnl Optional features. 34dnl add copious amounts of debugging with gcc 35 36dnl Checks for header files. 37dnl AC_HEADER_STDC /* If its not ansi, its not going to go */ 38dnl AC_CHECK_HEADERS(poll.h sys/poll.h) 39AC_CHECK_HEADERS(fcntl.h unistd.h) 40 41dnl Checks for typedefs, structures, and compiler characteristics. 42AC_C_CONST 43 44dnl Checks for library functions. 45dnl AC_CHECK_FUNCS(select) 46 47dnl X Window System files. 48AC_PATH_XTRA 49if test "$no_x" = yes; then 50 XLIBS=NONE 51else 52 if test -n "${x_includes}"; then 53 XWIDGETINC="-I${x_includes} ${XWIDGETINC}" 54 XMWIDGETINC="-I${x_includes} ${XMWIDGETINC}" 55 fi 56 XLIBS="${x_libraries}" 57 if test -n "${x_libraries}"; then 58 XWIDGET_LDFLAGS="/usr/lib:${x_libraries}" 59 XMWIDGET_LDFLAGS="/usr/lib:${x_libraries}" 60 XWIDGETLIBPATHS="-L${x_libraries} ${XWIDGETLIBPATHS}" 61 XMWIDGETLIBPATHS="-L${x_libraries} ${XMWIDGETLIBPATHS}" 62 fi 63 LIBS="${X_PRE_LIBS} -lXt -lX11 ${X_EXTRA_LIBS} ${LIBS}" 64dnl AC_DEFINE(X11) /* If there is no X, its not going to go */ 65fi 66 67dnl Xm MOTIF Motif motif 68 69AC_DEFUN(AC_PATH_MOTIF_DIRECT, 70[test -z "$motif_direct_test_library" && motif_direct_test_library=Xm 71test -z "$motif_direct_test_function" && motif_direct_test_function=XmCreatePushButton 72test -z "$motif_direct_test_include" && motif_direct_test_include=Xm/Xm.h 73 for ac_dir in \ 74 /usr/include/Motif1.2 \ 75 /usr/Motif1.2/include \ 76 \ 77 /usr/motif/include \ 78 \ 79 /usr/X11R6/include \ 80 /usr/X11R5/include \ 81 /usr/X11R4/include \ 82 \ 83 /usr/include/X11R6 \ 84 /usr/include/X11R5 \ 85 /usr/include/X11R4 \ 86 \ 87 /usr/local/X11R6/include \ 88 /usr/local/X11R5/include \ 89 /usr/local/X11R4/include \ 90 \ 91 /usr/local/include/X11R6 \ 92 /usr/local/include/X11R5 \ 93 /usr/local/include/X11R4 \ 94 \ 95 /usr/X11/include \ 96 /usr/include/X11 \ 97 /usr/local/X11/include \ 98 /usr/local/include/X11 \ 99 \ 100 /usr/X386/include \ 101 /usr/x386/include \ 102 /usr/XFree86/include/X11 \ 103 \ 104 /usr/dt/include \ 105 \ 106 /usr/local/include \ 107 /usr/include \ 108 /usr/unsupported/include \ 109 /usr/athena/include \ 110 /usr/local/x11r5/include \ 111 /usr/lpp/Xamples/include \ 112 ; \ 113 do 114 if test -r "$ac_dir/$motif_direct_test_include"; then 115 no_motif= ac_motif_includes=$ac_dir 116 break 117 fi 118 done 119 120# Check for the libraries. 121# See if we find them without any special options. 122# Don't add to $LIBS permanently. 123ac_save_LIBS="$LIBS" 124LIBS="-l$motif_direct_test_library $LIBS" 125# First see if replacing the include by lib works. 126for ac_dir in `echo "$ac_motif_includes" | sed s/include/lib/` \ 127 /usr/lib/Motif1.2 \ 128 /usr/Motif1.2/lib \ 129 \ 130 /usr/motif/lib \ 131 \ 132 /usr/X11R6/lib \ 133 /usr/X11R5/lib \ 134 /usr/X11R4/lib \ 135 \ 136 /usr/lib/X11R6 \ 137 /usr/lib/X11R5 \ 138 /usr/lib/X11R4 \ 139 \ 140 /usr/local/X11R6/lib \ 141 /usr/local/X11R5/lib \ 142 /usr/local/X11R4/lib \ 143 \ 144 /usr/local/lib/X11R6 \ 145 /usr/local/lib/X11R5 \ 146 /usr/local/lib/X11R4 \ 147 \ 148 /usr/X11/lib \ 149 /usr/lib/X11 \ 150 /usr/local/X11/lib \ 151 \ 152 /usr/X386/lib \ 153 /usr/x386/lib \ 154 /usr/XFree86/lib/X11 \ 155 \ 156 /usr/lib \ 157 /usr/local/lib \ 158 /usr/unsupported/lib \ 159 /usr/athena/lib \ 160 /usr/local/x11r5/lib \ 161 /usr/lpp/Xamples/lib \ 162 ; \ 163do 164 for ac_extension in a so sl; do 165 if test -r $ac_dir/lib${motif_direct_test_library}.$ac_extension; then 166 no_motif= ac_motif_libraries=$ac_dir 167 break 2 168 fi 169 done 170done 171LIBS="$ac_save_LIBS"]) 172AC_DEFUN(AC_PATH_MOTIF, 173[AC_REQUIRE_CPP()dnl 174 175motif_includes=NONE 176motif_libraries=NONE 177 178AC_MSG_CHECKING(for Motif) 179AC_ARG_WITH(motif, [ --with-motif enable Motif tests]) 180if test "x$with_motif" = xno; then 181 no_motif=yes 182else 183 if test "x$motif_includes" != xNONE && test "x$motif_libraries" != xNONE; then 184 no_motif= 185 else 186AC_CACHE_VAL(ac_cv_path_motif, 187[# One or both of these vars are not set, and there is no cached value. 188no_motif=yes 189AC_PATH_MOTIF_DIRECT 190 191if test "$no_motif" = yes; then 192 ac_cv_path_motif="no_motif=yes" 193else 194 ac_cv_path_motif="no_motif= ac_motif_includes=$ac_motif_includes ac_motif_libraries=$ac_motif_libraries" 195fi])dnl 196 fi 197 eval "$ac_cv_path_motif" 198fi # with_motif != no 199 200if test "$no_motif" = yes; then 201 AC_MSG_RESULT(no) 202 XMWIDGET="" 203 INSTALL_XMWIDGET="" 204 UNINSTALL_XMWIDGET="" 205else 206 XMWIDGETLIBS="-lXm ${LIBS}" 207 XMWIDGET="xmdino" 208 INSTALL_XMWIDGET="install_xmdino" 209 UNINSTALL_XMWIDGET="uninstall_xmdino" 210 test "x$motif_includes" = xNONE && motif_includes=$ac_motif_includes 211 test "x$motif_libraries" = xNONE && motif_libraries=$ac_motif_libraries 212 ac_cv_path_motif="no_motif= ac_motif_includes=$motif_includes ac_motif_libraries=$motif_libraries" 213 AC_MSG_RESULT([libraries $motif_libraries, headers $motif_includes]) 214fi 215]) 216 217AC_PATH_MOTIF 218 219if test "x$motif_libraries" != x ; then 220 XMWIDGET_LDFLAGS="${XMWIDGET_LDFLAGS}:$motif_libraries" 221 XMWIDGETLIBPATHS="-L$motif_libraries ${XMWIDGETLIBPATHS}" 222fi 223if test "x$motif_includes" != x ; then 224 XMWIDGETINC="${XMWIDGETINC} -I$motif_includes" 225fi 226 227dnl Xmu EDITRES Editres editres 228 229AC_DEFUN(AC_PATH_EDITRES_DIRECT, 230[test -z "$editres_direct_test_library" && editres_direct_test_library=Xmu 231test -z "$editres_direct_test_function" && editres_direct_test_function=_XEditResCheckMessages 232test -z "$editres_direct_test_include" && editres_direct_test_include=X11/Xmu/Editres.h 233 for ac_dir in \ 234 /usr/X11R6/include \ 235 /usr/X11R5/include \ 236 /usr/X11R4/include \ 237 /usr/X11/include \ 238 \ 239 /usr/include/X11 \ 240 /usr/include/X11R6 \ 241 /usr/include/X11R5 \ 242 /usr/include/X11R4 \ 243 \ 244 /usr/local/X11/include \ 245 /usr/local/X11R6/include \ 246 /usr/local/X11R5/include \ 247 /usr/local/X11R4/include \ 248 \ 249 /usr/local/include/X11 \ 250 /usr/local/include/X11R6 \ 251 /usr/local/include/X11R5 \ 252 /usr/local/include/X11R4 \ 253 \ 254 /usr/X386/include \ 255 /usr/x386/include \ 256 /usr/XFree86/include \ 257 \ 258 /usr/local/include \ 259 /usr/include \ 260 /usr/unsupported/include \ 261 /usr/athena/include \ 262 /usr/local/x11r5/include \ 263 /usr/lpp/Xamples/include \ 264 \ 265 /usr/openwin/include \ 266 /usr/openwin/share/include \ 267 ; \ 268 do 269 if test -r "$ac_dir/$editres_direct_test_include"; then 270 no_editres= ac_editres_includes=$ac_dir 271 break 272 fi 273 done 274 275# Check for the libraries. 276# See if we find them without any special options. 277# Don't add to $LIBS permanently. 278ac_save_LIBS="$LIBS" 279LIBS="-l$editres_direct_test_library $LIBS" 280# First see if replacing the include by lib works. 281for ac_dir in `echo "$ac_editres_includes" | sed s/include/lib/` \ 282 \ 283 /usr/X11/lib \ 284 /usr/X11R6/lib \ 285 /usr/X11R5/lib \ 286 /usr/X11R4/lib \ 287 \ 288 /usr/lib/X11 \ 289 /usr/lib/X11R6 \ 290 /usr/lib/X11R5 \ 291 /usr/lib/X11R4 \ 292 \ 293 /usr/local/X11/lib \ 294 /usr/local/X11R6/lib \ 295 /usr/local/X11R5/lib \ 296 /usr/local/X11R4/lib \ 297 \ 298 /usr/local/lib/X11 \ 299 /usr/local/lib/X11R6 \ 300 /usr/local/lib/X11R5 \ 301 /usr/local/lib/X11R4 \ 302 \ 303 /usr/X386/lib \ 304 /usr/x386/lib \ 305 /usr/XFree86/lib/X11 \ 306 \ 307 /usr/lib \ 308 /usr/local/lib \ 309 /usr/unsupported/lib \ 310 /usr/athena/lib \ 311 /usr/local/x11r5/lib \ 312 /usr/lpp/Xamples/lib \ 313 /lib/usr/lib/X11 \ 314 \ 315 /usr/openwin/lib \ 316 /usr/openwin/share/lib \ 317 ; \ 318do 319 for ac_extension in a so sl; do 320 if test -r $ac_dir/lib${editres_direct_test_library}.$ac_extension; then 321 no_editres= ac_editres_libraries=$ac_dir 322 break 2 323 fi 324 done 325done 326LIBS="$ac_save_LIBS"]) 327AC_DEFUN(AC_PATH_EDITRES, 328[AC_REQUIRE_CPP()dnl 329 330editres_includes=NONE 331editres_libraries=NONE 332 333AC_MSG_CHECKING(for Editres) 334AC_ARG_WITH(editres, [ --with-editres debugger for xmlock]) 335if test "x$with_editres" = xno; then 336 no_editres=yes 337else 338 if test "x$editres_includes" != xNONE && test "x$editres_libraries" != xNONE; then 339 no_editres= 340 else 341AC_CACHE_VAL(ac_cv_path_editres, 342[# One or both of these vars are not set, and there is no cached value. 343no_editres=yes 344AC_PATH_EDITRES_DIRECT 345 346if test "$no_editres" = yes; then 347 ac_cv_path_editres="no_editres=yes" 348else 349 ac_cv_path_editres="no_editres= ac_editres_includes=$ac_editres_includes ac_editres_libraries=$ac_editres_libraries" 350fi])dnl 351 fi 352 eval "$ac_cv_path_editres" 353fi # with_editres != no 354 355if test "$no_editres" = yes; then 356 AC_MSG_RESULT(no) 357else 358 AC_DEFINE(USE_XMU) 359 XMWIDGETLIBS="-lXmu ${XMWIDGETLIBS}" 360 test "x$editres_includes" = xNONE && editres_includes=$ac_editres_includes 361 test "x$editres_libraries" = xNONE && editres_libraries=$ac_editres_libraries 362 ac_cv_path_editres="no_editres= ac_editres_includes=$editres_includes ac_editres_libraries=$editres_libraries" 363 AC_MSG_RESULT([libraries $editres_libraries, headers $editres_includes]) 364fi 365]) 366 367dnl AC_PATH_EDITRES 368 369if test "x$editres_libraries" != x ; then 370 XMWIDGET_LDFLAGS="${XMWIDGET_LDFLAGS}:$editres_libraries" 371 XWIDGETLIBPATHS="-L$editres_libraries ${XWIDGETLIBPATHS}" 372fi 373if test "x$editres_includes" != x ; then 374 XMWIDGETINC="${XMWIDGETINC} -I$editres_includes" 375fi 376 377dnl Now we handle the various system dependant problems 378dnl that aren't addressed in the X header files, or things dealing 379dnl with utility quirks on some systems. 380 381aixv3=no 382 383AC_CANONICAL_HOST 384canonical=$host 385case "${canonical}" in 386 387 *-*-aix* ) 388 aixv3=yes 389 case "${canonical}" in 390 *-*-aix2* | *-*-aix3.0* | *-*-aix3.1* ) 391 AC_DEFINE(LESS_THAN_AIX3_2) 392 ;; 393 esac 394 ;; 395 396 *-*-freebsd* | *-*-netbsd* | *-*-openbsd* ) 397 XWIDGETLDFLAGS="-R${XWIDGET_LDFLAGS}" 398 XMWIDGETLDFLAGS="-R${XMWIDGET_LDFLAGS}" 399 ;; 400 401 *-*-hpux* ) 402 if test "${CC}" = "cc" ; then 403 CFLAGS="${CFLAGS} -Aa -z -D_HPUX_SOURCE" 404 GPROF_CFLAGS="${GPROF_CFLAGS} -Aa -z -D_HPUX_SOURCE" 405 fi 406 ;; 407 408 *-*-irix5* | *-*-irix6* ) 409 if test "${CC}" = "cc" ; then 410 CFLAGS="${CFLAGS} -fullwarn" 411 fi 412 ;; 413 414 *-*-linux* ) 415 CFLAGS="${CFLAGS} -ansi -pedantic" 416 AC_DEFINE(linux) 417 AC_DEFINE(_POSIX_SOURCE) 418 AC_DEFINE(_BSD_SOURCE) 419 AC_DEFINE(_GNU_SOURCE) 420 ;; 421 422 *-*-solaris2* ) 423 AC_DEFINE(SYSV) 424 AC_DEFINE(SVR4) 425 XWIDGETLDFLAGS="-R${XWIDGET_LDFLAGS}" 426 XMWIDGETLDFLAGS="-R${XMWIDGET_LDFLAGS}" 427 LIBS="${LIBS} -lsocket -lnsl -lposix4" 428 ;; 429 430esac 431 432srand=no 433AC_CHECK_FUNC(srand48, AC_DEFINE(SRAND,srand48) AC_DEFINE(LRAND,lrand48) 434 AC_DEFINE(MAXRAND,2147483648.0), 435[AC_CHECK_FUNC(srandom, AC_DEFINE(SRAND,srandom) AC_DEFINE(LRAND,random) 436 AC_DEFINE(MAXRAND,2147483648.0), 437AC_CHECK_FUNC(srand, AC_DEFINE(SRAND,srand) AC_DEFINE(LRAND,rand) srand=yes))]) 438 439if test "$srand" = yes; then 440 if test "$aixv3" = yes; then 441 AC_DEFINE(MAXRAND,2147483648.0) 442 else 443 AC_DEFINE(MAXRAND,32768.0) 444 fi 445fi 446 447XWIDGETLIBS="${XWIDGETLIBPATHS} ${LIBS} -lm" 448XMWIDGETLIBS="${XMWIDGETLIBPATHS} ${XMWIDGETLIBS} ${LIBS} -lm" 449AC_SUBST(XWIDGETLDFLAGS) 450AC_SUBST(XMWIDGETLDFLAGS) 451AC_SUBST(XWIDGETINC) 452AC_SUBST(XMWIDGETINC) 453AC_SUBST(XLIBS) 454AC_SUBST(XWIDGETLIBS) 455AC_SUBST(XMWIDGETLIBS) 456AC_SUBST(XMWIDGET) 457AC_SUBST(INSTALL_XMWIDGET) 458AC_SUBST(UNINSTALL_XMWIDGET) 459AC_SUBST(LINT) 460 461dnl AC_CONFIG_HEADER(config.h) 462AC_OUTPUT(Makefile) 463