release
[tango-nonfree.git] / configure.ac
blob216d69598c66d4dfb96576215f8fc89a82c56d6f
1 # Process this file with autoconf to produce a configure script.
2 # This is the configuration file for the tango system.
3 # To process this file into a runnable shell-script, please run
4 # the script `bootstrap' which is found in the same directory as
5 # this file.
7 # For extensive help on autoconf, automake, and libtool, please
8 # consult the infofiles by running the `info' program, or by typing
9 # M-x info in your favourite editor (emacs)   
11 # For information on how to build and use an autoconfiscated
12 # project, please consult
13 # http://sources.redhat.com/autobook/autobook/autobook.html
14 # which is an online version of the Gnu Autoconf, Automake, and Libtool
15 # book by Vaughan, Elliston, Tromey, and Taylor
17 # What follows is the configuration, and comments to the macros used
19 # AC_INIT initializes autoconf, The first argument is the
20 # packagename, the second is the version used for the tar file,
21 # the third is an email address for bug reports (shouldn't be necessary),
22 # and the fourth argument is                
23 AC_INIT(Tango,9.2.5a,info@tango-controls.org,tango)
24 AC_CONFIG_AUX_DIR(config)
25 AC_CONFIG_MACRO_DIR([m4])
27 # Tells autoconf that we want at least version 2.53 of autoconf to
28 # create configure from configure.ac
29 AC_PREREQ(2.53)
31 AM_MAINTAINER_MODE()
32 AC_CANONICAL_HOST()
34 # Lets the revision tag from cvs or rcs propagate into the
35 # configure script, handy for debugging.
36 AC_REVISION($Revision$) 
38 # AM_INIT_AUTOMAKE sets up automake which is used to generate
39 # Makefile.in from Makefile.am
40 AM_INIT_AUTOMAKE
41 AM_SILENT_RULES([yes])
43 # Tells automake to use `ac_config.h.tmp' to stash all the #defines
44 # that result from a run of configure.
45 # The name is .tmp since I must change the PACKAGE_ definitions because    
46 # of omniORBS installation of their version of this file.
47 AC_CONFIG_HEADERS(ac_config.h.tmp)
50 # -version-info CURRENT[:REVISION[:AGE]]
51 # From the libtool documentation (info libtool)
52 # So, libtool library versions are described by three integers:
54 # CURRENT
55 #      The most recent interface number that this library implements.
57 # REVISION
58 #      The implementation number of the CURRENT interface.
60 # AGE
61 #      The difference between the newest and oldest interfaces that this
62 #      library implements.  In other words, the library implements all the
63 #      interface numbers in the range from number `CURRENT - AGE' to
64 #      `CURRENT'.
66 VERSION_INFO=11:5:2
67         
68 # Checks for programs.
70 AC_PROG_CXX
71 AC_PROG_CXXCPP
72 AC_PROG_CPP
73 AC_PROG_AWK 
74 AC_PROG_INSTALL
75 AC_PROG_LN_S
76 AC_PROG_MAKE_SET
78 # Check gcc release
79          
80  if test "$CXX" = "c++" -o "$CXX" = "g++"
81  then
82      gcc_AC_HAVE_GCC_VERSION(3,2,0)
83      if test "x$ac_cv_gcc_version_3_2_0" = "xno"; then
84          AC_MSG_ERROR([Not supported gcc release. Should be 3.2.0 or above. Please update !],-1)
85      fi
86  fi
88 # Check if compiler support C++11
90 AX_CXX_COMPILE_STDCXX_11([noext],[optional])
92 # Check if Java interpreter is there
94 AC_ARG_ENABLE([java],AC_HELP_STRING([--enable-java],[enable installation of Java applications]),
95 [],[enable_java=yes])
97 AC_ARG_ENABLE([mariadb],AC_HELP_STRING([--enable-mariadb],[enable mariadb instead of mysql]),
98 [enable_mariadb=yes],[enable_mariadb=no])
100 AC_ARG_WITH([java], 
101         AC_HELP_STRING([--with-java],[path to java interpreter]),
102         [JAVA=${with_java}], [with_java=yes])
103         
104 if test "x$enable_java" = "xyes" ; then
105    if test "x$with_java" = "xno" -o -z "$with_java"; then
106                 with_java=
107                 enable_java=no
108    else
109                 if test "x$with_java" = "xyes"; then
110                 AC_PATH_PROG(JAVA,java,"notfound")
111                 fi
112                 if test "x$JAVA" != "xnotfound"; then 
113                 java_AC_HAVE_JAVA_VERSION($JAVA,1,7)
114                         if test "x$ac_cv_java_version_1_7" = "xno"; then
115                         AC_MSG_WARN([Not supported java release. Should be 1.7.x or above. Java will be disabled for this build!])
116                                 with_java=
117                                 enable_java=no
118                         else
119                                 with_java=$JAVA
120                         fi
121                 else
122                         with_java=
123                         enable_java=no
124                 fi
125    fi
126 else
127    with_java=
130 # Define a conditional variable to enable or disable installation
131 # of java applications. The variable is used in the Makefiles.
134 AM_CONDITIONAL(TANGO_JAVA_ENABLED, test x"$enable_java" != x"no")
136 # Check if doxygen is there
138 AC_ARG_WITH([doxygen], 
139         AC_HELP_STRING([--with-doxygen],[path to doxygen utility]),
140         [DOXYGEN=${with_doxygen}],
141         [AC_PATH_PROG(DOXYGEN,doxygen)])
142         
143 if test -z "$DOXYGEN"; then
144         DOXYGEN=NOT_INSTALLED
146       
147 # Check if lyx is there
148         
149 AC_ARG_WITH([lyx], 
150         AC_HELP_STRING([--with-lyx],[path to LyX utility]),
151         [LYX=${with_lyx}],
152         [AC_PATH_PROG(LYX,lyx)])
154 if test -z "$LYX"; then
155         LYX="false"
158 AM_CONDITIONAL(TANGO_LYX_ENABLED, test x"$LYX" != x"false")
160 # Check if fig2dev is there
161         
162 AC_ARG_WITH([fig2dev], 
163         AC_HELP_STRING([--with-fig2dev],[path to fig2dev utility]),
164         [FIG2DEV=${with_fig2dev}],
165         [AC_PATH_PROG(FIG2DEV,fig2dev)])
167 if test -z "$FIG2DEV"; then
168         FIG2DEV="false"
171 AM_CONDITIONAL(TANGO_FIG2DEV_ENABLED, test x"$FIG2DEV" != x"false")
172 AM_CONDITIONAL(TANGO_DOC_ENABLED, test x"$LYX" != x"false" && test x"$FIG2DEV" != x"false")
175 # Use libtool which facilitates the creation of shared libraries
176 LT_INIT()
177         
178 # check for the presence of zlib
179 CHECK_ZLIB
181 # This macro checks for omniorb and sets various defines, please
182 # consult config/RSSH_CHECK_OMNIORB for more details
183         
184 RSSH_CHECK_OMNIORB  
185 enable_lib=yes
187 # ZMQ dependency
189 AC_ARG_WITH(zmq, AC_HELP_STRING([--with-zmq],[prefix to ZMQ installation]) ,\
190             ZMQ_PREFIX=${with_zmq} , ZMQ_PREFIX=/usr/local )
192 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${ZMQ_PREFIX}/lib/pkgconfig
194 PKG_CHECK_MODULES([LIBZMQ], [libzmq >= 4.0.5],[],AC_MSG_ERROR(Missing ZMQ library - Use --with-zmq configure option or add directory containing libzmq.pc to PKG_CONFIG_PATH environment variable))
195 ZMQ_VERSION=`eval pkg-config --modversion libzmq`
196 ZMQ_ROOT=`eval pkg-config --variable=prefix libzmq`
197 AC_SUBST(ZMQ_PREFIX)
199 # We need to define some stuff for threads and stubs
201 case $build_os in
202     linux*)
203         AC_DEFINE(_REENTRANT,1,"Needed for threads on Linux")
204         CXXFLAGS="$CXXFLAGS -D_REENTRANT"
205         ;;
206         darwin*)
207         AC_DEFINE(_REENTRANT,1,"Needed for threads on darwin")
208         CXXFLAGS="$CXXFLAGS -D_REENTRANT -D__darwin__"
209         DARWIN=yes
210 esac    
212 # condition used in the Makefile of the Tango library
213 AM_CONDITIONAL(DARWIN_ENABLED,test x"$DARWIN" = x"yes" )
216 # we want to include the omniORB stubs into the tango library
217 CXXFLAGS="$CXXFLAGS -DOMNI_UNLOADABLE_STUBS"            
220 # checks for libdl
221 AC_CHECK_LIB(dl, dlopen)
222 # checks for libnsl
223 AC_CHECK_LIB(nsl, svc_pollfd)
224 # checks for libposix4
225 AC_CHECK_LIB(posix4, nanosleep)
226 # checks for  libpthread
227 AC_CHECK_LIB(pthread, pthread_create)
228 # checks for libsocket
229 AC_CHECK_LIB(socket, getprotobyname)
231 # Checks for header files.
232 AC_HEADER_STDC
233 AC_CHECK_HEADERS(fcntl.h strings.h sys/time.h unistd.h)
235 # Some hack for testing if we have sstream or not.                       
236 use_sstream=yes;
237                                  
238 if test "x$GCC" = "xyes"; then
239         case `$CC --version 2>/dev/null` in
240         [[12]].*) use_sstream=no ;;
241         *)        use_sstream=yes ;;
242         esac
243 fi                       
244 if test "x$use_sstream" = "xyes"; then 
245 AC_CXX_HAVE_SSTREAM
247 # This needs to be worked on!!
249 if test "x$use_sstream" = "xno"; then 
250   AC_LANG_SAVE
251   AC_LANG_CPLUSPLUS
252   AC_CHECK_HEADER(strstream, AC_DEFINE(HAVE_STRSTREAM,1,""))
253   AC_LANG_RESTORE
254 fi              
255 # Checks for typedefs, structures, and compiler characteristics.
256 AC_C_CONST
257 AC_C_INLINE
258 AC_TYPE_PID_T
259 AC_TYPE_SIZE_T
260 AC_HEADER_TIME
261 AC_STRUCT_TM
263 # Checks for library functions.
264 AC_FUNC_ALLOCA
265 AC_HEADER_MAJOR
266 AC_TYPE_SIGNAL
267 AC_CHECK_FUNCS(gethostname gettimeofday exit tolower)
268 AC_CXX_HAVE_CLASS_STRSTREAM
270 # check for the presence of the mysql program, needed when doing the
271 # install of the DataBaseds server. You can tweak the connection
272 # with some --with variables. ./configure --help will, uhm, help you.
274 AC_ARG_ENABLE([dbserver],AC_HELP_STRING([--enable-dbserver],[enable installation of Tango database server]),
275               [],[enable_dbserver=yes])
276 enable_db_schema_create=no
278 AC_ARG_WITH(tango-rc-file, AC_HELP_STRING([--with-tango-rc-file],[location of the tango rc file (default /etc/tangorc)]), TANGO_RC_FILE=${with_tango_rc_file}, TANGO_RC_FILE=/etc/tangorc)
279 AC_DEFINE_UNQUOTED(TANGO_RC_FILE, "$TANGO_RC_FILE", The tango rc file name and location)
280 AC_SUBST(TANGO_RC_FILE)
282 # Hacks to provide the name for the tango
283 # database. I havent found any other way to provide these arguments.
284 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)
286 # Here we define these constants so that they're reachable from c programs  
287 AC_DEFINE_UNQUOTED(TANGO_DB_NAME, "$TANGO_DB_NAME", The tango database name)
288                         
289 # Here we propagate the constants into the makefiles.
290 AC_SUBST(TANGO_DB_NAME)                 
292 if test "x$enable_mariadb" != "xyes" ; then
293         DB_NAME=MYSQL
294         AS_IF([test "x$enable_dbserver" = "xyes"], [ 
296         # We need libmysqlclient to compile
297         # finds it for us. Abort if no mysqlclientlibs are found
299                 AM_PATH_MYSQLCLIENT
300                 if test "x$MYSQLCLIENT_CFLAGS" = "x"
301                         then
302                                 AC_MSG_WARN(No libmysqlclient libs found)
303                                 enable_dbserver=no
304                         fi
306                 DB_LDFLAGS=${MYSQLCLIENT_LDFLAGS}
307                 DB_LDLIBS=${MYSQLCLIENT_LIBS}
308                 DB_CFLAGS=${MYSQLCLIENT_CFLAGS}
309         
310                 AC_PATH_PROG(MYSQL, mysql, nocommand)
311                 MYSQL_VERSION=not_found
312         
313                 if test "x$MYSQL" != "xnocommand"; then
314                         mysql_AC_HAVE_MYSQL_VERSION($MYSQL,5,5)
315                         if test "x$ac_cv_mysql_version_5_5" = "xno"; then
316                                 AC_MSG_WARN([Not supported mysql release. Should be 5.5.x or above. Please update !],-1)
317                                 enable_db_schema_create=no
318                                 enable_dbserver=no
319                         else
320                                 enable_db_schema_create=yes
321                         fi
322                 else
323                         enable_db_schema_create=no
324                 fi
325         
327                 # check for a database schema update
328         
329                 AS_IF([test "x$enable_db_schema_create" = "xyes"], [
330         
331                         AC_ARG_ENABLE([dbcreate],AC_HELP_STRING([--enable-dbcreate],[enable an creation of the Tango database schema]),
332                                         [],[enable_dbcreate=yes])
333                         enable_db_schema_create=$enable_dbcreate
334                                                   
335                         AS_IF([test "x$enable_db_schema_create" = "xyes"], [  
336         
337                                 AC_PROG_MYSQL
339                         ])
340                 ])
341         ])
342         if test "x$MYSQL_VERSION" != "xnot_found"; then
343                 DB_VERSION=${MYSQL_VERSION}
344         fi
345 else
346         DB_NAME=MARIADB
347         AS_IF([test "x$enable_dbserver" = "xyes"], [ 
349                 # We need libmysqlclient to compile
350                 # finds it for us. Abort if no mysqlclientlibs are found
352                 AM_PATH_MARIADBCLIENT
353                 if test "x$MARIADBCLIENT_CFLAGS" = "x"
354                         then
355                                 AC_MSG_WARN(No libmariadbclient libs found)
356                                 enable_dbserver=no
357                         fi
359                 DB_LDFLAGS=${MARIADBCLIENT_LDFLAGS}
360                 DB_LDLIBS=${MARIADBCLIENT_LIBS}
361                 DB_CFLAGS=${MARIADBCLIENT_CFLAGS}
362         
363                 AC_PATH_PROG(MYSQL, mysql, nocommand)
364                 MARIADB_VERSION=not_found
365         
366                 if test "x$MYSQL" != "xnocommand"; then
367                         mariadb_AC_HAVE_MARIADB_VERSION($MYSQL,10,0)
368                         if test "x$ac_cv_mariadb_version_10_0" = "xno"; then
369                                 AC_MSG_WARN([Not supported mariadb release. Should be 10.0.x or above. Please update !],-1)
370                                 enable_db_schema_create=no
371                                 enable_dbserver=no
372                         else
373                                 enable_db_schema_create=yes
374                         fi
375                 else
376                         enable_db_schema_create=no
377                 fi
378                 
380                 # check for a database schema update
382                 AS_IF([test "x$enable_db_schema_create" = "xyes"], [
383         
384                         AC_ARG_ENABLE([dbcreate],AC_HELP_STRING([--enable-dbcreate],[enable an creation of the Tango database schema]),
385                                         [],[enable_dbcreate=yes])
386                         enable_db_schema_create=$enable_dbcreate
387                                                   
388                         AS_IF([test "x$enable_db_schema_create" = "xyes"], [  
389         
390                                 AC_PROG_MYSQL
392                         ])
393                 ])
394         ])
395         if test "x$MARIADB_VERSION" != "xnot_found"; then
396                 DB_VERSION=${MARIADB_VERSION}
397         fi
401 AC_SUBST(DB_LDFLAGS)
402 AC_SUBST(DB_CFLAGS)
403 AC_SUBST(DB_LDLIBS)
406 # Build the jpeg library compilation option
409 AC_ARG_ENABLE([jpegmmx],
410         [AS_HELP_STRING([--disable-jpegmmx],[disable jpeg mmx optimization])],
411         [],[enable_jpegmmx=yes])
413 JPEG_LIB_CXXFLAGS="-D_TANGO_LIB"
414 JPEG_MMX_LIB_CXXFLAGS="-D_TANGO_LIB"
416 if test "x$enable_jpegmmx" != xno; then
417 case $host_cpu in
418         i*86 )
419                 JPEG_LIB_CXXFLAGS="-D_TANGO_LIB -DJPG_USE_ASM"
420                 JPEG_MMX_LIB_CXXFLAGS="-D_TANGO_LIB -mmmx -DJPG_USE_ASM"
421         ;;
422 esac
425 AC_SUBST(JPEG_LIB_CXXFLAGS)
426 AC_SUBST(JPEG_MMX_LIB_CXXFLAGS)
428 # Define a conditional variables to enable or disable installation
429 # of the database server and the database schema creation. 
430 # The variables are used in the Makefiles.
433 AM_CONDITIONAL(TANGO_DB_SERVER_ENABLED, test x"$enable_dbserver" = x"yes")
434 AM_CONDITIONAL(TANGO_DB_CREATE_ENABLED, test x"$enable_db_schema_create" = x"yes")
435         
436         
437                                                         
438 AC_SUBST(ac_aux_dir)    
439 AC_SUBST(VERSION_INFO)
441 DATADIR=`eval echo $datadir`
442 DATADIR=`eval echo $DATADIR`
443 AC_SUBST(DATADIR)
445 AC_SUBST(JAVA)
446 AC_SUBST(DOXYGEN)
447 AC_SUBST(LYX)
448 AC_SUBST(FIG2DEV)
449 AC_SUBST(JNI_INCL_DIRS)
451 # This is a hack to change PACKAGE_ #defines into TANGO_PACKAGE
452 AC_CONFIG_COMMANDS(ac_config.h,
453                    sed s/PACKAGE/TANGO_PACKAGE/g <ac_config.h.tmp>ac_config.h)
455 # configure log4tango sub-package
456 AC_CONFIG_SUBDIRS(lib/cpp/log4tango)
458 # All the Makefiles to be generated.
459 AC_OUTPUT(Makefile
460           lib/Makefile
461           lib/idl/Makefile
462           lib/cpp/tango.pc
463           lib/cpp/Makefile
464           lib/cpp/server/Makefile
465           lib/cpp/server/idl/Makefile
466           lib/cpp/server/jpeg/Makefile
467           lib/cpp/server/jpeg_mmx/Makefile
468           lib/cpp/client/Makefile
469           lib/cpp/client/helpers/Makefile
470           lib/java/Makefile
471           cppserver/Makefile
472           cppserver/database/Makefile
473           cppserver/database/create_db.sql      
474           cppserver/database/create_db.sh
475           cppserver/database/my.cnf
476           cppserver/database/stored_proc.sql
477           cppserver/database/create_db_tables.sql
478           cppserver/database/update_db.sh
479           cppserver/database/update_db.sql
480           cppserver/database/update_db8.sql
481           cppserver/database/update_db7.sql
482       cppserver/database/rem_history.sql
483           cppserver/starter/Makefile
484           cppserver/tangotest/Makefile
485           cppserver/AbstractClass/Makefile
486           cppserver/AbstractClass/AccessControl/Makefile
487           cppserver/tangoaccesscontrol/Makefile
488           utils/Makefile
489           utils/tango_admin/Makefile
490           scripts/Makefile
491           scripts/tango
492           scripts/tango_wca
493           doc/Makefile
494           doc/man/Makefile
495           doc/src/Makefile
496           doc/src/ds_writing/Makefile
497           doc/src/ds_model/Makefile
498           doc/src/dance/Makefile
499           doc/src/java_api/Makefile
500           doc/src/java_api/picture/Makefile
501           doc/src/gen_api/Makefile
502           doc/src/advanced/Makefile
503           pogo/Makefile
504           pogo/templates/Makefile
505           pogo/preferences/Makefile
506           pogo/templates/cpp/Makefile)
509 AC_MSG_RESULT([
510 Configuration ($PACKAGE):
512         Source code location:   ${srcdir}
513         Version:                ${VERSION}
514         Compiler:               ${ac_ct_CC},${ac_ct_CXX}
516         OMNIORB PATH:           ${OMNI_ROOT} 
517         OMNIORB VERSION:        ${OMNI_VERSION}
519         ZMQ PATH:               ${ZMQ_ROOT}
520         ZMQ VERSION:            ${ZMQ_VERSION}
521         
522         JAVA PATH:              ${with_java}
523         JAVA VERSION:           ${JAVA_VERSION}
524                 
525         ${DB_NAME} CLIENT LIB:  ${DB_LDFLAGS} ${DB_LDLIBS}
526         ${DB_NAME} VERSION:     ${DB_VERSION}
527         ${DB_NAME} CONNECTION:  ${MYSQL_CONNECTION}
528                 
529 build:
530         libraries:              ${enable_lib}
531         java application:       ${enable_java}
532         access control server:  ${enable_dbserver}
533         database server:        ${enable_dbserver}
534         database schema create: ${enable_db_schema_create}
535         
536 Please check whether the configuration I detected matches what you
537 would like to have.