4 ## Provide the --enable-warnings configure argument, set to 'minimum'
7 AC_DEFUN([AC_ARG_WARNINGS],
9 AC_ARG_ENABLE([warnings],
10 [ --enable-warnings=[[none|minimum|maximum|hardcore]]
11 Control compiler pickyness. [[default=maximum]]],
12 [gtkmm_enable_warnings="$enableval"],
13 gtkmm_enable_warnings="maximum")
15 AC_MSG_CHECKING([for compiler warning flags to use])
17 gtkmm_warning_flags=''
19 case "$gtkmm_enable_warnings" in
20 none|no) gtkmm_warning_flags='';;
21 minimum|yes) gtkmm_warning_flags='-Wall -Wno-unused-parameter';;
22 maximum) gtkmm_warning_flags='-W -Wall -Wno-unused-parameter';;
23 hardcore) gtkmm_warning_flags='-W -Wall -Werror -Wno-unused-parameter';;
28 if test "x$gtkmm_warning_flags" != "x"
30 echo 'int foo() { return 0; }' > conftest.cc
32 for flag in $gtkmm_warning_flags
34 # Test whether the compiler accepts the flag. GCC doesn't bail
35 # out when given an unsupported flag but prints a warning, so
36 # check the compiler output instead.
37 gtkmm_cxx_out="`$CXX $flag -c conftest.cc 2>&1`"
38 rm -f conftest.$OBJEXT
39 test "x${gtkmm_cxx_out}" = "x" && \
40 gtkmm_use_flags="${gtkmm_use_flags:+$gtkmm_use_flags }$flag"
47 if test "x$gtkmm_use_flags" != "x"
49 for flag in $gtkmm_use_flags
52 *" $flag "*) ;; # don't add flags twice
53 *) CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }$flag";;
57 gtkmm_use_flags='none'
60 AC_MSG_RESULT([$gtkmm_use_flags])
66 AC_DEFUN([AC_ARG_DEBUG],
68 AC_MSG_CHECKING([for debug flags])
70 AC_ARG_ENABLE(debug,[ --enable-debug Build in debugging mode],[
79 debug_flags="-D_DEBUG -g"
82 debug_flags="-DNDEBUG -g"
85 debug_flags="-DNDEBUG -Wno-deprecated"
90 CXXFLAGS="`echo $CXXFLAGS | sed s:-g::` $debug_flags"
91 CFLAGS="`echo $CFLAGS | sed s:-g::` $debug_flags"
93 AC_MSG_RESULT([$debug_flags])
99 AC_DEFUN([AC_ARG_OPTIMIZATION],
101 AC_MSG_CHECKING([for optimization flags])
103 AC_ARG_ENABLE(optimization,[ --enable-optimization=[[0,1,2,3,4]] Select optimization level (default=2)],[
104 optimization=$enableval
108 optimization_flags=''
109 case "$optimization" in
110 0|no) optimization_flags="-O0";;
111 1) optimization_flags="-O1";;
112 2|yes) optimization_flags="-O2";;
113 pass1) optimization_flags="-O2 -fprofile-arcs";;
114 pass2) optimization_flags="-O2 -fbranch-probabilities";;
115 3) optimization_flags="-O3";;
116 *) optimization_flags="-O4";;
118 CXXFLAGS="`echo $CXXFLAGS | sed 's:-O.::g'` $optimization_flags"
119 CFLAGS="`echo $CFLAGS | sed 's:-O.::g'` $optimization_flags"
120 AC_MSG_RESULT([$optimization_flags])
123 AC_DEFUN([AC_ARG_PROFILE_ARCS],
125 AC_MSG_CHECKING([for arc profiling])
127 AC_ARG_ENABLE(profile-arcs,[ --enable-profile-arcs Enable arc profiling],[
128 profile_arcs=$enableval
133 if test $profile_arcs = "yes" ; then {
134 CXXFLAGS="$CXXFLAGS -fprofile-arcs";
135 CFLAGS="$CFLAGS -fprofile-arcs";
138 AC_MSG_RESULT([$profile_arcs])
141 AC_DEFUN([AC_ARG_BRANCH_PROBABILITIES],
143 AC_MSG_CHECKING([for branch-probabilities])
145 AC_ARG_ENABLE(branch-probabilities,[ --enable-branch-probabilities Enable branch-probabilities],[
146 branch_probabilities=$enableval
148 branch_probabilities=no
151 if test $branch_probabilities = "yes" ; then {
152 CXXFLAGS="$CXXFLAGS -fbranch-probabilities";
153 CFLAGS="$CFLAGS -fbranch-probabilities";
156 AC_MSG_RESULT([$branch_probabilities])
159 AC_DEFUN([AC_ARG_PROFILING],
161 AC_MSG_CHECKING([for profiling])
163 AC_ARG_ENABLE(profiling,[ --enable-profiling Enable profiling using gprof],[
169 if test $profiling = "yes" ; then {
170 CFLAGS="$CFLAGS -pg";
171 CXXFLAGS="$CXXFLAGS -pg";
172 LDFLAGS="$LDFLAGS -pg";
176 AC_MSG_RESULT([$profiling])
179 AC_DEFUN([AC_ARG_TIMELIMIT],
181 AC_ARG_ENABLE(timelimit,[ --enable-timelimit=[[days]] Set number of usable days(default=forever)],[
182 death_time=$((`date +%s`+$enableval*60*60*24))
183 AC_DEFINE_UNQUOTED(DEATH_TIME,$death_time, [ Describes the time at which the library will stop working ] )
190 AC_DEFUN([AC_ARG_LICENSE_KEY],
192 AC_ARG_ENABLE(license_key,[ --enable-license-key Turn on license key requirement],[
193 AC_DEFINE(LICENSE_KEY_REQUIRED,, [ Enables license key checks ] )
199 AC_DEFUN([AC_ARG_TIMELIMIT],
201 AC_ARG_ENABLE(timelimit,[ --enable-timelimit=[[days]] Set number of usable days(default=forever)],[
202 death_time=$((`date +%s`+$enableval*60*60*24))
203 AC_DEFINE_UNQUOTED(DEATH_TIME,$death_time, [ Describes the time at which the library will stop working ] )
210 MINGW_FLAGS="-mno-cygwin"
213 AC_DEFUN([AC_WIN32_QUIRKS],
218 AC_MSG_CHECKING([the flavor of the compiler])
219 if ( $CC --version | grep -q mingw ) ; then {
220 AC_MSG_RESULT([compiler is mingw special])
222 s/dir=\"\$absdir\"/dir=\`cygpath -d -m \"\$absdir\"\`/;
223 s/absdir=\`cd \"\$dir\" && pwd\`/absdir=\`cygpath -d -m \"\$dir\"\`/;
224 s/# We need an absolute path/dir=\`cygpath -d -m \"\$dir\"\` # We need an absolute path/;
225 s- /usr/lib- C:/mingw/lib-g;
226 s-\"/lib -\"C:/mingw/lib -g;
229 sys_lib_dlsearch_path_spec="C:/mingw/lib"
230 ac_default_prefix=`cygpath -d -m "$ac_default_prefix"`;
232 AC_MSG_RESULT([compiler is cygwin stock, adding -mno-cygwin])
233 CPP="$CPP $MINGW_FLAGS"
234 CC="$CC $MINGW_FLAGS"
235 CXX="$CXX $MINGW_FLAGS -L/usr/$host/lib -I/usr/include/c++/3.3.3/$host"
236 CXXCPP="$CXXCPP $MINGW_FLAGS"
242 CXXFLAGS="$CXXFLAGS -LC:/GTK/lib"
243 CFLAGS="$CFLAGS -LC:/GTK/lib"
244 LDFLAGS="$LDFLAGS -lole32 -no-undefined -Wl,--export-all-symbols -Wl,--subsystem=console -Wl,--enable-runtime-pseudo-reloc"
245 dnl LDFLAGS="$LDFLAGS -lole32 -no-undefined -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--subsystem=console -Wl,--enable-runtime-pseudo-reloc"
248 LDFLAGS="$LDFLAGS -lole32 -no-undefined -Wl,--export-all-symbols"
249 dnl LDFLAGS="$LDFLAGS -lole32 -no-undefined -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--subsystem=console"
250 CXXFLAGS="$CXXFLAGS -I/target/include"
251 CFLAGS="$CFLAGS -I/target/include"
254 echo Adding mac-specific optimization flags. . .
255 CXXFLAGS="$CXXFLAGS $G5OPTFLAGS"
262 AC_DEFUN([AC_LIBTOOL_PATCH],
265 if [[ "$LIBTOOL_PATCH_SED""x" != "x" ]] ; then {
266 printf "Patching libtool... "
267 cat libtool | sed "$LIBTOOL_PATCH_SED" > libtool2
271 AC_MSG_RESULT([patched])