--- configure.ac.orig 2010-01-27 20:00:28.000000000 +0100 +++ configure.ac 2010-01-27 20:05:41.000000000 +0100 @@ -46,8 +46,24 @@ AC_SUBST(GZIP) AC_SUBST(LDCONFIG) +AC_MSG_CHECKING(--enable-ncurses argument) +AC_ARG_ENABLE(ncurses, + [ --enable-ncurses Include curses based Morse code Tutor], + [enable_ncurses=$enableval], + [enable_ncurses="no"]) +AC_MSG_RESULT($enable_ncurses) + +AC_MSG_CHECKING(--enable-qt4 argument) +AC_ARG_ENABLE(qt4, + [ --enable-qt4 Include QT based Morse code Tutor], + [enable_qt=$enableval], + [enable_qt="no"]) +AC_MSG_RESULT($enable_qt) + +if test "$enable_ncurses" = 'yes'; then # Checks for libraries. AC_CHECK_LIB(curses, initscr) +fi # Checks for header files, and refuse to go on if no KIOCSOUND is available. AC_HEADER_STDC @@ -92,49 +108,40 @@ # Decide on which subdirectories to build; substitute into SUBDIRS. Build # cwcp if curses is available, and xcwcp if Qt is available. SUBDIRS="cwlib cwutils cw cwgen" + +if test "$enable_ncurses" = 'yes'; then # Simple test for curses based on prior library check. if test $ac_cv_lib_curses_initscr = 'yes' ; then SUBDIRS="$SUBDIRS cwcp" else AC_MSG_WARN([Cannot find libcurses - unable to build cwcp]) fi +fi -# Look for $QTDIR. If found, then look for moc, either on $PATH, or -# in $QTDIR/bin. -MOC_EARLIEST=3 -if test -n "$QTDIR" ; then - AC_PATH_PROG(QTMOC, moc, , $QTDIR/bin:$PATH) - if test -n "$QTMOC" ; then - MOC_VERSION="`$QTMOC -v 2>&1 | sed -e 's;.*(Qt ;;' -e 's;).*;;'`" - if test -n "$MOC_VERSION" ; then - MOC_MAJOR="`echo $MOC_VERSION | sed -e 's;\..*;;'`" - expr "$MOC_MAJOR" + 0 >/dev/null 2>/dev/null - status=$? - if test -n "$MOC_MAJOR" -a $status -eq 0 ; then - if test "$MOC_MAJOR" -ge $MOC_EARLIEST ; then - SUBDIRS="$SUBDIRS xcwcp" - AC_SUBST(QTDIR) - AC_SUBST(QTMOC) - else - AC_MSG_WARN([Found 'moc' $MOC_VERSION - unable to build xcwcp]) - AC_MSG_WARN([Hint: xcwcp requires 'moc' version >= $MOC_EARLIEST]) - fi - else - AC_MSG_WARN([Cannot find 'moc' version - unable to build xcwcp]) - AC_MSG_WARN([Hint: ensure 'moc' is in QTDIR/bin on your PATH]) - fi - else - AC_MSG_WARN([Cannot find 'moc' version - unable to build xcwcp]) - AC_MSG_WARN([Hint: ensure 'moc' is in QTDIR/bin on your PATH]) - fi - else - AC_MSG_WARN([Cannot find 'moc' - unable to build xcwcp]) - AC_MSG_WARN([Hint: ensure 'moc' is in QTDIR/bin on your PATH]) - fi +if test "$enable_qt4" = 'yes'; then + dnl Look for Qt4 libs + PKG_CHECK_MODULES([QT4], ["QtCore QtGui Qt3Support"], [ + AC_SUBST(QT4_CFLAGS) + AC_SUBST(QT4_LIBS) + ], [ + AC_MSG_ERROR([Qt4 libs not found]) + ]) + dnl Look for moc, either on $PATH or in $QTDIR/bin + AC_PATH_PROG(QTMOC, moc, , $PATH:$QTDIR/bin) + if test -n "$QTMOC" ; then + dnl if libs and moc found + SUBDIRS="$SUBDIRS xcwcp" + AC_DEFINE([WANT_QT4], 1, [Want Qt4]) + echo "enabling Qt4 support" + else + AC_MSG_ERROR([Cannot find 'moc']) + AC_DEFINE([WANT_QT4], 0, [No Qt4]) + fi else - AC_MSG_WARN([Cannot find libqt - unable to build xcwcp]) - AC_MSG_WARN([Hint: try setting a value for the QTDIR variable]) + AC_DEFINE([WANT_QT4], 0, [No Qt4]) + echo "disabling Qt4 support" fi + AC_SUBST(SUBDIRS) # Add -Wall, -W, -pedantic, and other paranoia to gcc command flags, and -Wall --- Makefile.inc.in.orig 2010-01-27 20:11:31.000000000 +0100 +++ Makefile.inc.in 2010-01-27 20:10:28.000000000 +0100 @@ -37,7 +37,8 @@ AC_LD_LINKS_SO = @LD_LINKS_SO@ AC_LD = @LD@ AC_LN_S = @LN_S@ - +AC_QT4_LIBS = @QT4_LIBS@ +AC_QT4_CFLAGS = @QT4_CFLAGS@ # Portability values. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@