Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changing configure.ac to automatically detect availability of -march=…

…native.
  • Loading branch information...
commit 526bbe4d2cdd10718d735732de1fa929fbe34d8c 1 parent 96a6059
@bingmann authored
Showing with 98 additions and 59 deletions.
  1. +61 −33 configure
  2. +37 −26 configure.ac
View
94 configure
@@ -747,8 +747,8 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_maintainer_mode
-enable_optimize
enable_dependency_tracking
+enable_optimize
enable_gcov
enable_speedtest
with_wxdir
@@ -1388,11 +1388,11 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
- --enable-optimize Build with full optimization [default=no]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
+ --enable-optimize Build with full optimization [default=no]
--enable-gcov enable test coverage with gcov [default=no]
- --enable-speedtest Build the speedtest (takes lots of RAM) (default: no)
+ --enable-speedtest Build the speedtest (takes lots of RAM) (default: no)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -2690,23 +2690,6 @@ fi
-# enable full optimization by configure switch
-
-# Check whether --enable-optimize was given.
-if test "${enable_optimize+set}" = set; then :
- enableval=$enable_optimize; case "${enableval}" in
- yes)
- CFLAGS="$CFLAGS -O3 -march=native -fomit-frame-pointer";
- CXXFLAGS="$CXXFLAGS -O3 -march=native -fomit-frame-pointer";
- ;;
- no) ;;
- *) as_fn_error $? "bad value ${enableval} for --enable-optimize" "$LINENO" 5 ;;
- esac
-else
- optimize=false
-fi
-
-
# set debug info flag if no optimization flags are set.
if test "$CFLAGS" == ""; then
@@ -4090,10 +4073,55 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+# enable full optimization by configure switch
+
+
+# Check whether --enable-optimize was given.
+if test "${enable_optimize+set}" = set; then :
+ enableval=$enable_optimize; case "${enableval}" in
+ yes)
+ CFLAGS="$CFLAGS -O3 -fomit-frame-pointer";
+ CXXFLAGS="$CXXFLAGS -O3 -fomit-frame-pointer";
+
+ # test support for -march=native (older gcc's don't have it)
+ save_cflags="$CFLAGS"
+ save_cxxflags="$CXXFLAGS"
+ CFLAGS="$CFLAGS -march=native"
+ CXXFLAGS="$CXXFLAGS -march=native"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports -march=native" >&5
+$as_echo_n "checking whether $CXX supports -march=native... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; CFLAGS="$save_cflags"; CXXFLAGS="$save_cxxflags"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+ no) ;;
+ *) as_fn_error $? "bad value ${enableval} for --enable-optimize" "$LINENO" 5 ;;
+ esac
+else
+ optimize=false
+fi
+
+
# Checks for libraries.
# Checks for header files.
-
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5077,24 +5105,24 @@ fi
if test "$wxWin" != 1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
- wxWidgets does not seem to be installed on your system.
- The wxParserDemo will not be built!
+ wxWidgets does not seem to be installed on your system.
+ The wxParserDemo will not be built!
If you think wxWidgets >= 2.6.0 is installed,
- please check that wx-config is in path, the directory
- where wxWidgets libraries are installed (returned by
- 'wx-config --libs' command) is in LD_LIBRARY_PATH or
- equivalent variable.
+ please check that wx-config is in path, the directory
+ where wxWidgets libraries are installed (returned by
+ 'wx-config --libs' command) is in LD_LIBRARY_PATH or
+ equivalent variable.
" >&5
$as_echo "$as_me: WARNING:
- wxWidgets does not seem to be installed on your system.
- The wxParserDemo will not be built!
+ wxWidgets does not seem to be installed on your system.
+ The wxParserDemo will not be built!
If you think wxWidgets >= 2.6.0 is installed,
- please check that wx-config is in path, the directory
- where wxWidgets libraries are installed (returned by
- 'wx-config --libs' command) is in LD_LIBRARY_PATH or
- equivalent variable.
+ please check that wx-config is in path, the directory
+ where wxWidgets libraries are installed (returned by
+ 'wx-config --libs' command) is in LD_LIBRARY_PATH or
+ equivalent variable.
" >&2;}
fi
View
63 configure.ac
@@ -10,21 +10,6 @@ AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
-# enable full optimization by configure switch
-
-AC_ARG_ENABLE(optimize,
- AS_HELP_STRING([--enable-optimize],
- [Build with full optimization @<:@default=no@:>@]),
- [ case "${enableval}" in
- yes)
- CFLAGS="$CFLAGS -O3 -march=native -fomit-frame-pointer";
- CXXFLAGS="$CXXFLAGS -O3 -march=native -fomit-frame-pointer";
- ;;
- no) ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-optimize) ;;
- esac ],
- [ optimize=false ])
-
# set debug info flag if no optimization flags are set.
if test "$CFLAGS" == ""; then
@@ -40,6 +25,32 @@ AC_PROG_CC
AC_LANG([C++])
+# enable full optimization by configure switch
+
+AC_ARG_ENABLE(optimize,
+ AS_HELP_STRING([--enable-optimize],
+ [Build with full optimization @<:@default=no@:>@]),
+ [ case "${enableval}" in
+ yes)
+ CFLAGS="$CFLAGS -O3 -fomit-frame-pointer";
+ CXXFLAGS="$CXXFLAGS -O3 -fomit-frame-pointer";
+
+ # test support for -march=native (older gcc's don't have it)
+ save_cflags="$CFLAGS"
+ save_cxxflags="$CXXFLAGS"
+ CFLAGS="$CFLAGS -march=native"
+ CXXFLAGS="$CXXFLAGS -march=native"
+ AC_MSG_CHECKING([whether $CXX supports -march=native])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no]); CFLAGS="$save_cflags"; CXXFLAGS="$save_cxxflags"]
+ )
+ ;;
+ no) ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-optimize) ;;
+ esac ],
+ [ optimize=false ])
+
# Checks for libraries.
# Checks for header files.
@@ -56,7 +67,7 @@ AC_TYPE_SIZE_T
AC_ARG_ENABLE(gcov,
AS_HELP_STRING([--enable-gcov],
[enable test coverage with gcov @<:@default=no@:>@]),
- [case "${enableval}" in
+ [case "${enableval}" in
yes) gcov=true ;;
no) gcov=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;;
@@ -73,7 +84,7 @@ fi
# Conditional whether to compile the speedtest binary
AC_ARG_ENABLE(speedtest,
- [ --enable-speedtest Build the speedtest (takes lots of RAM) (default: no)],
+ [ --enable-speedtest Build the speedtest (takes lots of RAM) (default: no)],
[case "${enableval}" in
yes) speedtest=true ;;
no) speedtest=false ;;
@@ -90,14 +101,14 @@ AM_CONDITIONAL(HAVE_WXWIDGETS, test "$wxWin" == 1)
if test "$wxWin" != 1; then
AC_MSG_WARN([
- wxWidgets does not seem to be installed on your system.
- The wxParserDemo will not be built!
+ wxWidgets does not seem to be installed on your system.
+ The wxParserDemo will not be built!
If you think wxWidgets >= 2.6.0 is installed,
- please check that wx-config is in path, the directory
- where wxWidgets libraries are installed (returned by
- 'wx-config --libs' command) is in LD_LIBRARY_PATH or
- equivalent variable.
+ please check that wx-config is in path, the directory
+ where wxWidgets libraries are installed (returned by
+ 'wx-config --libs' command) is in LD_LIBRARY_PATH or
+ equivalent variable.
])
fi
@@ -112,8 +123,8 @@ AM_CONDITIONAL(GOT_RESCOMP, test x$RESCOMP != x)
# Checks for library functions.
AC_CONFIG_FILES([Makefile
- include/Makefile
- testsuite/Makefile
- speedtest/Makefile
+ include/Makefile
+ testsuite/Makefile
+ speedtest/Makefile
wxbtreedemo/Makefile])
AC_OUTPUT
Please sign in to comment.
Something went wrong with that request. Please try again.