dnl Process this file with autoconf to produce a configure script. dnl configure.in for xpuzzles. AC_INIT() dnl Checks for programs. AC_ARG_WITH(gcc, [ --with-gcc use GCC to compile]) dnl AC_ARG_WITH(debug, dnl [ --with-debug compile with -g, if no optimize]) test -n "$CC" && cc_specified=yes case ${with_gcc} in yes ) CC=gcc ;; dnl yes ) CC=g++ ;; no ) CC=cc ;; * ) AC_PROG_CC;; dnl * ) AC_PROG_CXX ;; esac dnl case ${with_debug} in dnl yes ) CFLAGS="${CFLAGS} -g" ;; dnl no ) CFLAGS="${CFLAGS} -O" ;; dnl esac if test "${CC}" = "gcc" ; then CFLAGS="${CFLAGS} -Wall" fi AC_PROG_LN_S AC_PROG_CPP AC_AIX AC_PROG_INSTALL dnl Optional features. dnl add copious amounts of debugging with gcc dnl Checks for header files. dnl AC_HEADER_STDC /* If its not ansi, its not going to go */ dnl AC_CHECK_HEADERS(poll.h sys/poll.h) AC_CHECK_HEADERS(fcntl.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. dnl AC_CHECK_FUNCS(select) dnl X Window System files. AC_PATH_XTRA if test "$no_x" = yes; then XLIBS=NONE else if test -n "${x_includes}"; then XWIDGETINC="-I${x_includes} ${XWIDGETINC}" XMWIDGETINC="-I${x_includes} ${XMWIDGETINC}" fi XLIBS="${x_libraries}" if test -n "${x_libraries}"; then XWIDGET_LDFLAGS="/usr/lib:${x_libraries}" XMWIDGET_LDFLAGS="/usr/lib:${x_libraries}" XWIDGETLIBPATHS="-L${x_libraries} ${XWIDGETLIBPATHS}" XMWIDGETLIBPATHS="-L${x_libraries} ${XMWIDGETLIBPATHS}" fi LIBS="${X_PRE_LIBS} -lXt -lX11 ${X_EXTRA_LIBS} ${LIBS}" dnl AC_DEFINE(X11) /* If there is no X, its not going to go */ fi dnl Xm MOTIF Motif motif AC_DEFUN(AC_PATH_MOTIF_DIRECT, [test -z "$motif_direct_test_library" && motif_direct_test_library=Xm test -z "$motif_direct_test_function" && motif_direct_test_function=XmCreatePushButton test -z "$motif_direct_test_include" && motif_direct_test_include=Xm/Xm.h for ac_dir in \ /usr/include/Motif1.2 \ /usr/Motif1.2/include \ \ /usr/motif/include \ \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X11/include \ /usr/include/X11 \ /usr/local/X11/include \ /usr/local/include/X11 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/dt/include \ \ /usr/local/include \ /usr/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ ; \ do if test -r "$ac_dir/$motif_direct_test_include"; then no_motif= ac_motif_includes=$ac_dir break fi done # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$motif_direct_test_library $LIBS" # First see if replacing the include by lib works. for ac_dir in `echo "$ac_motif_includes" | sed s/include/lib/` \ /usr/lib/Motif1.2 \ /usr/Motif1.2/lib \ \ /usr/motif/lib \ \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X11/lib \ /usr/lib/X11 \ /usr/local/X11/lib \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${motif_direct_test_library}.$ac_extension; then no_motif= ac_motif_libraries=$ac_dir break 2 fi done done LIBS="$ac_save_LIBS"]) AC_DEFUN(AC_PATH_MOTIF, [AC_REQUIRE_CPP()dnl motif_includes=NONE motif_libraries=NONE AC_MSG_CHECKING(for Motif) AC_ARG_WITH(motif, [ --with-motif enable Motif tests]) if test "x$with_motif" = xno; then no_motif=yes else if test "x$motif_includes" != xNONE && test "x$motif_libraries" != xNONE; then no_motif= else AC_CACHE_VAL(ac_cv_path_motif, [# One or both of these vars are not set, and there is no cached value. no_motif=yes AC_PATH_MOTIF_DIRECT if test "$no_motif" = yes; then ac_cv_path_motif="no_motif=yes" else ac_cv_path_motif="no_motif= ac_motif_includes=$ac_motif_includes ac_motif_libraries=$ac_motif_libraries" fi])dnl fi eval "$ac_cv_path_motif" fi # with_motif != no if test "$no_motif" = yes; then AC_MSG_RESULT(no) XMWIDGET="" INSTALL_XMWIDGET="" UNINSTALL_XMWIDGET="" else XMWIDGETLIBS="-lXm ${LIBS}" XMWIDGET="xmmball" INSTALL_XMWIDGET="install_xmmball" UNINSTALL_XMWIDGET="uninstall_xmmball" test "x$motif_includes" = xNONE && motif_includes=$ac_motif_includes test "x$motif_libraries" = xNONE && motif_libraries=$ac_motif_libraries ac_cv_path_motif="no_motif= ac_motif_includes=$motif_includes ac_motif_libraries=$motif_libraries" AC_MSG_RESULT([libraries $motif_libraries, headers $motif_includes]) fi ]) AC_PATH_MOTIF if test "x$motif_libraries" != x ; then XMWIDGET_LDFLAGS="${XMWIDGET_LDFLAGS}:$motif_libraries" XMWIDGETLIBPATHS="-L$motif_libraries ${XMWIDGETLIBPATHS}" fi if test "x$motif_includes" != x ; then XMWIDGETINC="${XMWIDGETINC} -I$motif_includes" fi dnl Xmu EDITRES Editres editres AC_DEFUN(AC_PATH_EDITRES_DIRECT, [test -z "$editres_direct_test_library" && editres_direct_test_library=Xmu test -z "$editres_direct_test_function" && editres_direct_test_function=_XEditResCheckMessages test -z "$editres_direct_test_include" && editres_direct_test_include=X11/Xmu/Editres.h for ac_dir in \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ /usr/X11/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include \ \ /usr/local/include \ /usr/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$editres_direct_test_include"; then no_editres= ac_editres_includes=$ac_dir break fi done # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$editres_direct_test_library $LIBS" # First see if replacing the include by lib works. for ac_dir in `echo "$ac_editres_includes" | sed s/include/lib/` \ \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${editres_direct_test_library}.$ac_extension; then no_editres= ac_editres_libraries=$ac_dir break 2 fi done done LIBS="$ac_save_LIBS"]) AC_DEFUN(AC_PATH_EDITRES, [AC_REQUIRE_CPP()dnl editres_includes=NONE editres_libraries=NONE AC_MSG_CHECKING(for Editres) AC_ARG_WITH(editres, [ --with-editres debugger for xmlock]) if test "x$with_editres" = xno; then no_editres=yes else if test "x$editres_includes" != xNONE && test "x$editres_libraries" != xNONE; then no_editres= else AC_CACHE_VAL(ac_cv_path_editres, [# One or both of these vars are not set, and there is no cached value. no_editres=yes AC_PATH_EDITRES_DIRECT if test "$no_editres" = yes; then ac_cv_path_editres="no_editres=yes" else ac_cv_path_editres="no_editres= ac_editres_includes=$ac_editres_includes ac_editres_libraries=$ac_editres_libraries" fi])dnl fi eval "$ac_cv_path_editres" fi # with_editres != no if test "$no_editres" = yes; then AC_MSG_RESULT(no) else AC_DEFINE(USE_XMU) XMWIDGETLIBS="-lXmu ${XMWIDGETLIBS}" test "x$editres_includes" = xNONE && editres_includes=$ac_editres_includes test "x$editres_libraries" = xNONE && editres_libraries=$ac_editres_libraries ac_cv_path_editres="no_editres= ac_editres_includes=$editres_includes ac_editres_libraries=$editres_libraries" AC_MSG_RESULT([libraries $editres_libraries, headers $editres_includes]) fi ]) dnl AC_PATH_EDITRES if test "x$editres_libraries" != x ; then XMWIDGET_LDFLAGS="${XMWIDGET_LDFLAGS}:$editres_libraries" XWIDGETLIBPATHS="-L$editres_libraries ${XWIDGETLIBPATHS}" fi if test "x$editres_includes" != x ; then XMWIDGETINC="${XMWIDGETINC} -I$editres_includes" fi dnl Now we handle the various system dependant problems dnl that aren't addressed in the X header files, or things dealing dnl with utility quirks on some systems. aixv3=no AC_CANONICAL_HOST canonical=$host case "${canonical}" in *-*-aix* ) aixv3=yes case "${canonical}" in *-*-aix2* | *-*-aix3.0* | *-*-aix3.1* ) AC_DEFINE(LESS_THAN_AIX3_2) ;; esac ;; *-*-freebsd* | *-*-netbsd* | *-*-openbsd* ) XWIDGETLDFLAGS="-R${XWIDGET_LDFLAGS}" XMWIDGETLDFLAGS="-R${XMWIDGET_LDFLAGS}" ;; *-*-hpux* ) if test "${CC}" = "cc" ; then CFLAGS="${CFLAGS} -Aa -z -D_HPUX_SOURCE" GPROF_CFLAGS="${GPROF_CFLAGS} -Aa -z -D_HPUX_SOURCE" fi ;; *-*-irix5* | *-*-irix6* ) if test "${CC}" = "cc" ; then CFLAGS="${CFLAGS} -fullwarn" fi ;; *-*-linux* ) CFLAGS="${CFLAGS} -ansi -pedantic" AC_DEFINE(linux) AC_DEFINE(_POSIX_SOURCE) AC_DEFINE(_BSD_SOURCE) AC_DEFINE(_GNU_SOURCE) ;; *-*-solaris2* ) AC_DEFINE(SYSV) AC_DEFINE(SVR4) XWIDGETLDFLAGS="-R${XWIDGET_LDFLAGS}" XMWIDGETLDFLAGS="-R${XMWIDGET_LDFLAGS}" LIBS="${LIBS} -lsocket -lnsl -lposix4" ;; esac srand=no AC_CHECK_FUNC(srand48, AC_DEFINE(SRAND,srand48) AC_DEFINE(LRAND,lrand48) AC_DEFINE(MAXRAND,2147483648.0), [AC_CHECK_FUNC(srandom, AC_DEFINE(SRAND,srandom) AC_DEFINE(LRAND,random) AC_DEFINE(MAXRAND,2147483648.0), AC_CHECK_FUNC(srand, AC_DEFINE(SRAND,srand) AC_DEFINE(LRAND,rand) srand=yes))]) if test "$srand" = yes; then if test "$aixv3" = yes; then AC_DEFINE(MAXRAND,2147483648.0) else AC_DEFINE(MAXRAND,32768.0) fi fi XWIDGETLIBS="${XWIDGETLIBPATHS} ${LIBS} -lm" XMWIDGETLIBS="${XMWIDGETLIBPATHS} ${XMWIDGETLIBS} ${LIBS} -lm" AC_SUBST(XWIDGETLDFLAGS) AC_SUBST(XMWIDGETLDFLAGS) AC_SUBST(XWIDGETINC) AC_SUBST(XMWIDGETINC) AC_SUBST(XLIBS) AC_SUBST(XWIDGETLIBS) AC_SUBST(XMWIDGETLIBS) AC_SUBST(XMWIDGET) AC_SUBST(INSTALL_XMWIDGET) AC_SUBST(UNINSTALL_XMWIDGET) AC_SUBST(LINT) dnl AC_CONFIG_HEADER(config.h) AC_OUTPUT(Makefile)