| 1 |  | 
|---|
| 2 | function print_message | 
|---|
| 3 | { | 
|---|
| 4 | echo "   " $@ | 
|---|
| 5 | } | 
|---|
| 6 |  | 
|---|
| 7 | function print_topic | 
|---|
| 8 | { | 
|---|
| 9 | echo -n "(II) " $@ | 
|---|
| 10 | } | 
|---|
| 11 |  | 
|---|
| 12 | function print_ack | 
|---|
| 13 | { | 
|---|
| 14 | echo "...ok" | 
|---|
| 15 | } | 
|---|
| 16 |  | 
|---|
| 17 | function print_nack | 
|---|
| 18 | { | 
|---|
| 19 | echo "...failed" | 
|---|
| 20 | } | 
|---|
| 21 |  | 
|---|
| 22 | function print_error | 
|---|
| 23 | { | 
|---|
| 24 | echo "(EE) " $@ | 
|---|
| 25 | } | 
|---|
| 26 |  | 
|---|
| 27 | function print_warning | 
|---|
| 28 | { | 
|---|
| 29 | echo "(WW) " $@ | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|
| 32 | function print_info | 
|---|
| 33 | { | 
|---|
| 34 | if [ $VERBOSE == "yes" ]; then | 
|---|
| 35 | echo "         " $@ | 
|---|
| 36 | fi | 
|---|
| 37 | } | 
|---|
| 38 |  | 
|---|
| 39 | function print_exit | 
|---|
| 40 | { | 
|---|
| 41 | echo " => fatal error occured - see (WW) and (EE) tags for more info" | 
|---|
| 42 | echo " => for support send a bugreport with this output to" | 
|---|
| 43 | echo "            $SUPPORT_ADDRESS" | 
|---|
| 44 | echo " => exiting gracefuly..." | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | function print_separator | 
|---|
| 48 | { | 
|---|
| 49 | echo "--------------------------------------------------------------" | 
|---|
| 50 | } | 
|---|
| 51 |  | 
|---|
| 52 | function print_small_separator | 
|---|
| 53 | { | 
|---|
| 54 | echo "      ---" | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | function print_newline | 
|---|
| 58 | { | 
|---|
| 59 | echo "" | 
|---|
| 60 | } | 
|---|
| 61 |  | 
|---|
| 62 |  | 
|---|
| 63 | #### Command Line Options | 
|---|
| 64 |  | 
|---|
| 65 | function check_command_line_options | 
|---|
| 66 | { | 
|---|
| 67 | local arg | 
|---|
| 68 | for arg in $@; do | 
|---|
| 69 | case $arg in | 
|---|
| 70 | --enable-glut ) | 
|---|
| 71 | ENABLE_GLUT="yes" | 
|---|
| 72 | ;; | 
|---|
| 73 | --disable-glut ) | 
|---|
| 74 | ENABLE_GLUT="no" | 
|---|
| 75 | ;; | 
|---|
| 76 | --enable-gtk ) | 
|---|
| 77 | ENABLE_GTK="yes" | 
|---|
| 78 | ;; | 
|---|
| 79 | --disable-gtk ) | 
|---|
| 80 | ENABLE_GTL="no" | 
|---|
| 81 | ;; | 
|---|
| 82 | -v ) | 
|---|
| 83 | VERBOSE="yes" | 
|---|
| 84 | ;; | 
|---|
| 85 | --verbose ) | 
|---|
| 86 | VERBOSE="yes" | 
|---|
| 87 | ;; | 
|---|
| 88 | *) | 
|---|
| 89 | print_command_line_options | 
|---|
| 90 | exit 1 | 
|---|
| 91 | ;; | 
|---|
| 92 | esac | 
|---|
| 93 | done | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 | function print_command_line_options | 
|---|
| 97 | { | 
|---|
| 98 | echo "" | 
|---|
| 99 | echo "USAGE:" | 
|---|
| 100 | echo "--enable-<option>     enable option" | 
|---|
| 101 | echo "--disable-<option>    disable option" | 
|---|
| 102 | echo "-v  --verbose         verbose output" | 
|---|
| 103 | echo "" | 
|---|
| 104 | echo "OPTIONS:" | 
|---|
| 105 | echo "glut                  enable use of glut library (default: $ENABLE_GLUT)" | 
|---|
| 106 | echo "gtk                   enable use of gtk libraty (default: $ENABLE_GTK)" | 
|---|
| 107 | echo "" | 
|---|
| 108 | echo "EXAMPLE:" | 
|---|
| 109 | echo "./configure --enable-gtk" | 
|---|
| 110 | echo "" | 
|---|
| 111 | } | 
|---|
| 112 |  | 
|---|
| 113 |  | 
|---|
| 114 | #### Check OS | 
|---|
| 115 | function get_OS | 
|---|
| 116 | { | 
|---|
| 117 | #if [ uname -a | awk '{print $1}' ==  "Linux" ]; then | 
|---|
| 118 | #       return 0 | 
|---|
| 119 | #fi | 
|---|
| 120 | #return 1 | 
|---|
| 121 | #name -a | awk '{if( $1 == "Linux" ) print "1"; else print "0"}' | 
|---|
| 122 | echo "not supported function" | 
|---|
| 123 | } | 
|---|
| 124 |  | 
|---|
| 125 |  | 
|---|
| 126 | #### Check GLUT | 
|---|
| 127 | function check_for_GLUT | 
|---|
| 128 | { | 
|---|
| 129 | local directory | 
|---|
| 130 | for directory in $std_include_dirs; do | 
|---|
| 131 | if [ -f $directory/glut.h ]; then | 
|---|
| 132 | GLUT_DIR=$directory/glut.h | 
|---|
| 133 | return 0 | 
|---|
| 134 | fi | 
|---|
| 135 | done | 
|---|
| 136 | return 1 | 
|---|
| 137 | } | 
|---|
| 138 |  | 
|---|
| 139 |  | 
|---|
| 140 | ### Check for Direct Rendering Support | 
|---|
| 141 | function check_for_glxinfo | 
|---|
| 142 | { | 
|---|
| 143 | local directory | 
|---|
| 144 | for directory in $std_bin_dirs; do | 
|---|
| 145 | if [ -f $directory/glxinfo ]; then | 
|---|
| 146 | return 0 | 
|---|
| 147 | fi | 
|---|
| 148 | done | 
|---|
| 149 | return 1 | 
|---|
| 150 | } | 
|---|
| 151 |  | 
|---|
| 152 | function check_for_dri | 
|---|
| 153 | { | 
|---|
| 154 | DRI_SUPPORT=`glxinfo | grep "direct rendering:" | awk '{print $3}'` | 
|---|
| 155 | if [ $DRI_SUPPORT == "No" ]; then | 
|---|
| 156 | return 1 | 
|---|
| 157 | fi | 
|---|
| 158 | return 0 | 
|---|
| 159 | } | 
|---|
| 160 |  | 
|---|
| 161 | ### GtK Check | 
|---|
| 162 | function check_for_gtk_config | 
|---|
| 163 | { | 
|---|
| 164 | local directory | 
|---|
| 165 | for directory in $std_bin_dirs; do | 
|---|
| 166 | if [ -f $directory/gtk-config ]; then | 
|---|
| 167 | GTK_CONFIG=$directory/gtk-config | 
|---|
| 168 | return 0 | 
|---|
| 169 | fi | 
|---|
| 170 | done | 
|---|
| 171 | return 1 | 
|---|
| 172 | } | 
|---|
| 173 |  | 
|---|