Update of /cvsroot/pclasses/pclasses2/toc/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6599/tests Added Files: atfilter_file.sh awk.sh boost.sh bzlib.sh check_dist_md5s.sh compiler_cpp.sh create_pkg-config_data.sh cvs_tools.sh doxygen.sh find_appconfig.sh find_header.sh flex.sh gcc_build_and_run.sh gcc_try_compile.sh gnu_cpp_tools.sh gnu_find.sh gnu_install.sh gnu_make.sh gnu_tar.sh gzip.sh libdl.sh libeditline.sh libexpat.sh libltdl.sh libs11n.sh lyxport.sh Makefile mysql_clients.sh mysql_server.sh PACKAGE_NAME-config.at PACKAGE_NAME-config.sh pclasses.sh perl.sh qt.sh readline.sh running_under_cygwin.sh sed.sh toc_config_h.sh toc_configure_finalcheck.sh toc_core_tests.sh toc_make.sh toc_project_makefile.sh toc_tests_help.sh use_ccdv.sh user_is_stephan_beal.sh zlib.sh Log Message: egg --- NEW FILE: gcc_try_compile.sh --- # toc_run_description = $@ # # toc_begin_help = # # Tries to compile $@ using ${CC} and returns the error code which the # compiler returns. $@ may be made up of any flags which you want to # pass to the compiler, such as -I/some/path. # # This code uses ${INCLUDES}. You can easily set it only for the # duration of this test by doing something like the following: # # INCLUDES="-I/path1 -I/path2" toc_test_require gcc_try_compile myfile.c # # This is an alternative to using the more verbose approach of saving # INCLUDES, adjusting it, calling this test and re-setting INCLUDES. # # = toc_end_help #test x"$@" = x && { # ^^^ this no workie when, e.g., -I... is passed in, because -I is a flag used by test :/ # echo "usage: try_compile cc_flag|file1.{c,cpp...} [cc_flag|file2...]" # return 1 #} toc_get_make CC CC=${TOC_GET_MAKE} test "x$CC" = x && { echo "This test requires that the config variable CC have been set to point to gcc." echo "Try running the gnu_cpp_tools test, or another test which sets C/C++-related variables, or call toc_add_make CC=/path/to/gcc." return 1 } tmpprefix=.toc.try_compile dotofile=$tmpprefix.o compiler_out=$tmpprefix.out cmd="$CC ${INCLUDES} $@ -c -o $dotofile" echo $cmd > $compiler_out $cmd >> $compiler_out 2>&1 err=$? test -f $dotofile && rm $dotofile test $err != 0 && { echo "Compiler output is in $compiler_out (but will be erased the next time this test is run!)." } || { rm $compiler_out } return $err --- NEW FILE: gnu_tar.sh --- # toc_run_description = search for a genuine GNU tar # toc_begin_help = # Looks for a genuine GNU tar. It first looks for gtar, and then tar, and checks # the binary to see if it is a GNU version. # It honors the configure argument --with-tar=/path/to/tar. # # Exports: # - TAR_BIN=/path/to/tar (or empty string) # - TAR=/path/to/tar (same as TAR_BIN, but deprecated) # # = toc_end_help toc_export TAR= toc_export TAR_BIN= gtar=${configure_with_TAR-gtar} toc_find $gtar || toc_find tar || { echo "tar/gtar not found in PATH" return 1 } gtar=$TOC_FIND_RESULT "$gtar" --version | grep -i GNU > /dev/null || { echo "Your 'tar' ($gtar) appears to be non-GNU." return 1 } toc_find ${TOC_HOME}/make/TARBALL.make toc_export TARBALL_MAKE=${TOC_FIND_RESULT} toc_export TAR=$gtar toc_export TAR_BIN=$gtar return 0 --- NEW FILE: qt.sh --- # toc_run_description = looking for Qt $1 # toc_begin_help = # Calls toc_export for the following: # - QTINCDIR directory containing Qt headers # - QTLIBDIR directory containing Qt libraries # - QTBINDIR directory containing Qt tools (moc, uic, etc.) # - LQT set to "-lqt" # - UIC /path/to/uic # - MOC /path/to/moc # - QMAKE /path/to/qmake # - QT_INCLUDES -I/path/to/Qt/includes # - QT_LDFLAGS -L/path/to/Qt/libs # Also, QTINCDIR, QTLIBDIR, and QTBINDIR are set in the environment. Note # that this intentionally does not set QTDIR, to keep you from using # $QTDIR/bin etc. instead of the QTBINDIR which might have been specified # by the user. # # If you need a specific version of Qt, set both of the following variables # before running this test: # qt_required_version - human-readable version number like "3.1.x" # qt_required_version_glob - version glob like "3.1.*" # Optionally, pass the version as $1 and glob as $2 (be sure to quote the # glob!). # = toc_end_help qt_required_version_version=${1-${qt_required_version_version-'3.x'}} qt_required_version_glob=${2-${qt_required_version_glob-'3.*'}} qt_check_dir () { local var=$1 local dir=$2 local contents=$3 if test -z "$dir"; then cat<<EOF $var environment variable not set, and --with-${var}=... not passed! Use one or the other to point to your Qt $contents, or QTDIR or --with-QTDIR=... to point to the top of your Qt installation. EOF return 1 fi if test -d $dir; then # life is tolerable return 0 else cat<<EOF Directory $dir does not exist! Set the $var environment variable, or pass --with-${var}=... to point to your Qt $contents, or QTDIR or --with-QTDIR=... to point to the top of your Qt installation. EOF return 1 fi } # Use --with-QTDIR=... if we got it; otherwise default to $QTDIR. QTDIR=${configure_with_QTDIR-$QTDIR} toc_export configure_with_qt=0 toc_export HAVE_QT=0 if test -z "${QTDIR}"; then echo "error: either set QTDIR or pass in --with-QTDIR=/path/to/qt" return 1 fi # QTINCDIR/QTLIBDIR/QTBINDIR can be specified independently, in the # environment or on the command line, or we can guess them from QTDIR. QTINCDIR=${configure_with_QTINCDIR-${QTINCDIR-${QTDIR+$QTDIR/include}}} QTLIBDIR=${configure_with_QTLIBDIR-${QTLIBDIR-${QTDIR+$QTDIR/lib}}} QTBINDIR=${configure_with_QTBINDIR-${QTBINDIR-${QTDIR+$QTDIR/bin}}} qt_check_dir QTINCDIR "$QTINCDIR" headers || return 1 qt_check_dir QTLIBDIR "$QTLIBDIR" libraries || return 1 qt_check_dir QTBINDIR "$QTBINDIR" executables || return 1 if test -n "$qt_required_version"; then # This has to be libqt*.so, not libqt.so, because in some cases you # have only libqt-mt.so.x.y.z, and libqt.so is a symlink to that, and # there are no libqt.so.x.y.z symlinks. (At least that's the way it # is with Qt 3.1.1 built from source on my RedHat 8.0 box.) ls $QTLIBDIR/libqt*.so.${qt_required_version_glob} > /dev/null 2>&1 || { echo "Qt $qt_required_version (libqt*.so.$qt_required_version_glob) not found in $QTLIBDIR!" return 1 } echo "Found Qt $qt_required_version at ${QTLIBDIR}" fi export QTDIR export QTINCDIR export QTLIBDIR export QTBINDIR toc_export QTDIR=$QTDIR toc_export QTINCDIR=$QTINCDIR toc_export QTLIBDIR=$QTLIBDIR toc_export QTBINDIR=$QTBINDIR toc_export LQT=-lqt toc_export UIC=${UIC:-$QTBINDIR/uic} toc_export MOC=${MOC:-$QTBINDIR/moc} toc_export QMAKE=${QMAKE:-$QTBINDIR/qmake} toc_export QT_INCLUDES="-I${QTINCDIR}" toc_export QT_LDFLAGS="-L${QTLIBDIR}" configure_with_qt=1 toc_export configure_with_qt=1 toc_export HAVE_QT=1 return 0 --- NEW FILE: Makefile --- SUBDIRS = cpp c include toc.make DIST_FILES += $(wildcard *.sh *.at) all: subdirs --- NEW FILE: libs11n.sh --- #!/do/not/bash # toc_run_description = looking for libs11n-config # # toc_begin_help = # Looks for libs11n (available from s11n.net). Use --s11n-prefix # to set the prefix under which s11n should be found. e.g.: # # ./configure --s11n-prefix=/usr/local # # Optionally, pass the prefix to this test as $1. The default prefix is ${prefix}. # # Only works with libs11n 0.9 or higher. # # This test exports the following config vars: # # - LIBS11N_PREFIX: an empty value if the test fails or s11n's # installation prefix if the test passes. # # - LIBS11N_CLIENT_LDADD: an empty value or: # -L${LIBS11N_PREFIX}/lib -ls11n [possibly also -lz -lbz] # (This should arguably contain -export-dynamic, but clients are expected # to use that, anyway.) # # - LIBS11N_CLIENT_INCLUDES: an INCLUDES-compatible entry, like -I${LIBS11N_PREFIX}/include # # - LIBS11N_LIBRARY_VERSION: the string which is returned by s11n::library_version(). # # - LIBS11N_CONFIG=/path/to/libs11n-config # # = toc_end_help s11n_path=${1-${s11n_prefix-${prefix}}}:${prefix}/bin:${PATH} toc_find libs11n-config $s11n_path || { echo "libs11n-config not found in [$s11n_path]." unset s11n_path return 1 } s11nconfig=${TOC_FIND_RESULT} toc_export LIBS11N_PREFIX=$($s11nconfig --prefix) toc_export LIBS11N_CONFIG=$s11nconfig eval $($s11nconfig --toc-config | sed -e 's/$/; /') unset s11nconfig return 0 --- NEW FILE: boost.sh --- # toc_run_description = looking for boost headers # toc_begin_help = # # Looks for headers for the boost C++ libraries (www.boost.org). # # Requires --with-boost=/path/to/boost or one of the environment vars # ${configure_with_boost} or ${BOOST_HOME}, which must point to the # top-most directory of the boost tree (e.g., the boost source # distribution tree). If this is not set then it checks some common # paths for Boost. For example, if boost lives under # /usr/dev/include/boost, you should set BOOST_HOME=/usr/dev/include # or pass in --with-boost=/usr/dev/include. # # It does not check for boost code which requires compilation, only # some common headers files. # # It calls toc_export for these config vars: # # - HAVE_BOOST = zero or one # - BOOST_HOME = directory ABOVE the boost headers dir, or empty if # HAVE_BOOST is zero. # # It accepts an optional list of boost headers to check, which should # be given as relative paths, assuming a top path of ${BOOST_HOME}. # # = toc_end_help if test x1 = "x${configure_with_boost}"; then configure_with_boost=${BOOST_HOME-${prefix}/include} fi toc_export BOOST_HOME= toc_export HAVE_BOOST=0 test x0 = "x${configure_with_boost}" && { echo "Boost has been explicitely disabled via --without-boost." return 0 } if test x != "${configure_with_boost}"; then checkp="${configure_with_boost}" else checkp="$prefix/include /usr/include /usr/local/include $HOME/include" fi boostpath= for p in $checkp; do test -d $p/boost && { boostpath=$p/boost break } done echo boostpath=$boostpath if test "x$boostpath" = x; then echo "--with-boost=/path/to/boost not set or does not point to a valid boost directory, " echo "and boost includes dir not found in path [$checkp]." unset boostpath unset checkp return 1 fi unset checkp for i in ${@-version.hpp config.hpp}; do toc_find $i $boostpath || { unset boostpath return 1 } done boostpath=${boostpath%%/boost} toc_export HAVE_BOOST=1 toc_export BOOST_HOME="$boostpath" unset boostpath return 0 --- NEW FILE: perl.sh --- # perl? toc_find perl || return toc_add_make PERL=${TOC_FIND_RESULT} --- NEW FILE: libdl.sh --- # toc_run_description = looking for libdl # toc_begin_help = # # Looks for libdl. It calls toc_export # for the following variables: # # HAVE_LIBDL = 0 or 1 # LDADD_LIBDL = empty or "-ldl -rdynamic" # LDADD_DL = empty or "-ldl -rdynamic", possibly with -L/path... # # Note that LDADD_LIBDL is specific to the libdl test, whereas LDADD_DL is used # by both the libdl and libltdl tests. # # = toc_end_help toc_add_config HAVE_LIBDL=0 toc_add_config LDADD_LIBDL= toc_export LDADD_DL= err=1 toc_test gcc_build_and_run ${TOC_HOME}/tests/c/check_for_dlopen_and_friends.c -rdynamic -ldl && { err=0 toc_export HAVE_LIBDL=1 toc_export LDADD_LIBDL="-ldl -rdynamic" toc_export LDADD_DL="${LDADD_LIBDL}" } return $err --- NEW FILE: gcc_build_and_run.sh --- # toc_run_description = $@ # # toc_begin_help = # # Tries to compile $@ using ${CC} and returns the error code which the # compiler returns. $@ may be made up of any flags which you want to # pass to the compiler, such as -I/some/path. Do not pass -c nor # -o, as those are handled by this test. # # This code uses ${INCLUDES}. You can easily set it only for the # duration of this test by doing something like the following: # # INCLUDES="-I/path1 -I/path2" toc_test_require gcc_build_and_run myfile.c # # This is an alternative to using the more verbose approach of saving # INCLUDES, adjusting it, calling this test and re-setting INCLUDES. # # = toc_end_help toc_get_make CC CC=${TOC_GET_MAKE} test "x$CC" = x && { echo "This test requires that the config variable CC have been set to point to gcc." echo "Try running the gnu_cpp_tools test, or another test which sets C/C++-related variables, or call toc_add_make CC=/path/to/gcc." return 1 } tmpprefix=.toc.build_and_run binfile=./$tmpprefix compiler_out=$tmpprefix.out cmd="$CC ${INCLUDES} $@ -o $binfile" echo $cmd > $compiler_out $cmd >> $compiler_out 2>&1 err=$? test x0 = x$err || { echo "Compiler output is in $compiler_out (but will be erased the next time this test is run!)." return $err err=$? } echo $binfile >> $compiler_out $binfile >> $compiler_out 2>&1 err=$? test x0 != x$err && { echo "output is in $compiler_out (but will be erased the next time this test is run!)." } || { rm $binfile $compiler_out } return $err --- NEW FILE: toc_tests_help.sh --- #!/do/not/bash # toc_run_description = checks for --help-X and tries to do something about it. # toc_begin_help = # # toc_tests_help looks for vars named help_* and tries to find help text for # tests matching that pattern (that is, help_foo looks for help for test foo). # To add help to your test wrap it in a block which begins with # the text 'toc_begin_help =' and end it with '= toc_end_help' # # This test returns zero only if no --help-X options are specified. # # The --help-TESTNAME options do not properly work with tests which: # # - do not live directly in toc/tests # - contain minus signs in their names # # The workaround is to use --help-tests, which will provide you with a selection # list of all tests under toc/tests and it's subdirectories. # # = toc_end_help toc_show_test_help () { local scr=${1?first argument must be a filename} test -f $scr || toc_die 127 "Test $scr not found!" sed -n '/^# *toc_begin_help *=/,/^#\ *= *toc_end_help/p' $scr | \ sed '/^# *toc_begin_help *=/d;/^# *= *toc_end_help/d;s/^# */ /;' } toc_select_test_help () { local tests=$(cd ${TOC_HOME}/tests; find . -type f -name '*.sh' | xargs grep -l toc_begin_help | sort | sed -e "s,\./,,;s,\.sh,,;") PS3="Select a test to show it's help: " select T in $tests; do echo "Help for '$T' test:" toc_show_test_help ${TOC_HOME}/tests/${T}.sh break # i'd like to loop, but the selection list is only shown on the first run, # and quickly scrolls off the screen, making a 'break' the only usable option. done } if test x1 = x${help_tests} ; then toc_select_test_help return 1 fi helps="$(env | grep '^help_')" test -n "$helps" || return 0 for h in $helps; do test=${h##help_} test=${test%%=*} echo "help: $test" toc_find_test $test || { echo "Error: cannot find test $test." return 1 } scr=${TOC_FIND_RESULT} grep -q "toc_begin_help" $scr || { echo "No help text found." continue } toc_show_test_help $scr done return 1 --- NEW FILE: gnu_cpp_tools.sh --- # toc_run_description = looking for GNU C/C++ compiler/linker tools. # toc_begin_help = # It takes the following configure arguments: # --enable-debug causes stuff to be built -g instead of -02. This is a # little weird, but you can control the optimization level # with --enable-debug="-O3 -fno-inline" etc. # --enable-warn causes stuff to be built -Wall. To turn on -Werror, do: --enable-warn="-Wall -Werror" etc. # --enable-werror same as --enable-warn="-Wall -Werror" # # It calls toc_export for the following: # - CC /path/to/gcc? # - LD /path/to/ld # - LDD /path/to/ldd # - CXX /path/to/g++ # - AR /path/to/ar # - NM /path/to/nm (optional component) # - STRIP /path/to/strip (optional component) # - INCLUDES probably empty # - CPPFLAGS probably empty # - OPT -g or -O2 (or some other value specified by --enable-debug) # - CFLAGS_OPT same as OPT (prefered for naming's sake) # - WARN -Wall (or some other value specified by --enable-warn or --enable-werror) # - CFLAGS probably empty (or maybe -pipe) # - CXXFLAGS probably empty (or maybe -pipe) # - LDFLAGS probably empty # = toc_end_help CC= for foo in \ ar-AR gcc-CC g++-CXX ld-LD ldd-LDD \ ; do key=${foo%%-*} var=${foo##*-} toc_find $key || { echo "Couldn't find required app: $key in PATH [$PATH]" return 1 } toc_export $var=${TOC_FIND_RESULT} done for foo in \ nm-NM strip-STRIP \ ; do key=${foo%%-*} var=${foo##*-} toc_find $key toc_add_make $var="${TOC_FIND_RESULT}" done toc_add_make INCLUDES="$INCLUDES" toc_add_make CPPFLAGS="$CPPFLAGS" if test "$configure_enable_debug" = 1; then OPT="-g $OPT" elif test "${configure_enable_debug:-0}" = 0; then # What's a sensible default here? -O2? Put it first in the hopes # that any values already in $OPT will take precedence. OPT="-O2 $OPT -DNDEBUG=1" else # They specified some flags. OPT="$configure_enable_debug" fi toc_add_make OPT="$OPT" toc_add_make CFLAGS_OPT="$OPT" if test "$configure_enable_warn" = 1; then WARN="-Wall $WARN" elif test "${configure_enable_warn:-0}" = 0; then WARN= else # They specified some flags. WARN="$configure_enable_warn" fi if test "x$configure_enable_werror" != x0; then if test "x$configure_enable_werror" = x1; then WARN="-Wall -Werror $WARN" else WARN="$WARN $configure_enable_werror" fi fi toc_add_make WARN="$WARN" # Presumably we could determine whether -pipe works instead of assuming # it does... CFLAGS="-pipe $CFLAGS" CXXFLAGS="-pipe $CXXFLAGS" toc_add_make CFLAGS="$CFLAGS" toc_add_make CXXFLAGS="$CXXFLAGS" toc_add_make LDFLAGS="$LDFLAGS" --- NEW FILE: mysql_clients.sh --- # toc_run_description = looking for mysql clients # toc_begin_help = # Looks for mysql client apps and sets the following config vars: # HAVE_MYSQL_CLIENTS=1 or 0 # MYSQL=/path/to/mysql # MYSQLADMIN=/path/to/mysqladmin # MYSQLDUMP=/path/to/mysqldump # = toc_end_help toc_add_config MYSQL= toc_add_config MYSQLDUMP= toc_add_config MYSQLADMIN= toc_add_config HAVE_MYSQL_CLIENTS=0 if test "x${configure_with_mysql}" = "x0"; then echo "mysql checks have been explicitely disabled." return 0 fi ret=0 path="${configure_with_mysql-${PATH}}" test "x$path" = "x1" && path="${PATH}" for x in \ mysql=MYSQL \ mysqladmin=MYSQLADMIN \ mysqldump=MYSQLDUMP \ ; do f=${x%%=*} v=${x##*=} # echo search path=$path toc_find $f "$path" err=$? if test $err = 0; then bin="${TOC_FIND_RESULT}" else ret=1 bin= fi toc_add_config $v="${bin}" done test $ret = 0 && { toc_add_config HAVE_MYSQL_CLIENTS=1 } return $ret --- NEW FILE: compiler_cpp.sh --- for foo in \ gcc cc \ ; do toc_find $foo || continue CC=${TOC_RUN_FIND_FAILOK} echo C compiler: ${TOC_RUN_FIND_FAILOK} break done for foo in \ g++ gcc c++ \ ; do toc_find $foo || continue CXX=${TOC_RUN_FIND_FAILOK} echo C++ compiler: ${TOC_RUN_FIND_FAILOK} break done export CC CXX toc_add_make CC=${CC} toc_add_make CXX=${CXX} return 0 --- NEW FILE: PACKAGE_NAME-config.sh --- #!/do/not/bash # toc_run_description = creating ${PACKAGE_NAME}-config # toc_begin_help = # # This test creates a script, ${top_srcdir}/${PACKAGE_NAME}-config, # useful for trees building libraries. Clients of your library (in # particular, their configure scripts) can get information about how # to compile and link against your library via this script. # # Sample usage: # toc_test_require package_config infile \ # PACKAGE_PREFIX=LIBMYLIB_ \ # CLIENT_LDADD="-L${prefix}/lib -lmylib" \ # CLIENT_INCLUDES="-I${prefix}/include" # # # All variables passed to this test are passed directly on to # ${TOC_HOME}/bin/atsign_parse, with the exception of $1: if $1 is an # existing file it is stripped from the list and use as an input # template, otherwise it is passed on. # # A default template file for the script is provided with this test, # toc/tests/PACKAGE_NAME-config.at, and it is used if $1 is not an # existing file. The default template depends on the arguments # show in the usage sample above. Client-provided templates can # of course use whatever variables they like. # # In the default template, PACKAGE_PREFIX is a prefix which gets # prepended to some variable names in the output, to allow # package-config scripts from multiple libraries to produce # non-colliding output. This value must be a single token, and should # probably be something like LIBMYLIB_. # # Run the generated ${PACKAGE_NAME}-config script to see # what it does. # # Remember to add ${PACKAGE_NAME}-config to the INSTALL_BINS # and DISTCLEAN_FILES variables in your ${top_srcdir}/Makefile! # # = toc_end_help infile="$1" if [ ! -e "$infile" ] ; then infile=${TOC_HOME}/tests/PACKAGE_NAME-config.at else shift fi ofile=${PACKAGE_NAME}-config ${TOC_HOME}/bin/atsign_parse \ PACKAGE_NAME="${PACKAGE_NAME}" \ PACKAGE_VERSION="${PACKAGE_VERSION}" \ prefix="${prefix}" \ "$@" \ < $infile > ${ofile} || { err=$? echo "Error filtering $infile to $ofile!" return $err } chmod +x ${ofile} --- NEW FILE: gnu_make.sh --- # toc_run_description = search for a genuine GNU make, the Make of makes. toc_find gmake || toc_find make || return toc_export MAKE=${TOC_FIND_RESULT} "$MAKE" --version | grep -qi GNU || { echo "Your make appears to be non-GNU." return 1 } --- NEW FILE: libeditline.sh --- # toc_run_description = looking for liblineedit # toc_begin_help = # Searches for liblineedit, a BSD-licensed replacement for GNU libreadline. # #Use --without-libeditline to explicitely disable libeditline support. # #toc_export is called for the following variables: # # HAVE_EDITLINE = 0 or 1 # # LIBEDITLINE_LDADD = empty or -leditline, possibly with -lncurses # # = toc_end_help toc_export HAVE_EDITLINE=0 toc_export LIBEDITLINE_LDADD= configure_with_libeditline=${configure_with_libeditline-1} test "x${configure_with_libeditline}" = "x0" && { echo "libeditline has been explictely disabled with --without-libeditline." return 0 } _libpath=/usr/lib:/usr/local/lib:${prefix}/lib:/lib _do=0 for L in libeditline.so libeditline.a; do toc_find $L "$_libpath" && { _do=1 break } done test x$_do = x0 && { echo "libeditline library file not found." unset _do unset _libpath return 0 } rllib=${TOC_FIND_RESULT} rlincpath=/usr/include:/usr/include/editline:/usr/local/include:/usr/local/include/editline:${prefix}/include:${prefix}/include/editline for inc in editline.h; do toc_find $inc $rlincpath || { err=$? echo "Header file $inc not found in path [$rlincpath]" unset rlincpath unset rllib return $err } done unset rlincpath LIBEDITLINE_LDADD="-leditline" # odd: lineedit sources never included curses.h, but do use curses functions, # leading to an unknown symbol in your app if we don't tell you that you need # to link against curses: #if ldd $rllib 2> /dev/null | grep ncurses &>/dev/null ; then # echo "It seems that libeditline also requires linking against -lncurses." LIBEDITLINE_LDADD="${LIBEDITLINE_LDADD} -lncurses" #fi toc_export HAVE_EDITLINE=1 toc_export LIBEDITLINE_LDADD="${LIBEDITLINE_LDADD}" unset nc return 0 --- NEW FILE: awk.sh --- # toc_run_description = looking for gawk/awk/nawk err=0 toc_find gawk || toc_find awk || toc_find nawk || err=1 toc_add_make AWK=$TOC_FIND_RESULT return $err --- NEW FILE: flex.sh --- # toc_run_description = looking for GNU flex # toc_begin_help = # Looks for flex in $1 (defaults to $PATH) and FlexLexer.h # in some common paths. It calls toc_export for the following # variables: # # FLEX=/path/to/flex (maybe empty) # FLEX_BIN= same thing, but preferred for style's sake # FLEXLEXER_H=/path/to/FlexLexer.h # # It honors the following configure arguments: # # --with-flex=/path/to/flex # --with-flexlexer=/path/to/FlexLexer.h # --without-flex sets FLEX to an empty string. # # It returns zero if flex is found, else non-zero. # A missing FlexLexer.h is not considered an error, since it # is only useful for C++ # # = toc_end_help if [ x0 = x${configure_with_flex-1} ]; then echo "Explicitely disabled via --without-flex." toc_export FLEX= toc_export FLEX_BIN= toc_export FLEXLEXER_H= return 0 fi toc_find ${configure_with_flex-flex} flex ${1-${PATH}} err=$? toc_export FLEX=${TOC_FIND_RESULT} toc_export FLEX_BIN=${TOC_FIND_RESULT} toc_find ${configure_with_flexlexer-FlexLexer.h} /usr/include:/usr/local/include:$PWD/include toc_export FLEXLEXER_H=${TOC_FIND_RESULT} return $err --- NEW FILE: pclasses.sh --- #!/do/not/bash # toc_run_description = checking for P::Classes libs and headers... # toc_begin_help = # Checks for the existance of the P::Classes libs and headers. # # Exports the following variables: # # HAVE_PCLASSES = 0 or 1 # # PCLASSES_LDADD = -Lpclasses_prefix -l... (each pXXX lib) # # = toc_end_help paths="${configure_with_pclasses-${prefix}}:/usr:/usr/local:$HOME" toc_debug "pclasses search path=[$paths]" ret=0 pprefix= for H in pany.h psqldriver.h piomanager.h; do toc_find include/pclasses/$H "$paths" || { ret=1 break } test x != "x${pprefix}" && continue pprefix="${TOC_FIND_RESULT%%/include/pclasses/*}" done pldadd="" for L in pcore pcrypto pio pnet psql; do toc_find lib/lib${L}.so "$paths" || { ret=1 break } pldadd="${pldadd} -l$L" done toc_export PCLASSES_PREFIX="${pprefix}" test 0 = $ret && { toc_export PCLASSES_LDADD="-L${pprefix}/lib -L${pprefix}/lib/pclasses ${pldadd}" toc_export HAVE_PCLASSES=1 } || { toc_export HAVE_PCLASSES=0 } unset pldadd paths pprefix return $ret --- NEW FILE: toc_project_makefile.sh --- # Creates toc.${PACKAGE_NAME}.make from toc.${PACKAGE_NAME}.make.at # This file is sought by toc.make (but is always optional) mf=${1-toc.${PACKAGE_NAME}.make} tmpl=$mf.at test -f $tmpl || { toc_add_make toc_include_project_makefile=0 echo "No project-specific makefile found at [$mf]." echo "This is /probably/ not a problem." return 1 } toc_atfilter_as_makefile $tmpl $mf || { err=$? echo "Error filtering $tmpl!" return $err } # toc_add_make toc_include_project_makefile="\$(top_srcdir)/${mf}" --- NEW FILE: libexpat.sh --- #!/do/not/bash # toc_run_description = checking for expat XML parser... # toc_begin_help = # # Exports the variable HAVE_LIBEXPAT to 0 or 1. # If --without-libexpat is passed to configure then this test # sets HAVE_LIBEXPAT to 0 and returns success. # # = toc_end_help if [ x0 = "x${configure_with_libexpat}" ]; then echo "libexpat disabled explicitely with --without-libexpat." toc_export HAVE_LIBEXPAT=0 return 0 fi src=check4expat.c cat <<EOF > $src // taken from expat's outline.c example, expat 1.95.7 #include <stdio.h> #include <expat.h> #define BUFFSIZE 8192 char Buff[BUFFSIZE]; int Depth; static void XMLCALL start(void *data, const char *el, const char **attr) {} static void XMLCALL end(void *data, const char *el) {} int main(int argc, char *argv[]) { XML_Parser p = XML_ParserCreate(NULL); if (! p) { fprintf(stderr, "Couldn't allocate memory for parser\n"); exit(-1); } XML_SetElementHandler(p, start, end); return 0; } EOF workie=1 toc_test gcc_build_and_run $src -lexpat || workie=0 rm $src toc_export HAVE_LIBEXPAT=${workie} unset workie test 1 = ${HAVE_LIBEXPAT} return $? --- NEW FILE: create_pkg-config_data.sh --- #!/do/not/bash # toc_run_description = creating ${PACKAGE_NAME}.pc # toc_begin_help = # # This test creates a data file for pkg-config, useful for trees # building libraries. With this data clients of your library can get # information about how to compile and link against your library via # the pkg-config tool. # The output file is called ./${PACKAGE_NAME}.pc, and should be added # to the top-level makefile's INSTALL_PKGCONFIG and DISTCLEAN_FILES vars. # It will be installed to ${prefix}/lib/pkgconfig. # Sample usage: # toc_test_require create_pkg-config # Please see 'man pkg-config' for more information about pkg-config # conventions. # This test makes use of the following environment variables: # # - PACKAGE_FRIENDLY_NAME = a "friendly-form" name of the package. # Defaults to the toc-conventional PACKAGE_NAME. # # - PACKAGE_VERSION = toc-conventional # # - PACKAGE_DESCRIPTION = a description of the package. e.g., "A tool to # do Blah." # # - PACKAGE_LDADD = list of linker flags required to link against this # package, include -L and -l options. e.g. -L/usr/X11R6/lib # Note that -L${prefix}/lib is automatically added ONLY if this # var is NOT set. # Corresponds to pkg-config's Libs entry. # # - PACKAGE_CFLAGS = list of C preprocessor flags needed to compile # against this package. e.g., -I/usr/X11R6/include # Note that -I${prefix}/include is automatically added ONLY if this # var is NOT set. # Corresponds to pkg-config's CFlags entry. # # - PACKAGE_CONFLICTS = pkg-config 'Conflicts:' info string # # - PACKAGE_REQUIRES = pkg-config 'Requires:' info string # # Note that configure code may need append additional information to # the output to the generated file, like "my_module_version", and # other not-always-used entries. # # Achtung: this test will return with an error in some cases even # when it creates the output file. For example, if PACKAGE_DESCRIPTION # is not set then it will do so, primarily to verbosely warn the user # to set it. # # Remember to add ${PACKAGE_NAME}.pc to the INSTALL_PKGCONFIG # and DISTCLEAN_FILES variables in your ${top_srcdir}/Makefile! # # = toc_end_help _ret=0 for i in PACKAGE_DESCRIPTION; do test x = "x$(eval echo \${$i})" && { toc_boldecho "Warning: variable not set: $i" _ret=1 } done pkgconfdir=${prefix}/lib/pkgconfig echo "x${PKG_CONFIG_PATH}" | grep "${pkgconfdir}" >/dev/null || { cat <<EOF ${TOC_BOLD_}Warning: the dir [$pkgconfdir] is not in the current PKG_CONFIG_PATH. This means that pkg-config may not be able to find ${PACKAGE_NAME}.pc after installation.${_TOC_BOLD} EOF } unset pkgconfdir cat <<EOF > ${PACKAGE_NAME}.pc # created by toc's create_pkg-config_data test. $(date) prefix=${prefix} exec_prefix=\${prefix} libdir=\${prefix}/lib includedir=\${prefix}/include Name: ${PACKAGE_FRIENDLY_NAME-${PACKAGE_NAME}} Description: ${PACKAGE_DESCRIPTION} Version: ${PACKAGE_VERSION} Requires: ${PACKAGE_REQUIRES} Libs: ${PACKAGE_LDADD-"-L\${libdir}"} Cflags: ${PACKAGE_CFLAGS-"-I\${includedir}"} EOF return $_ret --- NEW FILE: toc_configure_finalcheck.sh --- # does some closing-time checks on the configure environment. ret=0 for ifile in \ ${TOP_SRCDIR}/toc_shared.make ${TOP_SRCDIR}/include/config.h \ ; do \ grep -iqe "@[A-Z0-9_][A-Z0-9_]*@" $ifile && { boldecho -n "WARNING: " echo "$ifile contains un-parsed @tokens@. This may or may not be an error. ${TOC_EMOTICON_WARNING}" ret=1 # note that this check is broken because it is generic: # we should not include @tokens@ which are commented-out in makefiles, # but the makefile comment delimiter is the first char of the #define # directive for config.h.at. # one day i'll code separate tests for each file. } done return $ret --- NEW FILE: find_appconfig.sh --- #!/do/not/bash # toc_run_description = looking for $1-config # toc_begin_help = # This test searches for $1-config in the path $2. # The search path defaults to ${prefix}/bin:$PATH. # # # The config var ${1}_config is exported, and will contain the path of # the config app or empty if it was not found. Note that any "-" # characters in $1 are converted to "_" for this purpose. # FIND_APPCONFIG is also exported to the path of the found config app, # but will be reset on each call to this function. It is intended to # be helpful when running this test in loops, e.g., for x in foo bar; # do ... done # Example: # # toc_test_require find_appconfig my-lib # # will search for my-lib-config in ${prefix}/bin:$PATH # and will export ${my_lib_config} to the path where it # is found. # # = toc_end_help _app=${1} test x = "x$_app" && { cat <<EOF Usage error: this test requires the base name of a lib or app as it's first argument, and an optional PATH as it's second argument. Example: toc_test_require find_appconfig gtk will search for gtk-config in ${prefix}/bin:$PATH EOF return 1 } _spath=${2-${prefix}/bin:$PATH} toc_find ${_app}-config $_spath _app=$(echo $_app | sed -e s/-/_/g) toc_export ${_app}_config=${TOC_FIND_RESULT} toc_export FIND_APPCONFIG=${TOC_FIND_RESULT} unset _app unset _spath test x != "x${TOC_FIND_RESULT}" return $? --- NEW FILE: PACKAGE_NAME-config.at --- #!/bin/sh # # This gets filtered at configure-time to create # ${PACKAGE_NAME}-config. usage() { cat <<EOF 1>&2 $0: shows information useful for configuring/building @PACKAGE_NAME@ client applications. Usage: $0 [options] Options: --libs : prints linker information about what libs clients should link to --includes : prints INCLUDES information --prefix : prints the library's installation prefix --version : prints the library's version --toc-make : prints a makefile snippet suitable for use with toc makefiles --toc-config : prints info suitable for use in a toc configure script EOF } foo=$1 test "x" = "x$1" && { usage exit 1; } version="@PACKAGE_VERSION@" ldadd="@CLIENT_LDADD@" includes="@CLIENT_INCLUDES@" prefix="@prefix@" for arg in "$@"; do case $arg in --help|-?|-h) usage ;; --libs) echo $ldadd ;; --includes) echo $includes ;; --prefix) echo $prefix ;; --version) echo $version ;; --toc-make) cat <<EOF @PACKAGE_PREFIX@CLIENT_LDADD=$ldadd @PACKAGE_PREFIX@CLIENT_INCLUDES=$includes @PACKAGE_PREFIX@LIBRARY_VERSION=$version EOF ;; --toc-config) cat <<EOF toc_export @PACKAGE_PREFIX@CLIENT_LDADD="$ldadd" toc_export @PACKAGE_PREFIX@CLIENT_INCLUDES="$includes" toc_export @PACKAGE_PREFIX@LIBRARY_VERSION="$version" EOF ;; *) echo "Unrecognized option: $arg" exit 2 ;; esac done --- NEW FILE: user_is_stephan_beal.sh --- #!/do/not/bash # toc_run_description = If you appear to be stephan beal, set up some common stuff... test xstephan = "x${USER}" || return 1 got=0 for h in cheyenne ludo jareth hoggle owl; do test x$h = "x${HOSTNAME}" && got=1 done test $got = 0 && return 1 echo "Setting up stephan's always-used settings..." { # for gnu_cpp_tools: echo "Enabling debug/werror/wall." export configure_enable_debug=1 export configure_enable_werror=1 export configure_enable_wall=1 } return 0 --- NEW FILE: use_ccdv.sh --- #!/do/not/bash # ^^^ help out emacs # # toc_run_description = use ccdv compiler front-end? # # toc_begin_help = # # Running this test enabled Mike Gleason's ccdv compiler front-end, # which simply pretties-up compiler output. The ccdv source lives in # ${TOC_HOME}/bin/ccdv.c and is released under the GNU GPL. # # Use the --disable-ccdv configure option to explicitely disable it. # # = toc_end_help test 0 = "${configure_enable_ccdv-1}" && { echo "ccdv has been explicitely disabled with --disable-ccdv." return 0 } test x != "x${CC}" || { echo 'This test requires that the CC environment variable be set to a C compiler!' return 1 } ccdvsrc=${TOC_HOME}/bin/ccdv.c toc_find $ccdvsrc || { unset ccdvsrc return 1 } ${CC} -o ccdv ${ccdvsrc} || { unset ccdvsrc echo "Compilation of ccdv failed!" return 1 } unset ccdvsrc return 0 --- NEW FILE: readline.sh --- # toc_run_description = looking for GNU libreadline/libhistory # toc_begin_help = # Searches for GNU libreadline. # #Use --without-libreadline to explicitely disable libreadline support. # #toc_export is called for the following variables: # # HAVE_READLINE = 0 or 1 # # LIBREADLINE_LDADD = empty or -lreadline, possibly with -lncurses # # = toc_end_help toc_export HAVE_READLINE=0 toc_export LIBREADLINE_LDADD= configure_with_libreadline=${configure_with_libreadline-1} test "x${configure_with_libreadline}" = "x0" && { echo "libreadline has been explictely disabled with --without-libreadline." return 0 } _libpath=/usr/lib:/usr/local/lib:${prefix}/lib:/lib _do=0 for L in libreadline.so libreadline.so.4 libreadline.a; do toc_find $L "$_libpath" && { _do=1 break } done test x$_do = x0 && { echo "libreadline library file not found." unset _do unset _libpath return 0 } rllib=${TOC_FIND_RESULT} rlincpath=/usr/include:/usr/include/readline:/usr/local/include:/usr/local/include/readline:${prefix}/include:${prefix}/include/readline for inc in readline.h history.h; do toc_find $inc $rlincpath || { err=$? echo "Header file $inc not found in path [$rlincpath]" unset rlincpath unset rllib return $err } done unset rlincpath LIBREADLINE_LDADD="-lreadline" if ldd $rllib 2> /dev/null | grep ncurses &>/dev/null ; then echo "It seems that libreadline also requires linking against -lncurses." LIBREADLINE_LDADD="${LIBREADLINE_LDADD} -lncurses" fi toc_export HAVE_READLINE=1 toc_export LIBREADLINE_LDADD="${LIBREADLINE_LDADD}" unset nc return 0 --- NEW FILE: sed.sh --- toc_find sed || return toc_add_make SED=${TOC_FIND_RESULT} return 0 --- NEW FILE: gzip.sh --- toc_find gzip || return toc_add_make GZIP=${TOC_FIND_RESULT} return 0 --- NEW FILE: mysql_server.sh --- # toc_run_description = looking for a running mysql server # toc_begin_help = # Looks for a running mysql server: # $@ = optional sql code, used on connecting to the db. # # This script requires that the mysql_clients test has been # run, and will run it HAVE_MYSQL_CLIENTS is not 1. # # It accepts these optional config arguments: # --mysql-host=server # --mysql-user=user # --mysql-password=password # --mysql-port=server_port # --mysql-db=database_name # # = toc_end_help # # toc_add_config HAVE_MYSQL_SERVER=0 toc_get_make HAVE_MYSQL_CLIENTS test "x${TOC_GET_MAKE}" = "x1" || { toc_test mysql_clients || return $? } sql="${@-show databases}" toc_get_make MYSQL client=${TOC_GET_MAKE} args= for x in \ user=mysql_user \ host=mysql_host \ password=mysql_password \ port=mysql_port \ database=mysql_db \ ; do # map --mysql-FOO to --FOO arg for mysql client: k="${x%%=*}" v=$"${x##*=}" uc=$(echo $v | tr [a-z] [A-Z]) eval v='$'${v} test -z "$v" || args="$args --$k=${v}" toc_add_make $uc="$v" done echo -n "Attempting to connect to mysql server:" " " # echo $client $args -e "'$sql'" $client $args -e "$sql" > /dev/null err=$? if test $err != 0 ; then echo -n ${TOC_EMOTICON_ERROR} " " toc_boldecho "Could not connect to server!" return $err fi echo ${TOC_EMOTICON_OKAY} toc_add_config HAVE_MYSQL_SERVER=1 return 0 --- NEW FILE: running_under_cygwin.sh --- # toc_run_description = building under cygwin? test -d /cygdrive/c err=$? if test $err = 0 ; then toc_add_config CYGWIN=1 echo "Detected cygwin." else toc_add_config CYGWIN=0 fi return $err --- NEW FILE: bzlib.sh --- # toc_run_description = looking for bzip lib and header # toc_begin_help = # Searches for libbz2.a and bzlib.h in commonly-used locations. # It calls toc_export for the following vars: # # - HAVE_BZ2LIB = 0 or 1 # - LDADD_BZ2LIB = empty or -lz # # Pass --disable-bzlib to configure to explicitely set # HAVE_BZLIB to zero. # # It returns zero if HAVE_BZLIB==1, else non-zero. # = toc_end_help toc_export HAVE_BZLIB=0 toc_export LDADD_BZLIB= test x0 = x${configure_enable_bzlib} && { echo "bzlib explicitely disabled via --disable-bzlib." return 0 } toc_find libbz2.a ${prefix}/lib:/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH} zlib_a=${TOC_FIND_RESULT} toc_find bzlib.h ${prefix}/include:/usr/include:/usr/local/include zlib_h=${TOC_FIND_RESULT} test "x" = "x$zlib_a" -o "x" = "x$zlib_h" HAVE_BZLIB=$? if [ x1 = x${HAVE_BZLIB} ]; then toc_export HAVE_BZLIB=1 toc_export LDADD_BZLIB=-lbz2 return 0 fi return 1 --- NEW FILE: cvs_tools.sh --- #!/do/not/bash # toc_run_description = looking for CVS client tools # toc_begin_help = # Looks for the cvs client tools. Exports: # # - CVS_BIN=/path/to/cvs # # It honors the configure argument --with-cvs=/path/to/cvs # = toc_end_help cvs=${configure_with_cvs-cvs} toc_find $cvs toc_export CVS_BIN=${TOC_FIND_RESULT} test x = "x${CVS_BIN}" && return 1 return 0 --- NEW FILE: zlib.sh --- # toc_run_description = looking for zlib # toc_begin_help = # Searches for libz.a and zlib.h in commonly-used locations. # It calls toc_export for the following vars: # # - HAVE_ZLIB = 0 or 1 # - LDADD_ZLIB = empty or -lz # # Pass --disable-zlib to configure to explicitely set # HAVE_ZLIB to zero. # # It returns zero if HAVE_ZLIB==1, else non-zero. # = toc_end_help toc_export HAVE_ZLIB=0 toc_export LDADD_ZLIB= test x0 = x${configure_enable_zlib} && { echo "zlib explicitely disabled via --disable-zlib." return 0 } toc_find libz.a ${prefix}/lib:/usr/lib:/usr/local/lib:${LD_LIBRARY_PATH} zlib_a=${TOC_FIND_RESULT} toc_find zlib.h ${prefix}/include:/usr/include:/usr/local/include zlib_h=${TOC_FIND_RESULT} test "x" = "x$zlib_a" -o "x" = "x$zlib_h" HAVE_ZLIB=$? if [ x1 = x${HAVE_ZLIB} ]; then toc_export HAVE_ZLIB=1 toc_export LDADD_ZLIB=-lz return 0 fi return 1 --- NEW FILE: libltdl.sh --- # toc_run_description = looking for libltdl # toc_begin_help = # # Looks for libltdl. It calls toc_export # for the following variables: # # HAVE_LIBLTDL = 0 or 1 # LDADD_LIBLTDL = -lltdl or empty # LDADD_DL = empty or "-ltdl -rdynamic", possibly with -L/path... # # Note that LDADD_LIBLTDL is specific to the libltdl test, whereas LDADD_DL is used # by both the libdl and libltdl tests. # # = toc_end_help # Many thanks to Roger Leigh for introducing me to ltdl! toc_add_config HAVE_LIBLTDL=0 toc_add_config LDADD_LIBLTDL= toc_export LDADD_DL= err=1 toc_test gcc_build_and_run ${TOC_HOME}/tests/c/check_for_ltdlopen_and_friends.c -rdynamic -lltdl && { err=0 toc_export HAVE_LIBLTDL=1 toc_export LDADD_LIBLTDL="-lltdl -rdynamic" toc_export LDADD_DL="${LDADD_LIBLTDL}" } return $err --- NEW FILE: find_header.sh --- #!/do/not/bash # toc_run_description = Looking for header file $1 # toc_begin_help = # # Searches for a header file, passed as $1, # in the search path $2. $2 defaults to: # ${prefix}/include:/usr/include:/usr/local/include # # After running this the variable TOC_FIND_RESULT # holds the position of the file, or is empty # if the file is not found. # # The environment variable FIND_HEADER_PATH is set to # to path where $1 was found. Note that it is reset # on every call to this test, and is not toc_exported. # # = toc_end_help test x = "x$1" && { cat <<EOF Usage error: \$1 should be the name of a header file. \$2 is an optional search path. EOF return 1 } header=$1 shift defname=HAVE_$(echo ${header} | tr '[a-z/.]' '[A-Z__]') toc_find $header ${@-${prefix}/include:/usr/include:/usr/local/include} export FIND_HEADER_PATH="${TOC_FIND_RESULT%%/$header}" if test -n "${FIND_HEADER_PATH}"; then toc_export ${defname}=1 else toc_export ${defname}=0 fi unset header test x != "x${TOC_FIND_RESULT}" return $? --- NEW FILE: toc_config_h.sh --- #!/do/not/bash # toc_run_description = creating config.h # toc_begin_help = # Creates a config.h from config.h.at. # Accepts optional $1 naming a target config.h-like # file. The file $1.at must exist for this to work. # = toc_end_help toc_config_h () { # $1 = target file. $1.at must exist. # todo: add support for multiple input files. # i use a function so i can use local vars local propsfile=.config.h.properties local configh=$1 configh=${configh##${TOP_SRCDIR}/} local tmpl=$configh.at test -f $tmpl || { echo "Note: no $tmpl found, so $configh will not be created." return 0 } i=0 test -f "$propsfile" && rm "$propsfile" toc_dump_config_h_properties > $propsfile toc_atfilter_file $propsfile $tmpl $configh rm $propsfile return 0 } files="$@" test -z "$files" && files=${TOC_INCLUDESDIR}/config.h toc_config_h "$files" return $? --- NEW FILE: gnu_install.sh --- # tests for GNU install toc_add_make PACKAGE_IS_INSTALLABLE=0 toc_find ginstall || toc_find install || { echo "install or ginstall not found in your PATH: $PATH" return 1 } app=${TOC_FIND_RESULT} "$app" --help | 2>&1 grep -qi GNU || { echo "Your 'install' ($app) appears to be non-GNU." return 1 } toc_add_make GNUINSTALL_BIN=$app toc_add_make PACKAGE_IS_INSTALLABLE=1 return 0 --- NEW FILE: gnu_find.sh --- # toc_run_description = search for GNU find toc_find find || return 1 app=${TOC_FIND_RESULT} "$app" --version | grep -qi GNU || { echo "Your 'find' ($app) appears to be non-GNU." return 1 } toc_add_make FIND=$app return 0 --- NEW FILE: atfilter_file.sh --- #!/do/not/bash # toc_run_description = creating $2 test x = "x$2" && { echo "Error: this test requires args \$1 and \$2:" echo "\$1 = input (template) file." echo "\$2 = output file." return 1 } toc_atfilter_as_makefile $1 $2 --- NEW FILE: toc_make.sh --- #!/do/not/bash # toc_run_description = creating included makefiles # Do not run this test manually: it is run by the toc core. TOC_MAKE=toc.make TOC_QMAKE=toc.qmake toc_add_make TOC_MAKE=${TOC_MAKE} toc_add_make TOC_QMAKE=${TOC_QMAKE} # set -x toc_make_toc_make () { # use a function because bash doesn't allow local vars outside of functions. local usage="usage: arg1==target makefile basename. arg2=input template" local themake=${1?$usage} local themakein=${2?$usage} echo "Creating $themake ... " local makeprops=${TOP_SRCDIR}/.toc.make.tmp toc_dump_make_properties > $makeprops local thedir local tocmake local relpath local shortform local tocmakeprops for d in $(find ${TOP_SRCDIR} -name Makefile -o -name GNUMakefile -o -name Makefile.toc -o -name '*.qmake' \ | xargs grep -E -l "include.+${themake}" | sort -u); do #echo "d=$d" >&2 thedir=$(dirname $d) tocmake=${thedir}/$themake toc_makerelative $thedir relpath=${TOC_MAKERELATIVE} tocmake=${tocmake##$TOP_SRCDIR/} # make it short, for asthetic reasons :/ shortform=${thedir##${PWD}/} test "$shortform" = "$PWD" && shortform= # top-most dir # echo "tocmake=$tocmake relpath=$relpath shortform=$shortform" tocmakeprops=${cmake}.props cp $makeprops $tocmakeprops cat <<EOF >> $tocmakeprops TOP_SRCDIR=${relpath##./} TOC_RELATIVE_DIR=${shortform##./} EOF toc_atfilter_file $tocmakeprops $themakein $tocmake \ || toc_die $? "Error creating $themake!" rm $tocmakeprops touch $tocmake # required for proper auto-reconfigure :/ done } toc_make_toc_make ${TOC_MAKE} ${TOC_HOME}/make/toc.make.at err=$? test $err != 0 && { echo "Error creating ${TOC_MAKE} makefiles!" return $err } test -f ${TOP_SRCDIR}/toc.${PACKAGE_NAME}.qmake.at && { toc_make_toc_make ${TOC_QMAKE} ${TOC_HOME}/make/toc.qmake.at err=$? test $err != 0 && { echo "Error creating ${TOC_QMAKE} makefiles!" return $err } } return $err --- NEW FILE: lyxport.sh --- #!/do/not/bash # toc_run_description = looking for lyxport # toc_begin_help = # Looks for the lyxport tool (http://www-hep.colorado.edu/~fperez/lyxport). # Use --without-lyxport to disable it. It exports these variables: # # - LYXPORT_BIN=/path/to/lyxport # - LYXPORT_MAKE=/path/to/lyxport.make (part of toc) # Additionally, it *might* export the following: # # # - PS2PDF_BIN # - LYX_BIN # - LATEX_BIN # - LATEX2HTML_BIN # - DVIPS_BIN # - DVI2TTY_BIN # # Usage: put something like the following in your makefile template: # # configure_with_lyxport = @configure_with_lyxport@ # ifeq (1,$(configure_with_lyxport)) # LYXPORT_L2HARGS = -nonavigation -show_section_numbers -split 0 -noimages # LYXPORT_ARGS = -c -tt # LYXPORT_ARGS += --html --opts_l2h '$(LYXPORT_L2HARGS)' # LYXPORT_ARGS += --ps --pdf # endif # # = toc_end_help toc_export LYXPORT_BIN= toc_export LYXPORT_MAKE= toc_add_make configure_with_lyxport=0 test "x${configure_with_lyxport-1}" = "x0" && { echo "lyxport has been explicitely disabled." return 1 } configure_with_lyxport=${configure_with_lyxport-1} lyxport=lyxport test x1 != x${configure_with_lyxport} && lyxport=${configure_with_lyxport} path=${PATH}:${TOC_HOME}/bin toc_find $lyxport $path || { echo "lyxport not found. You can possibly find lyxport at http://www-hep.colorado.edu/~fperez/lyxport" return 1 } lyxport=${TOC_FIND_RESULT} lyxport_makefile=${TOC_HOME}/make/lyxport.make toc_find $lyxport_makefile || { echo "lyxport requires $lyxport_makefile" return 1 } lyxport_make=${TOC_FIND_RESULT} auxtools="lyx latex latex2html dvips ps2pdf dvi2tty" foundtools=0 for i in $auxtools; do toc_find $i && foundtools=1 test "$i" = "lyx" -a -z "${TOC_FIND_RESULT}" && { echo "Required app $i not found in PATH." return 1 } fn=${TOC_FIND_RESULT} big=$(echo $i | tr [:lower:] [:upper:])_BIN toc_export ${big}=$fn done test "x$foundtools" = "x0" && { echo "None of the auxillary tools for lyxport found: $auxtools" return 1 } toc_export LYXPORT_BIN=${lyxport} toc_export LYXPORT_MAKE=${lyxport_make} toc_export configure_with_lyxport=${configure_with_lyxport} return 0 --- NEW FILE: toc_core_tests.sh --- #!/do/not/bash # toc_run_description = Looking for required build components... # toc_begin_help = # To be sourced from toc_core.sh. This is the core sanity checker for # toc. Any test which MUST pass for a tree to be considered # toc-capable may be placed in here. # = toc_end_help toc_run running_under_cygwin # toc_quietly "Looking for required build components:" for x in \ bash=SHELL \ cat=CAT \ cut=CUT \ ls=LS \ perl=PERL \ sed=SED \ xargs=XARGS \ ; do f=${x%%=*} v=${x##*=} toc_find $f || { echo "configure couldn't find required app: $f" return 1 } test "x$v" = "xXtocX" && continue toc_add_make $v=${TOC_FIND_RESULT} done toc_find less || toc_find more || { echo "Found neither 'more' nor 'less'!!!" return 1 } toc_find_require install-sh ${TOC_HOME}/bin # toc_add_make INSTALLER_BIN="\$(top_srcdir)/${TOC_FIND_RESULT##${PWD}/}" toc_add_make INSTALLER_BIN="${TOC_FIND_RESULT}" toc_find_require makedist ${TOC_HOME}/bin toc_add_make TOC_MAKEDIST_BIN="${TOC_FIND_RESULT}" # it's very arguable to make makedist a required component :/ for x in \ awk \ gnu_make \ gnu_find \ gnu_tar \ ; do toc_test $x || { echo "${TOC_EMOTICON_ERROR} $x test failed." return 1 } done #toc_test gnu_install || { # boldecho "Didn't find GNU install. You won't be able to do a 'make install'." #} toc_quietly "Looking for optional build components:" for x in \ gzip=GZIP \ bzip2=BZIP \ zip=ZIP \ ; do f=${x%%=*} v=${x##*=} foo=configure_with_${f} toc_find $f toc_add_make $v=${TOC_FIND_RESULT} done return 0 --- NEW FILE: doxygen.sh --- #!/do/not/bash # toc_run_description = looking for doxygen, API doc generation tool. # toc_begin_help = # # Looks for doxygen in the ${PATH} or the binary specified using # --with-doxygen=/path/to/doxygen. It calls toc_export for the # following vars: # # - DOXYGEN_BIN=/path/to/doxygen, or empty string if we got # --without-doxygen or a bad value for --with-doxygen=... # # It returns zero if it finds doxygen, else non-zero. # # = toc_end_help if test "x${configure_with_doxygen}" = "x0"; then echo "doxygen support has been explicitely disabled." toc_export DOXYGEN_BIN= return 1 fi if test "x${configure_with_doxygen}" = x || test "x${configure_with_doxygen}" = x1; then toc_find_in_path doxygen "$PATH" && DOXYGEN_BIN=${TOC_FIND_RESULT} elif test "x${configure_with_doxygen}" = x0; then DOXYGEN_BIN= else if test -x ${configure_with_doxygen}; then DOXYGEN_BIN="${configure_with_doxygen}" else # I hate shell scripts!! echo '--with-doxygen "'"${configure_with_doxygen}"'" isn'"'t executable!" toc_export DOXYGEN_BIN= return 1 fi fi toc_export DOXYGEN_BIN="$DOXYGEN_BIN" return 0 --- NEW FILE: check_dist_md5s.sh --- # toc_run_description = checking MD5 sums of your distribution distname=${PWD##*/} fn=${1-md5.sums.${distname}} test ! -f $fn && { echo "File $fn not found. Skipping md5 check." return 0; } toc_find_in_path md5sum || { echo "md5sum not found in your PATH. Skipping md5 check! ${TOC_EMOTICON_WARNING}" return 0 } md5=${TOC_FIND_RESULT} tmp=.toc.checkmd5.foo ret=0 $md5 -c $fn > $tmp || { grep FAILED $tmp echo "md5 check failed! Your distribution does not seem to be an unmodified copy of ${PACKAGE_NAME}!" ret=1 } rm $tmp return $ret |