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