* update the changelog
[tango.git] / configure.in
bloba0e7053479ae7427635e8a5f256da7f5e1a0729a
1 dnl Process this file with autoconf to produce a configure script.
2 dnl This is the configuration file for the tango system.
3 dnl To process this file into a runnable shell-script, please run
4 dnl the script `bootstrap' which is found in the same directory as
5 dnl this file.
7 dnl For extensive help on autoconf, automake, and libtool, please
8 dnl consult the infofiles by running the `info' program, or by typing
9 dnl M-x info in your favourite editor (emacs)   
11 dnl For information on how to build and use an autoconfiscated
12 dnl project, please consult
13 dnl http://sources.redhat.com/autobook/autobook/autobook.html
14 dnl which is an online version of the Gnu Autoconf, Automake, and Libtool
15 dnl book by Vaughan, Elliston, Tromey, and Taylor
17 dnl What follows is the configuration, and comments to the macros used
19 dnl AC_INIT initializes autoconf, The first argument is the
20 dnl packagename, the second is the version used for the tar file,
21 dnl the third is an email address for bug reports (shouldn't be necessary),
22 dnl and the fourth argument is                
23 AC_INIT(Tango,6.1.1,tango@esrf.fr,tango)
25 dnl Tells autoconf that we want at least version 2.53 of autoconf to
26 dnl create configure from configure.in
27 AC_PREREQ(2.53)
29 dnl Lets the revision tag from cvs or rcs propagate into the
30 dnl configure script, handy for debugging.
31 AC_REVISION($Revision$)         
33 dnl Tells autoconf to use the directory `config' to stash its files and
34 dnl look for additional macros.
35 AC_CONFIG_AUX_DIR(config)
37 dnl AM_INIT_AUTOMAKE sets up automake which is used to generate
38 dnl Makefile.in from Makefile.am
39 AM_INIT_AUTOMAKE($PACKAGE_TARNAME, $PACKAGE_VERSION)            
41 dnl Tells automake to use `ac_config.h.tmp' to stash all the #defines
42 dnl that result from a run of configure.
43 dnl The name is .tmp since I must change the PACKAGE_ definitions because    
44 dnl of omniORBS installation of their version of this file.
45 AM_CONFIG_HEADER(ac_config.h.tmp)
48 dnl -version-info CURRENT[:REVISION[:AGE]]
49 dnl From the libtool documentation (info libtool)
50 dnl So, libtool library versions are described by three integers:
52 dnl CURRENT
53 dnl      The most recent interface number that this library implements.
55 dnl REVISION
56 dnl      The implementation number of the CURRENT interface.
58 dnl AGE
59 dnl      The difference between the newest and oldest interfaces that this
60 dnl      library implements.  In other words, the library implements all the
61 dnl      interface numbers in the range from number `CURRENT - AGE' to
62 dnl      `CURRENT'.
64 VERSION_INFO=7:1:1
65         
66 dnl Checks for programs.
67 AC_PROG_CXX      dnl check for a c++ compiler
68 AC_PROG_CXXCPP   dnl check for a c++ preprocessor
69 AC_PROG_CPP      dnl check for a c preprocessor
70 AC_PROG_AWK      dnl check for awk
71 AC_PROG_INSTALL  dnl check for an install program
72 AC_PROG_LN_S     dnl check if ln supports the -s switch
73 AC_PROG_MAKE_SET dnl check if make sets $(MAKE)
76 dnl Change ld and ar if we're using sunpro compiler
77 dnl Might as well disable static compiling on solaris
78 dnl since it doesn't work with sunpro at the moment.
79     
80 RSSH_CHECK_SUNPRO_CC
81 if test "x$rssh_cv_check_sunpro_cc" = "xyes"; then
82    AR="$CXX -xar"
83    AR_FLAGS="-o"
84    LD="$CXX -pta -G"
85         AC_DISABLE_STATIC
87 else     
88         if test "$CXX" = "c++" -o "$CXX" = "g++"
89         then
90         gcc_AC_HAVE_GCC_VERSION(3,2,0)
91         if test "x$ac_cv_gcc_version_3_2_0" = "xno"; then
92                 AC_MSG_ERROR([Not supported gcc release. Should be 3.2.0 or above. Please update !],-1)
93         fi
94         fi
96          
97 dnl if test "$CXX" = "c++" -o "$CXX" = "g++"
98 dnl then
99 dnl     gcc_AC_HAVE_GCC_VERSION(3,2,0)
100 dnl     if test "x$ac_cv_gcc_version_3_2_0" = "xno"; then
101 dnl         AC_MSG_ERROR([Not supported gcc release. Should be 3.2.0 or above. Please update !],-1)
102 dnl     fi
103 dnl fi
105 dnl Check if Java interpreter is there
107 AC_ARG_ENABLE([java],AC_HELP_STRING([--enable-java],[enable installation of Java applications]),
108 [],[enable_java=yes])
110 AC_ARG_WITH([java], 
111         AC_HELP_STRING([--with-java],[path to java interpreter]),
112         [JAVA=${with_java}], [with_java=yes])
113 if test "x$enable_java" = "xyes" ; then
114    if test "x$with_java" = "xno" -o -z "$with_java"; then
115                 with_java=
116                 enable_java=no
117    else
118                 if test "x$with_java" = "xyes"; then
119         AC_PATH_PROG(JAVA,java)
120                 fi  
121       java_AC_HAVE_JAVA_VERSION($JAVA,1,5)
122       if test "x$ac_cv_java_version_1_5" = "xno"; then
123            AC_MSG_WARN([Not supported java release. Should be 1.5.x or above. Java will be disabled for this build!])
124                   with_java=
125                           enable_java=no
126                 else
127                         with_java=$JAVA
128                 fi
129    fi
130 else
131    with_java=
134 dnl Define a conditional variable to enable or disable installation
135 dnl of java applications. The variable is used in the Makefiles.
138 AM_CONDITIONAL(TANGO_JAVA_ENABLED, test x"$enable_java" != x"no")
141 dnl Check if doxygen is there
143 AC_ARG_WITH([doxygen], 
144         AC_HELP_STRING([--with-doxygen],[path to doxygen utility]),
145         [DOXYGEN=${with_doxygen}],
146         [AC_PATH_PROG(DOXYGEN,doxygen)])
147         
148 if test -z "$DOXYGEN"; then
149         DOXYGEN=NOT_INSTALLED
151       
153 dnl Use libtool which facilitates the creation of shared libraries
154 AC_PROG_LIBTOOL
156 dnl Taurel didn't want -g nor -0, so we blank it.
157 CXXFLAGS=""
158         
159 dnl Checks for Python. Comment in if needed
160 dnl PGAC_PATH_PYTHON
162 dnl check for the presence of zlib
163 CHECK_ZLIB
165 dnl This macro checks for omniorb and sets various defines, please
166 dnl consult config/RSSH_CHECK_OMNIORB for more details        
167 RSSH_CHECK_OMNIORB
168 enable_lib=yes
170 case $build_os in
171      hpux*)
172      CXXFLAGS=$IDLCXXFLAGS
173      ;;
174 esac
176 dnl We abort the configuration if we haven't found a CORBA_H file.      
177 if test "x$CORBA_H" = "x"
178 then
179    AC_MSG_ERROR("Please install omniorb or use --with-omni to indicate its location")
182 dnl This macro checks for omninotify and sets various defines, please
183 dnl consult config/RSSH_CHECK_OMNINOTIFY for more details        
184 dnl RSSH_CHECK_OMNINOTIFY
186 dnl We abort the configuration if we haven't found a OMNINOTIFY_H file. 
187 dnl if test "x$OMNINOTIFY_H" = "x"
188 dnl then
189 dnl   AC_MSG_ERROR("Please install omniNotify or use --with-omniNotify to indicate its location")
190 dnl fi
192 dnl We need to define some stuff for threads and stubs
194 case $build_os in
195      solaris*)
196         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS,1,"Needed for threads on solaris")
197         CXXFLAGS="$CXXFLAGS -D_POSIX_PTHREAD_SEMANTICS"
198         ;;
199      linux*)
200         AC_DEFINE(_REENTRANT,1,"Needed for threads on Linux")
201         CXXFLAGS="$CXXFLAGS -D_REENTRANT"
202         ;;
203         darwin*)
204         AC_DEFINE(_REENTRANT,1,"Needed for threads on darwin")
205         CXXFLAGS="$CXXFLAGS -D_REENTRANT -D__darwin__"
206         DARWIN=yes
207 esac    
209 dnl condition used in the Makefile of the Tango library
210 AM_CONDITIONAL(DARWIN_ENABLED,test x"$DARWIN" = x"yes" )
213 dnl we want to include the omniORB stubs into the tango library
214 CXXFLAGS="$CXXFLAGS -DOMNI_UNLOADABLE_STUBS"            
217 dnl checks for libdl
218 AC_CHECK_LIB(dl, dlopen)
219 dnl checks for libnsl
220 AC_CHECK_LIB(nsl, svc_pollfd)
221 dnl checks for libposix4
222 AC_CHECK_LIB(posix4, nanosleep)
223 dnl checks for  libpthread
224 AC_CHECK_LIB(pthread, pthread_create)
225 dnl checks for libsocket
226 AC_CHECK_LIB(socket, getprotobyname)
228 dnl Checks for header files.
229 AC_HEADER_STDC
230 AC_CHECK_HEADERS(fcntl.h strings.h sys/time.h unistd.h)
232 dnl Some hack for testing if we have sstream or not.                     
233 use_sstream=yes;
234                                  
235 if test "x$GCC" = "xyes"; then
236         case `$CC --version 2>/dev/null` in
237         [[12]].*) use_sstream=no ;;
238         *)        use_sstream=yes ;;
239         esac
240 fi                       
241 if test "x$use_sstream" = "xyes"; then 
242 AC_CXX_HAVE_SSTREAM
244 dnl This needs to be worked on!!
246 if test "x$use_sstream" = "xno"; then 
247   AC_LANG_SAVE
248   AC_LANG_CPLUSPLUS
249   AC_CHECK_HEADER(strstream, AC_DEFINE(HAVE_STRSTREAM,1,""))
250   AC_LANG_RESTORE
251 fi              
252 dnl Checks for typedefs, structures, and compiler characteristics.
253 AC_C_CONST
254 AC_C_INLINE
255 AC_TYPE_PID_T
256 AC_TYPE_SIZE_T
257 AC_HEADER_TIME
258 AC_STRUCT_TM
260 dnl Checks for library functions.
261 AC_FUNC_ALLOCA
262 AC_HEADER_MAJOR
263 AC_TYPE_SIGNAL
264 AC_CHECK_FUNCS(gethostname gettimeofday exit tolower)
265 AC_CXX_HAVE_CLASS_STRSTREAM
267 dnl check for the presence of the mysql program, needed when doing the
268 dnl install of the DataBaseds server. You can tweak the connection
269 dnl with some --with variables. ./configure --help will, uhm, help you.
271 AC_ARG_ENABLE([dbserver],AC_HELP_STRING([--enable-dbserver],[enable installation of Tango database server]),
272               [],[enable_dbserver=yes])
273 enable_db_schema_create=no
275 AS_IF([test "x$enable_dbserver" = "xyes"], [ 
277         dnl We need libmysqlclient to compile
278         dnl finds it for us. Abort if no mysqlclientlibs are found
280         AM_PATH_MYSQLCLIENT
281         if test "x$MYSQLCLIENT_CFLAGS" = "x"
282                 then
283                         AC_MSG_WARN(No libmysqlclient libs found)
284                         enable_dbserver=no
285                 fi
286         
287         AC_PATH_PROG(MYSQL, mysql, nocommand)
288         MYSQL_VERSION=not_found
289         
290         if test "$MYSQL" != nocommand; then
291                 mysql_AC_HAVE_MYSQL_VERSION($MYSQL,5,0)
292                 if test "x$ac_cv_mysql_version_5_0" = "xno"; then
293                         AC_MSG_WARN([Not supported mysql release. Should be 5.0.x or above. Please update !],-1)
294                         enable_db_schema_create=no
295                 else
296                         enable_db_schema_create=yes
297                 fi
298         else
299                 enable_db_schema_create=no
300         fi
301         
303         dnl check for a database schema update
304         
305         AS_IF([test "x$enable_db_schema_create" = "xyes"], [
306         
307                 AC_ARG_ENABLE([dbcreate],AC_HELP_STRING([--enable-dbcreate],[enable an creation of the Tango database schema]),
308                                 [],[enable_dbcreate=yes])
309                 enable_db_schema_create=$enable_dbcreate
310                                           
311                 AS_IF([test "x$enable_db_schema_create" = "xyes"], [  
312         
313                         AC_PROG_MYSQL
315                         dnl Hacks to provide the name for the tango
316                         dnl database. I havent found any other way to provide these arguments.
317                         AC_ARG_WITH(tango-db-name, AC_HELP_STRING([--with-tango-db-name],[the name of the tango database (default tango)]), TANGO_DB_NAME=${with_tango_db_name}, TANGO_DB_NAME=tango)
319                         dnl Here we define these constants so that they're reachable from c programs  
320                         AC_DEFINE_UNQUOTED(TANGO_DB_NAME, "$TANGO_DB_NAME", The tango database name)
321                         
322                         dnl Here we propagate the constants into the makefiles.
323                         AC_SUBST(TANGO_DB_NAME)
324                 ])
325         ])
328 dnl Define a conditional variables to enable or disable installation
329 dnl of the database server and the database schema creation. 
330 dnl The variables are used in the Makefiles.
333 AM_CONDITIONAL(TANGO_DB_SERVER_ENABLED, test x"$enable_dbserver" = x"yes")
334 AM_CONDITIONAL(TANGO_DB_CREATE_ENABLED, test x"$enable_db_schema_create" = x"yes")
335         
336         
337                                                         
338 AC_SUBST(ac_aux_dir)    
339 AC_SUBST(VERSION_INFO)
341 DATADIR=`eval echo $datadir`
342 DATADIR=`eval echo $DATADIR`
343 AC_SUBST(DATADIR)
345 AC_SUBST(JAVA)
346 AC_SUBST(DOXYGEN)
348 dnl This is a hack to change PACKAGE_ #defines into TANGO_PACKAGE
349 AC_CONFIG_COMMANDS(ac_config.h,
350                    sed s/PACKAGE/TANGO_PACKAGE/g <ac_config.h.tmp>ac_config.h)
352 dnl configure log4tango sub-package
353 AC_CONFIG_SUBDIRS(lib/cpp/log4tango)
355 dnl All the Makefiles to be generated.
356 AC_OUTPUT(Makefile
357           lib/Makefile
358           lib/idl/Makefile
359           lib/cpp/Makefile
360           lib/cpp/server/Makefile
361           lib/cpp/server/idl/Makefile
362           lib/cpp/client/Makefile
363           lib/cpp/client/helpers/Makefile
364           cppserver/Makefile
365           cppserver/database/Makefile
366           cppserver/database/create_db.sql      
367           cppserver/database/create_db.sh
368           cppserver/database/my.cnf
369           cppserver/database/stored_proc.sql
370           cppserver/database/create_db_tables.sql
371           cppserver/database/update_db.sql
372           cppserver/starter/Makefile
373           cppserver/tangotest/Makefile
374           utils/Makefile
375           utils/notifd2db/Makefile
376           scripts/Makefile
377           scripts/jive
378           scripts/logviewer
379           scripts/TangoVers
380           scripts/astor
381           scripts/atkpanel
382           scripts/atktuning
383           scripts/pogo
384           scripts/cvstag
385           scripts/tg_devtest
386           scripts/tango
387           scripts/devicetree
388           scripts/jdraw
389           scripts/synopticappli
390           scripts/atkmoni
391           doc/Makefile
392           templates/Makefile
393           templates/pogo/cpp/Makefile)
396 AC_MSG_RESULT([
397 Configuration ($PACKAGE):
399         Source code location:   ${srcdir}
400         Version:                ${VERSION}
401         Compiler:               ${ac_ct_CC},${ac_ct_CXX}
403         OMNIORB PATH:           ${OMNI_ROOT} 
404         OMNIORB VERSION:        ${OMNI_VERSION}
405         
406         JAVA PATH:              ${with_java}
407         JAVA VERSION:           ${JAVA_VERSION}
408                 
409         MYSQL CLIENT LIB:       ${MYSQLCLIENT_LDFLAGS} ${MYSQLCLIENT_LIBS}
410         MYSQL VERSION:          ${MYSQL_VERSION}
411         MYSQL CONNECTION:       ${MYSQL_CONNECTION}
412         
413 build:
414         libraries:              ${enable_lib}
415         java application:       ${enable_java}
416         database server:        ${enable_dbserver}
417         database schema create: ${enable_db_schema_create}
418         
419 Please check whether the configuration I detected matches what you
420 would like to have.
422 ATTENTION: To run the new database server you must have MySQL 5.x installed
423            and to update your database schema with the update_db.sql script!