1 | AC_INIT(vizservers, 0.1, rappture@nanohub.org) |
---|
2 | |
---|
3 | VERSION=0.0.1 |
---|
4 | AC_SUBST(VERSION) |
---|
5 | |
---|
6 | #------------------------------------------------------------------------ |
---|
7 | # Handle the --prefix=... option |
---|
8 | #------------------------------------------------------------------------ |
---|
9 | |
---|
10 | if test "${prefix}" = "NONE"; then |
---|
11 | prefix=/usr/local |
---|
12 | fi |
---|
13 | if test "${exec_prefix}" = "NONE"; then |
---|
14 | exec_prefix=$prefix |
---|
15 | fi |
---|
16 | |
---|
17 | if test "${libdir}" != "${prefix}/lib"; then |
---|
18 | LIB_SEARCH_DIRS="-L ${prefix}/lib -L ${libdir}" |
---|
19 | else |
---|
20 | LIB_SEARCH_DIRS="-L ${libdir}" |
---|
21 | fi |
---|
22 | |
---|
23 | AC_SUBST(LIB_SEARCH_DIRS) |
---|
24 | |
---|
25 | AC_PROG_INSTALL |
---|
26 | AC_PROG_MAKE_SET |
---|
27 | |
---|
28 | dnl find and test the C compiler |
---|
29 | AC_PROG_CC |
---|
30 | AC_LANG_C |
---|
31 | |
---|
32 | AC_PROG_CXX |
---|
33 | AC_LANG_CPLUSPLUS |
---|
34 | |
---|
35 | SUBDIRS="nanoscale nanovis pymolproxy" |
---|
36 | AC_SUBST(SUBDIRS) |
---|
37 | |
---|
38 | AC_ARG_WITH( |
---|
39 | [tcllib], |
---|
40 | [AS_HELP_STRING([--with-tcllib[=DIR]], |
---|
41 | [location of Tcl binary library libtclstubs.a @<:@default=/usr/lib@:>@])], |
---|
42 | [with_tcllib=$withval], |
---|
43 | [with_tcllib=/usr/lib]) |
---|
44 | |
---|
45 | TCL_LIB_DIR="" |
---|
46 | TCL_LIB="" |
---|
47 | TCL_LIB_VERSION="" |
---|
48 | AC_MSG_CHECKING([for tcl binary libraries]) |
---|
49 | if test "x$with_tcllib" != "x" ; then |
---|
50 | if test -f "$with_tcllib" |
---|
51 | then |
---|
52 | if test -n `basename $with_tcllib | grep libtcl[0-9]\.[0-9].so` |
---|
53 | then |
---|
54 | TCL_LIB_DIR="$with_tcllib" |
---|
55 | fi |
---|
56 | else |
---|
57 | if test -d "$with_tcllib" |
---|
58 | then |
---|
59 | if test -x "$with_tcllib/`ls $with_tcllib | grep libtcl[0-9]\.[0-9]\.so$`" |
---|
60 | then |
---|
61 | TCL_LIB_DIR="$with_tcllib" |
---|
62 | else |
---|
63 | AC_MSG_RESULT([no]) |
---|
64 | AC_MSG_ERROR([cannot find tcl binary libraries, try using --with-tcllib]) |
---|
65 | fi |
---|
66 | else |
---|
67 | AC_MSG_RESULT([no]) |
---|
68 | AC_MSG_ERROR([cannot find tcl binary libraries inside $with_tcllib, try using --with-tcllib]) |
---|
69 | fi |
---|
70 | fi |
---|
71 | else |
---|
72 | AC_CHECK_HEADERS([tcl.h], [], |
---|
73 | [AC_MSG_ERROR([cannot find tcl.h, try using --with-tclinclude])]) |
---|
74 | fi |
---|
75 | # TCL_LIB=$(ls ${TCL_LIB_DIR} | grep -o libtcl[0-9]\.[0-9]) |
---|
76 | # TCL_LIB=`ls ${TCL_LIB_DIR} | awk '/libtcl([0-9]\.?[0-9])?\.so/ { print }'` |
---|
77 | # TCL_LIB=`ls ${TCL_LIB_DIR} | sed -e '/libtcl([0-9]\.?[0-9])?\.so$/ {p}'` |
---|
78 | # TCL_LIB_VERSION=$(echo ${TCL_LIB} | sed -e s/libtcl// -e s/\.so//) |
---|
79 | AC_MSG_RESULT([${TCL_LIB_DIR}/${TCL_LIB}]) |
---|
80 | # echo TCL_LIB_DIR = ${TCL_LIB_DIR} |
---|
81 | # echo TCL_LIB = ${TCL_LIB} |
---|
82 | # echo TCL_LIB_VERSION = ${TCL_LIB_VERSION} |
---|
83 | AC_SUBST(TCL_LIB_DIR) |
---|
84 | AC_SUBST(TCL_LIB) |
---|
85 | AC_SUBST(TCL_LIB_VERSION) |
---|
86 | |
---|
87 | AC_ARG_WITH( |
---|
88 | [tclinclude], |
---|
89 | [AS_HELP_STRING([--with-tclinclude[=DIR]], |
---|
90 | [location of tcl.h header file @<:@default=/usr/include@:>@])], |
---|
91 | [with_tclinclude=$withval], |
---|
92 | [with_tclinclude=/usr/include]) |
---|
93 | |
---|
94 | TCL_INCL_DIR="" |
---|
95 | AC_MSG_CHECKING([for tcl.h]) |
---|
96 | if test "x$with_tclinclude" != "x" ; then |
---|
97 | if test -f "$with_tclinclude" |
---|
98 | then |
---|
99 | if test `basename $with_tclinclude` = "tcl.h" |
---|
100 | then |
---|
101 | TCL_INCL_DIR="`dirname $with_tclinclude`" |
---|
102 | fi |
---|
103 | else |
---|
104 | if test -d "$with_tclinclude" |
---|
105 | then |
---|
106 | if test -r "$with_tclinclude/tcl.h" |
---|
107 | then |
---|
108 | TCL_INCL_DIR="$with_tclinclude" |
---|
109 | else |
---|
110 | if test -r "$with_tclinclude/tcl${TCL_LIB_VERSION}/tcl.h" |
---|
111 | then |
---|
112 | TCL_INCL_DIR="$with_tclinclude/tcl${TCL_LIB_VERSION}" |
---|
113 | else |
---|
114 | AC_MSG_RESULT([no]) |
---|
115 | AC_MSG_ERROR([cannot find tcl.h, try using --with-tclinclude]) |
---|
116 | fi |
---|
117 | fi |
---|
118 | else |
---|
119 | AC_MSG_RESULT([no]) |
---|
120 | AC_MSG_ERROR([cannot find tcl.h inside $with_tclinclude, try using --with-tclinclude]) |
---|
121 | fi |
---|
122 | fi |
---|
123 | else |
---|
124 | AC_CHECK_HEADERS([tcl.h], [], |
---|
125 | [AC_MSG_ERROR([cannot find tcl.h, try using --with-tclinclude])]) |
---|
126 | fi |
---|
127 | AC_MSG_RESULT([${TCL_INCL_DIR}]) |
---|
128 | AC_SUBST(TCL_INCL_DIR) |
---|
129 | |
---|
130 | AC_ARG_WITH( |
---|
131 | [rappture], |
---|
132 | [AS_HELP_STRING([--with-rappture[=DIR]], |
---|
133 | [location of rappture files lib/librappture2.a and include/rappture2/rappture2.h @<:@default=/usr@:>@])], |
---|
134 | [with_rappture=$withval], |
---|
135 | [with_rappture=/usr]) |
---|
136 | |
---|
137 | RP2_INCL_DIR="" |
---|
138 | RP_DIR="" |
---|
139 | AC_MSG_CHECKING([for rappture]) |
---|
140 | if test "x$with_rappture" != "x" ; then |
---|
141 | if test "x$with_rappture" != "xprefix" ; then |
---|
142 | if test -f "$with_rappture" |
---|
143 | then |
---|
144 | AC_MSG_RESULT([no]) |
---|
145 | AC_MSG_ERROR([please provide --with-rappture with directory]) |
---|
146 | else |
---|
147 | if test -d "$with_rappture" |
---|
148 | then |
---|
149 | if test -r "$with_rappture/include/rappture2/rappture2.h" -a -r "$with_rappture/lib/librappture2.a" |
---|
150 | then |
---|
151 | RP2_INCL_DIR="$with_rappture/include/rappture2" |
---|
152 | RP_DIR="$with_rappture" |
---|
153 | AC_MSG_RESULT([yes]) |
---|
154 | else |
---|
155 | AC_MSG_RESULT([no]) |
---|
156 | AC_MSG_ERROR([cannot find rappture2.h and librappture2.a, try using --with-rappture]) |
---|
157 | fi |
---|
158 | else |
---|
159 | AC_MSG_RESULT([no]) |
---|
160 | AC_MSG_ERROR([cannot find rappture2.h and librappture2.a inside $with_rappture, try using --with-rappture]) |
---|
161 | fi |
---|
162 | fi |
---|
163 | else |
---|
164 | RP2_INCL_DIR="$prefix/include/rappture2" |
---|
165 | RP_DIR="$prefix" |
---|
166 | AC_MSG_RESULT([set to prefix]) |
---|
167 | fi |
---|
168 | else |
---|
169 | AC_CHECK_HEADERS([rappture.h], [], |
---|
170 | [AC_MSG_ERROR([cannot find rappture.h, try using --with-rappture])]) |
---|
171 | fi |
---|
172 | AC_MSG_RESULT([${RP_DIR}/include]) |
---|
173 | AC_SUBST(RP2_INCL_DIR) |
---|
174 | AC_SUBST(RP_DIR) |
---|
175 | |
---|
176 | dnl AC_MSG_CHECKING(tcl library version) |
---|
177 | dnl TCL=`AC_TRY_RUN([#include <tcl.h> |
---|
178 | dnl int main() {printf("tcl%s",TCL_VERSION);return(0);}],, |
---|
179 | dnl echo "tcl8.4", echo "tcl8.4")` |
---|
180 | dnl AC_MSG_RESULT($TCL) |
---|
181 | dnl AC_MSG_CHECKING(tk library version) |
---|
182 | dnl TK=`AC_TRY_RUN([#include <tk.h> |
---|
183 | dnl main() {printf("tk%s", TK_VERSION); exit(0);}],, |
---|
184 | dnl echo "tk8.4", echo "tk8.4")` |
---|
185 | dnl AC_MSG_RESULT($TK) |
---|
186 | |
---|
187 | |
---|
188 | AC_OUTPUT( Makefile nanoscale/Makefile nanovis/Makefile pymolproxy/Makefile start_viz.sh) |
---|