initial
[prop.git] / Configure
blobdd14e3551fccac3fa8148d11abb6cc34d8231b46
1 #!/bin/sh
3 export PATH
4 PATH="/bin:/usr/bin:/usr/local/bin"
5 modules="lib-src prop-src tests"
7 CC=$1
9 iostream_lib=""
10 if [ "none$CC" = "none" ]; then
11 echo "No compiler specified, assuming g++";
12 CC="g++";
15 case `uname -s` in
16 HP-UX) ARCH=hpux
18 Linux) ARCH=linux
19 iostream_lib="s/\\\$(gcc-iostream-lib)/-liostream/"
21 SunOS)
22 case `uname -r` in
23 4.1.*) ARCH=sunos ;;
24 5.*.*) ARCH=solaris ;;
25 esac
27 *) ARCH=default ;;
28 esac
30 case $CC in
31 g++) LDOPTS="-lg++";
32 COPTS="-O6";
34 CC*) LDOPTS="";
35 COPTS="-O6";
37 *) LDOPTS="";
38 COPTS="-O6";
40 esac
42 echo "Using the $CC compiler"
44 echo "$CC -S configure-dir/testbool.C -o /dev/null 2> /dev/null"
45 $CC -S configure-dir/testbool.C -o /dev/null 2> /dev/null
46 if [ $? = 0 ]; then
47 echo "Good, your $CC compiler has the type bool.";
48 bool=yes;
49 else
50 echo "Seems like you don't have the type bool.";
51 echo "I'll define it as int.";
52 bool=no;
55 $CC -S configure-dir/testexplicit.C -o /dev/null 2> /dev/null
56 if [ $? = 0 ]; then
57 echo "Good, your $CC compiler has the keyword explicit.";
58 explicit=yes;
59 else
60 echo "Seems like you don't have the keyword explicit.";
61 echo "I'll define it as the empty string.";
62 explicit=no;
65 $CC configure-dir/testgetrusage.C -o configure-dir/testgetrusage 2> /dev/null
66 if [ $? = 0 ]; then
67 echo "Good, getrusage() is working"
68 getrusage=yes;
69 rm configure-dir/testgetrusage
70 else
71 echo "Seems like getrusage is not working"
72 echo "I'll comment out all usage of getrusage()"
73 getrusage=no;
76 $CC configure-dir/testtimes.C -o configure-dir/testtimes 2> /dev/null
77 if [ $? = 0 ]; then
78 echo "Good, times() is working"
79 times=yes;
80 rm configure-dir/testtimes
81 else
82 echo "Seems like times is not working"
83 echo "I'll comment out all usage of times()"
84 times=no;
87 >include/AD/config/config.h
88 echo "#ifndef prop_library_configuration_h" >>include/AD/config/config.h
89 echo "#define prop_library_configuration_h" >>include/AD/config/config.h
90 if [ $bool = yes ]; then
91 echo "#define PROP_BOOL_IS_DEFINED" >>include/AD/config/config.h;
93 if [ $explicit = yes ]; then
94 echo "#define PROP_EXPLICIT_IS_DEFINED" >>include/AD/config/config.h;
96 if [ $getrusage = yes ]; then
97 echo "#define PROP_HAS_GETRUSAGE" >>include/AD/config/config.h;
99 if [ $times = yes ]; then
100 echo "#define PROP_HAS_TIMES" >>include/AD/config/config.h;
102 echo "#endif" >>include/AD/config/config.h
103 echo "include/AD/config/config.h created"
106 replace="$iostream_lib"
107 #echo "$replace"
109 echo "Using the $ARCH configuration"
110 for module in $modules ;
112 module_name=`echo $module | sed -e 's/\//:/g'`
113 echo "sed -e $replace < configure-dir/Makefile.$module_name > $module/Makefile"
114 sed -e "$replace" < configure-dir/Makefile.$module_name > $module/Makefile
115 done