1 | #!/bin/sh
|
---|
2 |
|
---|
3 | makefile_config="Makefile.config"
|
---|
4 |
|
---|
5 | # コマンドライン引数の処理
|
---|
6 | for arg in "$@"
|
---|
7 | do
|
---|
8 | name=`echo $arg | cut -d "=" -f 1`
|
---|
9 | value=`echo $arg | cut -d "=" -f 2`
|
---|
10 |
|
---|
11 | case $name in
|
---|
12 | --with-headers) include_path=$value ;;
|
---|
13 | --with-libraries) library_path=$value ;;
|
---|
14 | --help) echo "configure options:"
|
---|
15 | echo "--help"
|
---|
16 | echo " display this information"
|
---|
17 | echo "--with-headers=<dir>"
|
---|
18 | echo " specify the directory of Boost headers"
|
---|
19 | echo "--with-libraries=<dir>"
|
---|
20 | echo " specify the directory of Boost libraries"
|
---|
21 | exit
|
---|
22 | ;;
|
---|
23 | esac
|
---|
24 | done
|
---|
25 |
|
---|
26 | # Boost C++ Librariesのヘッダファイルがあるディレクトリをサーチ
|
---|
27 | for dir in $include_path "/usr/local/include" "/opt/local/include" "/opt/include" "/usr/include" "/mingw/include"
|
---|
28 | do
|
---|
29 | ls $dir/boost* 2> /dev/null > /dev/null
|
---|
30 | if test $? -eq 0
|
---|
31 | then
|
---|
32 | boost_dir=`ls -d $dir/boost* | sort -r | head -1`
|
---|
33 | if test $boost_dir = $dir/boost
|
---|
34 | then
|
---|
35 | include_path=$dir
|
---|
36 | else
|
---|
37 | include_path=$boost_dir
|
---|
38 | fi
|
---|
39 | break
|
---|
40 | fi
|
---|
41 | done
|
---|
42 |
|
---|
43 | # Boost C++ Librariesのライブラリファイルがあるディレクトリをサーチ
|
---|
44 | for dir in $library_path "/usr/local/lib" "/opt/local/lib" "/opt/lib" "/usr/lib" "/lib" "/mingw/lib"
|
---|
45 | do
|
---|
46 | ls $dir/libboost* 2> /dev/null > /dev/null
|
---|
47 | if test $? -eq 0
|
---|
48 | then
|
---|
49 | library_path=$dir
|
---|
50 | break
|
---|
51 | fi
|
---|
52 | done
|
---|
53 |
|
---|
54 | ##### 以下、Makefile.configを生成する #####
|
---|
55 |
|
---|
56 | rm Makefile.config 2> /dev/null
|
---|
57 |
|
---|
58 | # Boost C++ Librariesのバージョンを調べる
|
---|
59 | boost_version=`echo "#include <boost/version.hpp>
|
---|
60 | echo BOOST_VERSION" | g++ -E -I$include_path -L$library_path - | sh`
|
---|
61 |
|
---|
62 | boost_lib_version=`echo "#include <boost/version.hpp>
|
---|
63 | echo BOOST_LIB_VERSION" | g++ -E -I$include_path -L$library_path - | sh`
|
---|
64 |
|
---|
65 | # ライブラリファイルの添字を調べる
|
---|
66 | # 環境によって、-gcc-mt-s, -mt-s, -gcc42-mt-sなど、添字が異なるため
|
---|
67 | libboost_regex_filename=`ls $library_path/libboost_regex*-s.* 2> /dev/null | head -1`
|
---|
68 | if test -z $libboost_regex_filename
|
---|
69 | then
|
---|
70 | libboost_regex_filename=`ls $library_path/libboost_regex*.* | head -1`
|
---|
71 | fi
|
---|
72 | libboost_suffix=`echo $libboost_regex_filename | sed -e s/.*libboost_regex//g -e s/\.[a-z]*$//g`
|
---|
73 | echo "LIBBOOST_SUFFIX=$libboost_suffix" >> $makefile_config
|
---|
74 |
|
---|
75 | # 各種変数を出力
|
---|
76 | echo BOOST_VERSION=$boost_lib_version >> $makefile_config
|
---|
77 | echo BOOST_DIR=$include_path >> $makefile_config
|
---|
78 | echo LIBBOOST_DIR=$library_path >> $makefile_config
|
---|
79 | echo OPTIONS=$options >> $makefile_config
|
---|
80 |
|
---|
81 | # 生成結果を表示
|
---|
82 | cat Makefile.config
|
---|
83 |
|
---|
84 | # 終わり
|
---|