Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Minor fix
[palacios.git] / scripts / kconfig / lxdialog / check-lxdialog.sh
1 #!/bin/sh
2 # Check ncurses compatibility
3
4 # What library to link
5 ldflags()
6 {
7         $cc -print-file-name=libncursesw.so | grep -q /
8         if [ $? -eq 0 ]; then
9                 echo '-lncursesw'
10                 exit
11         fi
12         $cc -print-file-name=libncurses.so | grep -q /
13         if [ $? -eq 0 ]; then
14                 echo '-lncurses'
15                 exit
16         fi
17         $cc -print-file-name=libcurses.so | grep -q /
18         if [ $? -eq 0 ]; then
19                 echo '-lcurses'
20                 exit
21         fi
22         $cc -print-file-name=libncursesw.dylib | grep -q /
23         if [ $? -eq 0 ]; then
24                 echo '-lncursesw'
25                 exit
26         fi
27         $cc -print-file-name=libncurses.dylib | grep -q /
28         if [ $? -eq 0 ]; then
29                 echo '-lncurses'
30                 exit
31         fi
32         $cc -print-file-name=libcurses.dylib | grep -q /
33         if [ $? -eq 0 ]; then
34                 echo '-lcurses'
35                 exit
36         fi
37         exit 1
38 }
39
40 # Where is ncurses.h?
41 ccflags()
42 {
43         if [ -f /usr/include/ncurses/ncurses.h ]; then
44                 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
45         elif [ -f /usr/include/ncurses/curses.h ]; then
46                 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
47         elif [ -f /usr/include/ncurses.h ]; then
48                 echo '-DCURSES_LOC="<ncurses.h>"'
49         else
50                 echo '-DCURSES_LOC="<curses.h>"'
51         fi
52 }
53
54 # Temp file, try to clean up after us
55 tmp=.lxdialog.tmp
56 trap "rm -f $tmp" 0 1 2 3 15
57
58 # Check if we can link to ncurses
59 check() {
60         echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
61         if [ $? != 0 ]; then
62                 echo " *** Unable to find the ncurses libraries."          1>&2
63                 echo " *** make menuconfig require the ncurses libraries"  1>&2
64                 echo " *** "                                               1>&2
65                 echo " *** Install ncurses (ncurses-devel) and try again"  1>&2
66                 echo " *** "                                               1>&2
67                 exit 1
68         fi
69 }
70
71 usage() {
72         printf "Usage: $0 [-check compiler options|-header|-library]\n"
73 }
74
75 if [ $# == 0 ]; then
76         usage
77         exit 1
78 fi
79
80 cc=""
81 case "$1" in
82         "-check")
83                 shift
84                 cc="$@"
85                 check
86                 ;;
87         "-ccflags")
88                 ccflags
89                 ;;
90         "-ldflags")
91                 shift
92                 cc="$@"
93                 ldflags
94                 ;;
95         "*")
96                 usage
97                 exit 1
98                 ;;
99 esac