- $cc -print-file-name=libncursesw.so | grep -q /
- if [ $? -eq 0 ]; then
- echo '-lncursesw'
- exit
- fi
- $cc -print-file-name=libncurses.so | grep -q /
- if [ $? -eq 0 ]; then
- echo '-lncurses'
- exit
- fi
- $cc -print-file-name=libcurses.so | grep -q /
- if [ $? -eq 0 ]; then
- echo '-lcurses'
- exit
- fi
+ for ext in so dylib; do
+ for dir in "" /usr/local/lib /opt/local/lib; do
+ $cc ${dir:+-L$dir} -print-file-name=libncursesw.$ext | grep -q /
+ if [ $? -eq 0 ]; then
+ echo $dir '-lncursesw'
+ exit
+ fi
+ $cc ${dir:+-L$dir} -print-file-name=libncurses.$ext | grep -q /
+ if [ $? -eq 0 ]; then
+ echo $dir '-lncurses'
+ exit
+ fi
+ $cc ${dir:+-L$dir} -print-file-name=libcurses.$ext | grep -q /
+ if [ $? -eq 0 ]; then
+ echo $dir '-lcurses'
+ exit
+ fi
+ done
+ done