文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Check specified library shell

Check specified library shell

时间:2009-08-13  来源:creatory

#!/bin/sh
#this script is used to check if there is bfd library installed.
#I know gcc how to get input from standard input through pipe
#and redirect stdout and stderr to /dev/null
printf "Begin to check bfd library..."
case $CC in
    *gcc*)
        ;;
    *)
        #if not gcc,exit
        printf "Ignore.\n"
        exit 0;;
esac
SRC="
#include <stdlib.h>
#include <bfd.h>
int main(int argc,char **argv){
    bfd *abfd=bfd_openr(NULL,NULL);
    return 0;
}
"

PROG="check-bfd"
OBJECT=${PROG}.o
ERR_MESSAGE="It seems that you don't have bfd library.
Try to run \"make NO_BFD=1\" to ignore it"
#gcc:-E or -x required when input is from standard input
#c - :stands for the input from pipe
if ! ( echo "$SRC" | $CC -o $OBJECT -x c - >/dev/null 2>&1  );then
    printf "FAILED.\n"
    printf "$ERR_MESSAGE\n"
    exit 1
fi
rm -f $OBJECT
printf "OK\n"
exit 0
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载