1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
dnl
dnl Configure.in for G0FRD CW tutor for UNIX flavours
dnl Copyright (C) 2001 Simon Baldwin (simonb@caldera.com)
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either version 2
dnl of the License, or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Initial file to ensure we are in the right place.
AC_INIT(cwlib/cwlib.c)
dnl General checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl Check specifically for gzip, and substitute the harmless ":" if absent.
AC_PATH_PROG(GZIP, gzip, ,)
if test -z "$GZIP" ; then
GZIP=":"
fi
AC_SUBST(GZIP)
dnl Checks for libraries.
AC_CHECK_LIB(curses, initscr)
dnl Checks for header files, and refuse to go on if no KIOCSOUND is available.
AC_HEADER_STDC
dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h)
dnl AC_CHECK_HEADERS(signal.h ctype.h errno.h stdio.h sys/types.h sys/stat.h)
dnl AC_CHECK_HEADERS(sys/param.h stdarg.h assert.h time.h curses.h)
AC_CHECK_HEADERS(sys/kd.h sys/vtkd.h)
if test "$ac_cv_header_sys_kd_h" = 'no' \
&& test "$ac_cv_header_sys_vtkd_h" = 'no' ; then
AC_MSG_ERROR(Cannot find either sys/kd.h or sys/vtkd.h)
fi
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(string.h strings.h)
if test "$ac_cv_header_string_h" = 'no' \
&& test "$ac_cv_header_strings_h" = 'no' ; then
AC_MSG_WARN(Cannot find either string.h or strings.h)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_SETPGRP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday select)
AC_CHECK_FUNCS(getopt_long)
dnl Decide on which subdirectories to build; substitute into SUBDIRS.
dnl We build cwcp if curses is available, and xcwcp if Qt is available.
SUBDIRS="cwlib"
SUBDIRS="$SUBDIRS cw"
SUBDIRS="$SUBDIRS cwgen"
dnl 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
dnl Look for $QTDIR. If found, then look for moc, either on $PATH, or
dnl in $QTDIR/bin.
QTDIR="/usr/share/qt"
if test -n "$QTDIR" ; then
AC_PATH_PROG(QTMOC, moc, ,$PATH:$QTDIR/bin)
if test -n "$QTMOC" ; then
SUBDIRS="$SUBDIRS xcwcp"
AC_SUBST(QTDIR)
AC_SUBST(QTMOC)
else
AC_MSG_WARN(Cannot find 'moc' - unable to build xcwcp)
AC_MSG_WARN(Hint: ensure 'moc' is on your PATH or in QTDIR/bin)
fi
else
AC_MSG_WARN(Cannot find libqt - unable to build xcwcp)
AC_MSG_WARN(Hint: try setting a value for the QTDIR variable)
fi
AC_SUBST(SUBDIRS)
dnl Add -Wall to gcc command flags.
if test "$CC" = "gcc" ; then
CFLAGS="$CFLAGS -Wall"
fi
dnl Determine if -KPIC or -fPIC is available for building .so libraries.
dnl Since gcc complains about invalid flags, but then continues, we have to
dnl check by searching the compile stdout and stderr for any output.
if test -z "$CFLAG_PIC" ; then
AC_MSG_CHECKING(for -KPIC or -fPIC compiler options)
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
if $CC -KPIC -c conftest.c 2>&1 | egrep -q '.' ; then
if $CC -fPIC -c conftest.c 2>&1 | egrep -q '.' ; then
CFLAG_PIC=""
else
CFLAG_PIC="-fPIC"
fi
else
CFLAG_PIC="-KPIC"
fi
rm -f conftest.c conftest.o
if test -n "$CFLAG_PIC" ; then
AC_MSG_RESULT($CFLAG_PIC)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(CFLAG_PIC)
dnl Find the linker, and check that it build .so files with the -G option.
AC_PATH_PROG(LD, ld,,)
LINKS_SO="no"
if test -n "$LD" ; then
AC_MSG_CHECKING(whether ld builds .so files with -G)
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
$CC -c conftest.c >/dev/null 2>/dev/null
$LD -G -o conftest.so conftest.o >/dev/null 2>/dev/null
rm -f conftest.c conftest.o
if test -f conftest.so ; then
nm conftest.so | grep -q so_test
if test $? -eq 0 ; then
LINKS_SO="yes"
fi
fi
rm -f conftest.so
if test $LINKS_SO = "yes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
LD=":"
fi
AC_SUBST(LD)
AC_SUBST(LINKS_SO)
dnl Write out configuration information to output files.
OUTPUT_FILES="Makefile cwlib/Makefile cw/Makefile cwgen/Makefile"
if echo "$SUBDIRS" | egrep -q '(^| )cwcp( |$)' ; then
OUTPUT_FILES="$OUTPUT_FILES cwcp/Makefile"
fi
if echo "$SUBDIRS" | egrep -q '(^| )xcwcp( |$)' ; then
OUTPUT_FILES="$OUTPUT_FILES xcwcp/Makefile"
fi
AC_OUTPUT($OUTPUT_FILES)
|