Modernize configure.ac
[lttv.git] / configure.ac
1 # This file is part of the Linux Trace Toolkit viewer
2 # Copyright (C) 2003-2004 Mathieu Desnoyers
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License Version 2 as
6 # published by the Free Software Foundation;
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 # MA 02111-1307, USA.
17
18
19
20 # -*- Autoconf -*-
21 # Process this file with autoconf to produce a configure script.
22
23 AC_PREREQ(2.57)
24 AC_INIT([lttv], [0.12.38-21032011], [yannick.brosseau@gmail.com])
25 AC_CONFIG_AUX_DIR([config])
26 AC_CONFIG_MACRO_DIR([config])
27 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
28 AM_SILENT_RULES([yes])
29 AC_CONFIG_HEADERS([config.h])
30 LT_INIT
31
32 # If requested, only build the ltt trace reading library
33 AC_ARG_WITH(lttv,
34 AS_HELP_STRING([--with-lttv],
35 [build whole LTTV system, as opposd to only the trace reading library [[default=yes]]]),
36 [with_lttv="$withval"],
37 [with_lttv="yes"])
38
39 # If we've requested the lib only, turn off the lttv-gui building as well
40 AS_IF([test "x$with_lttv" = "xno"], [with_lttv_gui="no"])
41
42 AM_CONDITIONAL([BUILD_LIB_ONLY], [ test "x$with_lttv" = "xno" ])
43
44
45 # If requested, avoid building LTTV part
46 AC_ARG_WITH(lttv-gui,
47 AS_HELP_STRING([--with-lttv-gui],
48 [build LTTV gui, as opposed to only build textmode LTTV [[default=yes]]]),
49 [with_lttv_gui="$withval"],
50 [with_lttv_gui="yes"])
51
52 AM_CONDITIONAL([BUILD_LTTV_GUI], [ test "x$with_lttv_gui" = "xyes" ])
53
54 AM_PATH_GLIB_2_0(2.4.0, , AC_MSG_ERROR([glib is required in order to compile LTTV]) , gmodule)
55
56 # GTK is only needed by the GUI
57 AS_IF([test "x$with_lttv_gui" = "xyes"],[
58 AM_PATH_GTK_2_0(2.4.0, , AC_MSG_ERROR([GTK 2 is required in order to compile the LTTV GUI]) , gmodule)
59 ])
60
61 AC_PATH_PROGS(BASH, bash)
62
63 AC_SYS_LARGEFILE
64
65 # Checks for programs.
66 AC_PROG_CC
67
68 # Checks for libraries.
69 AC_CHECK_LIB([popt], [poptGetNextOpt], [],
70 AC_MSG_ERROR([libpopt is required in order to compile LTTV])
71 )
72 AC_CHECK_LIB([m], [round], [],
73 AC_MSG_ERROR([Mathematical libraries are missing.])
74 )
75 AC_CHECK_LIB([util], [forkpty], [],
76 AC_MSG_ERROR([libutil is required in order to compile LTTV])
77 )
78
79 # Trace synchronization feature, which requires libglpk
80 AC_ARG_WITH([trace-sync],
81 AS_HELP_STRING([--with-trace-sync],
82 [support trace synchronization accuracy calculation (needs libglpk) [default=no]]),
83 [with_trace_sync="$withval"],
84 [with_trace_sync="no"])
85
86 AS_IF([test "x$with_trace_sync" = "xyes"],[
87 AC_CHECK_LIB([glpk], [glp_create_prob], [], [
88 AC_MSG_ERROR([The trace synchronization feature requires libglpk, please install it first.])
89 ])
90 AC_DEFINE([HAVE_LIBGLPK], [1], [Define if you have libglpk]),
91 ])
92
93
94 # Checks for header files.
95 AC_HEADER_STDC
96 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h pthread.h])
97
98 # Set compile flags to java include files if given
99 AC_ARG_WITH([java-jdk],
100 AS_HELP_STRING([--with-java-jdk=DIR],
101 [use java jdk from DIR. Ex : $JAVA_HOME.]),
102 [JAVA_SDK=$withval],
103 [])
104
105 AS_IF([test $JAVA_SDK],[
106 AS_IF([test -d $JAVA_SDK],[
107 AC_MSG_RESULT([using java include in $JAVA_SDK])
108 SUBDIRS=`find $JAVA_SDK/include -type d`
109 CFLAGS+=" "
110 CFLAGS+=`for x in $SUBDIRS; do echo -n "-I$x "; done`
111 CFLAGS+=" "
112 ],[
113 AC_MSG_ERROR([Unable to find Java include files in $JAVA_JDK])
114 ])
115 ])
116
117
118 # Check for JNI header files if requested
119 AC_ARG_WITH(jni-interface,
120 AS_HELP_STRING([--with-jni-interface],
121 [build JNI interface between C and Java. Needs JNI header file. [[default=no]]]),
122 [with_jni_interface="$withval"],
123 [with_jni_interface="no"])
124
125 AS_IF([test "x$with_jni_interface" = "xyes"],[
126 AC_CHECK_HEADERS([jni.h], [], AC_MSG_ERROR([missing jni.h
127 Make sure Sun Java or OpenJDK or GCJ is installed and that this header file exists in the system path.
128 Use --with-java-jdk=DIR flag to point to your java include files or deactivate the JNI interface.]))
129 ])
130 AM_CONDITIONAL([BUILD_JNI_INTERFACE], [ test "$with_jni_interface" = "yes" ] )
131
132
133 # If we want the gui, we need additionnal flags for GTK
134 AS_IF([test "x$with_lttv_gui" = "xyes"],[
135 pkg_modules="gtk+-2.0 >= 2.0.0"
136 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
137 ],[
138 # Else, we still have a dependency on gmodule
139 # We will add flags for gmodule alone
140 pkg_modules="gmodule-2.0 >= 2.0.0"
141 PKG_CHECK_MODULES(GMODULE, [$pkg_modules])
142 ])
143
144 pkg_modules="gobject-2.0 >= 2.0.0"
145 PKG_CHECK_MODULES(GOBJECT, [$pkg_modules])
146
147 LIBS="$LIBS $GTK_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
148 PACKAGE_CFLAGS="$GTK_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -Wall -Wformat-security"
149 MODULE_CFLAGS="$PACKAGE_CFLAGS -fvisibility=hidden"
150 MODULE_LDFLAGS="-module -avoid-version"
151 AC_SUBST([PACKAGE_CFLAGS])
152 AC_SUBST(PACKAGE_LIBS)
153 AC_SUBST([MODULE_CFLAGS])
154 AC_SUBST([MODULE_LDFLAGS])
155
156 # Checks for typedefs, structures, and compiler characteristics.
157 AC_HEADER_STDBOOL
158 AC_C_CONST
159 AC_C_INLINE
160 AC_TYPE_OFF_T
161 AC_TYPE_SIZE_T
162 AC_HEADER_TIME
163
164 # Checks for library functions.
165 AC_FUNC_ERROR_AT_LINE
166 AC_FUNC_SELECT_ARGTYPES
167 AC_CHECK_FUNCS([select])
168
169 AC_ARG_ENABLE(lttvstatic,
170 AS_HELP_STRING([--enable-lttvstatic],
171 [build a statically linked executable [[default=no]]]),
172 [with_lttvstatic="$withval"],
173 [with_lttvstatic="no"])
174 AM_CONDITIONAL([LTTVSTATIC], [ test "x$with_lttvstatic" = "xyes" ] )
175
176 lttvlibdir="${libdir}/lttv"
177 lttvplugindir="${lttvlibdir}/plugins"
178 #lttlibdir="${libdir}/ltt"
179 top_lttvdir="\$(top_srcdir)/lttv"
180 top_lttvwindowdir="\$(top_srcdir)/lttv/modules/gui/lttvwindow"
181
182 DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_lttvdir) -I\$(top_lttvwindowdir)"
183
184 lttincludedir="${includedir}/ltt"
185 lttvincludedir="${includedir}/lttv"
186 lttvwindowincludedir="${includedir}/lttvwindow"
187 lttctlincludedir="${includedir}/liblttctl"
188
189 AC_SUBST(lttvlibdir)
190 AC_SUBST(lttvplugindir)
191 #AC_SUBST(lttlibdir)
192 AC_SUBST(top_lttvdir)
193 AC_SUBST(top_lttvwindowdir)
194 AC_SUBST(DEFAULT_INCLUDES)
195 AC_SUBST(lttincludedir)
196 AC_SUBST(lttvincludedir)
197 AC_SUBST(lttvwindowincludedir)
198 AC_SUBST(lttctlincludedir)
199
200 AC_CONFIG_FILES([Makefile
201 lttv/Makefile
202 lttv/lttv/Makefile
203 lttv/lttv/sync/Makefile
204 lttv/modules/Makefile
205 lttv/modules/text/Makefile
206 lttv/modules/gui/Makefile
207 lttv/modules/gui/lttvwindow/Makefile
208 lttv/modules/gui/interrupts/Makefile
209 lttv/modules/gui/lttvwindow/lttvwindow/Makefile
210 lttv/modules/gui/lttvwindow/pixmaps/Makefile
211 lttv/modules/gui/controlflow/Makefile
212 lttv/modules/gui/detailedevents/Makefile
213 lttv/modules/gui/statistics/Makefile
214 lttv/modules/gui/histogram/Makefile
215 lttv/modules/gui/filter/Makefile
216 lttv/modules/gui/tracecontrol/Makefile
217 lttv/modules/gui/resourceview/Makefile
218 ltt/Makefile
219 doc/Makefile
220 doc/developer/Makefile
221 doc/developer/developer_guide/Makefile
222 doc/developer/developer_guide/docbook/Makefile
223 doc/developer/developer_guide/html/Makefile
224 doc/user/Makefile
225 doc/user/user_guide/Makefile
226 doc/user/user_guide/docbook/Makefile
227 doc/user/user_guide/html/Makefile])
228
229 AC_OUTPUT
230
This page took 0.034237 seconds and 5 git commands to generate.