From 86789f9b699520c09a4def5122e46fd9b1b6f827 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 15 Aug 1996 07:12:00 +0000 Subject: [PATCH] * configure.in: If we can find the library for tcl7.5, build gtcltk-lib. Call AC_PROG_CC, to help run that test with the right compiler (not sure this is necessary). --- configure | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 13 ++++ 2 files changed, 187 insertions(+) diff --git a/configure b/configure index 1dc7a49ea..0323a9917 100755 --- a/configure +++ b/configure @@ -518,6 +518,179 @@ fi all_subdirs=`cat $srcdir/*/PLUGIN/REQ $srcdir/*/PLUGIN/OPT /dev/null | tsort | xargs echo` req_subdirs=`cat $srcdir/*/PLUGIN/REQ /dev/null | tsort | xargs echo` opt_subdirs=`cat $srcdir/*/PLUGIN/OPT /dev/null | tsort | xargs echo` + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +### Use gtcltk-lib only if we seem to have Tcl installed on the +### system. This way of doing this doesn't really fit into the PLUGIN +### approach, but I'm not sure how to do it more gracefully within +### that approach. +echo $ac_n "checking for -ltcl7.5""... $ac_c" 1>&6 +ac_lib_var=`echo tcl7.5'_'Tcl_CreateInterp | tr './+\055' '__p_'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl7.5 -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_tcl=true +else + echo "$ac_t""no" 1>&6 +have_tcl=false +fi + +if $have_tcl; then :; else + all_subdirs="`echo $all_subdirs | sed s:gtcltk-lib::`" + req_subdirs="`echo $req_subdirs | sed s:gtcltk-lib::`" +fi + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -711,6 +884,7 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g +s%@CC@%$CC%g s%@subdirs@%$subdirs%g s%@existingdirs@%$existingdirs%g s%@GUILE_VERSION@%$GUILE_VERSION%g diff --git a/configure.in b/configure.in index c0b3f6586..507044261 100644 --- a/configure.in +++ b/configure.in @@ -5,6 +5,19 @@ AC_INIT(Makefile.in) all_subdirs=`cat $srcdir/*/PLUGIN/REQ $srcdir/*/PLUGIN/OPT /dev/null | tsort | xargs echo` req_subdirs=`cat $srcdir/*/PLUGIN/REQ /dev/null | tsort | xargs echo` opt_subdirs=`cat $srcdir/*/PLUGIN/OPT /dev/null | tsort | xargs echo` + +AC_PROG_CC + +### Use gtcltk-lib only if we seem to have Tcl installed on the +### system. This way of doing this doesn't really fit into the PLUGIN +### approach, but I'm not sure how to do it more gracefully within +### that approach. +AC_CHECK_LIB(tcl7.5, Tcl_CreateInterp, have_tcl=true, have_tcl=false, -lm) +if $have_tcl; then :; else + all_subdirs="`echo $all_subdirs | sed s:gtcltk-lib::`" + req_subdirs="`echo $req_subdirs | sed s:gtcltk-lib::`" +fi + AC_CONFIG_SUBDIRS($all_subdirs) existingdirs= for d in $all_subdirs; do