comparison configure @ 16799:da24dff28bbc

add a cxx_check function to simplify C++ libs checking
author aurel
date Tue, 18 Oct 2005 21:30:43 +0000
parents 1816685a3d7b
children 3e8a61c10b47
comparison
equal deleted inserted replaced
16798:9d293690ecad 16799:da24dff28bbc
28 LC_ALL=C 28 LC_ALL=C
29 export LC_ALL 29 export LC_ALL
30 30
31 # Prefer these macros to full length text ! 31 # Prefer these macros to full length text !
32 # These macros only return an error code - NO display is done 32 # These macros only return an error code - NO display is done
33 cc_check() { 33 compile_check() {
34 echo >> "$TMPLOG" 34 echo >> "$TMPLOG"
35 cat "$TMPC" >> "$TMPLOG" 35 cat "$1" >> "$TMPLOG"
36 echo >> "$TMPLOG" 36 echo >> "$TMPLOG"
37 echo "$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra $TMPC -o $TMPO $@" >> "$TMPLOG" 37 echo "$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o $TMPO $@" >> "$TMPLOG"
38 rm -f "$TMPO" 38 rm -f "$TMPO"
39 $_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra "$TMPC" -o "$TMPO" "$@" >> "$TMPLOG" 2>&1 39 $_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o "$TMPO" "$@" >> "$TMPLOG" 2>&1
40 TMP="$?" 40 TMP="$?"
41 echo >> "$TMPLOG" 41 echo >> "$TMPLOG"
42 echo "ldd $TMPO" >> "$TMPLOG" 42 echo "ldd $TMPO" >> "$TMPLOG"
43 $_ldd "$TMPO" >> "$TMPLOG" 2>&1 43 $_ldd "$TMPO" >> "$TMPLOG" 2>&1
44 echo >> "$TMPLOG" 44 echo >> "$TMPLOG"
45 return "$TMP" 45 return "$TMP"
46 }
47
48 cc_check() {
49 compile_check $TMPC $@
50 }
51
52 cxx_check() {
53 compile_check $TMPCPP $@ -lstdc++
46 } 54 }
47 55
48 # Display error message, flushes tempfile, exit 56 # Display error message, flushes tempfile, exit
49 die () { 57 die () {
50 echo 58 echo
5617 public: int myreturn(void); 5625 public: int myreturn(void);
5618 }; 5626 };
5619 int myclass::myreturn(void) { ret = 0; return ret ; } 5627 int myclass::myreturn(void) { ret = 0; return ret ; }
5620 int main(void) { myclass myobject; return myobject.myreturn(); } 5628 int main(void) { myclass myobject; return myobject.myreturn(); }
5621 EOF 5629 EOF
5622 echo "------------------------------------------------" >> "$TMPLOG" 5630 if cxx_check && "$TMPO" >> "$TMPLOG" 2>&1 ; then
5623 cat "$TMPCPP" >> "$TMPLOG"
5624 if ( $_cc "$TMPCPP" -o "$TMPO" && "$TMPO" ) >> "$TMPLOG" 2>&1 ; then
5625 _dshow=yes 5631 _dshow=yes
5626 echores "yes (C++ is ok)" 5632 echores "yes (C++ is ok)"
5627 else 5633 else
5628 echores "no" 5634 echores "no"
5629 cat << EOF 5635 cat << EOF
5725 echores "$_real" 5731 echores "$_real"
5726 5732
5727 5733
5728 echocheck "LIVE555 Streaming Media libraries" 5734 echocheck "LIVE555 Streaming Media libraries"
5729 if test "$_live" = auto && test "$_network" = yes ; then 5735 if test "$_live" = auto && test "$_network" = yes ; then
5730 _TMPC=$TMPC 5736 cat > $TMPCPP << EOF
5731 TMPC=$TMPCPP
5732 cat >$TMPC <<EOF
5733 #include <liveMedia.hh> 5737 #include <liveMedia.hh>
5734 #if (LIVEMEDIA_LIBRARY_VERSION_INT < 1090195200) 5738 #if (LIVEMEDIA_LIBRARY_VERSION_INT < 1090195200)
5735 #error Please upgrade to version 2004.07.19 or later of the "LIVE555 Streaming Media" libraries - available from <www.live555.com/liveMedia/> 5739 #error Please upgrade to version 2004.07.19 or later of the "LIVE555 Streaming Media" libraries - available from <www.live555.com/liveMedia/>
5736 #endif 5740 #endif
5737 int main(void) {} 5741 int main(void) {}
5738 EOF 5742 EOF
5739 5743
5740 _live=no 5744 _live=no
5741 for I in "$_livelibdir" "$_libdir/live" "/usr/lib/live" "/usr/local/live" "/usr/local/lib/live" ; do 5745 for I in "$_livelibdir" "$_libdir/live" "/usr/lib/live" "/usr/local/live" "/usr/local/lib/live" ; do
5742 cc_check -I$I/liveMedia/include -I$I/UsageEnvironment/include -I$I/groupsock/include && _livelibdir=$I && _live=yes && break 5746 cxx_check -I$I/liveMedia/include -I$I/UsageEnvironment/include -I$I/groupsock/include && _livelibdir=$I && _live=yes && break
5743 done 5747 done
5744 if test "$_live" != yes ; then 5748 if test "$_live" != yes ; then
5745 if cc_check -I/usr/include/liveMedia -I/usr/include/UsageEnvironment -I/usr/include/groupsock; then 5749 if cxx_check -I/usr/include/liveMedia -I/usr/include/UsageEnvironment -I/usr/include/groupsock; then
5746 _live_dist=yes 5750 _live_dist=yes
5747 fi 5751 fi
5748 fi 5752 fi
5749
5750 TMPC=$_TMPC
5751 fi 5753 fi
5752 if test "$_live" = yes && test "$_network" = yes ; then 5754 if test "$_live" = yes && test "$_network" = yes ; then
5753 echores "yes (using $_livelibdir)" 5755 echores "yes (using $_livelibdir)"
5754 _def_live='#define STREAMING_LIVE555 1' 5756 _def_live='#define STREAMING_LIVE555 1'
5755 _live_libs_def="# LIVE555 Streaming Media libraries: 5757 _live_libs_def="# LIVE555 Streaming Media libraries: