修訂 | fe30e14428a6011356f79400f5c4e9ada8e8cd9a (tree) |
---|---|
時間 | 2012-06-05 18:17:46 |
作者 | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Implement enable-release option. #28588
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/automake@714 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -5,20 +5,36 @@ AC_PREREQ([2.59]) | ||
5 | 5 | AC_INIT([MolDS], [0.1], [molds-dev@lists.sourceforge.jp]) |
6 | 6 | |
7 | 7 | # Check if pwd is source directory |
8 | -[ if [ -x ./configure ]; then ] | |
9 | -AC_MSG_FAILURE([Don't execute configure script in source directory!]) | |
10 | -[ fi ] | |
8 | +AS_IF([test -x ./configure], | |
9 | + AC_MSG_FAILURE([Don't execute configure script in source directory!])) | |
11 | 10 | |
12 | 11 | AM_INIT_AUTOMAKE([MolDS], [0.1]) |
13 | 12 | AC_CONFIG_SRCDIR([Main.cpp]) |
14 | 13 | AC_CONFIG_HEADERS([config.h]) |
15 | 14 | |
16 | 15 | # Setup CXXFLAGS |
17 | -[ | |
18 | - if [ -z "$CXXFLAGS" ]; then | |
19 | - export CXXFLAGS="-g -O0" | |
20 | - fi | |
21 | - ] | |
16 | +AC_MSG_CHECKING([release mode]) | |
17 | +AC_ARG_ENABLE([release], | |
18 | + AS_HELP_STRING([--enable-release], | |
19 | + [Enable optimize option and disable debug option]) | |
20 | + ,[AS_IF([test "$enableval" = "no"], | |
21 | + [export release_enabled=no], | |
22 | + [export release_enabled=yes])] | |
23 | + ,[export release_enabled=no]) | |
24 | +AC_MSG_RESULT([$release_enabled]) | |
25 | +AS_IF([test -z "$CXXFLAGS"], | |
26 | + [AS_IF([test "$release_enabled" = "yes"], | |
27 | + [export CXXFLAGS="-O2"], | |
28 | + [export CXXFLAGS="-g -O0" | |
29 | + AS_IF([test | |
30 | + # OpenMP debug options | |
31 | + export CXXFLAGS_SAVED="$CXXFLAGS_SAVED" | |
32 | + export CXXFLAGS="$CXXFLAGS -openmp-report2" | |
33 | + AC_MSG_CHECKING([for openmp diagnosis option]) | |
34 | + AC_COMPILE_IFELSE([int main(){return 0;}], | |
35 | + [AC_MSG_RESULT([-openmp-report2])], | |
36 | + [AC_MSG_RESULT([no]) | |
37 | + export CXXFLAGS="$CXXFLAGS_SAVED"])])]) | |
22 | 38 | |
23 | 39 | # Checks for programs. |
24 | 40 | AC_PROG_CXX([icpc g++]) |
@@ -39,17 +55,7 @@ AC_CHECK_LIB([iomp5], [omp_set_num_threads],,[ | ||
39 | 55 | ]) |
40 | 56 | ]) |
41 | 57 | AC_CHECK_FUNC([omp_get_wtime],, |
42 | - [AC_MSG_FAILURE([Cannot find omp_get_wtime!]) | |
43 | - ]) | |
44 | -# OpenMP debug options | |
45 | -export CXXFLAGS_SAVED="$CXXFLAGS_SAVED" | |
46 | -export CXXFLAGS="$CXXFLAGS -openmp-report2" | |
47 | -AC_MSG_CHECKING([for openmp diagnosis option]) | |
48 | -AC_COMPILE_IFELSE( | |
49 | - [int main(){return 0;}], | |
50 | - [AC_MSG_RESULT([-openmp-report2])], | |
51 | - [AC_MSG_RESULT([no]) | |
52 | - export CXXFLAGS="$CXXFLAGS_SAVED"]) | |
58 | + [AC_MSG_FAILURE([Cannot find omp_get_wtime!])]) | |
53 | 59 | |
54 | 60 | # Check for mkl |
55 | 61 | export LIBS="-lmkl_intel_thread -lmkl_core $LIBS" |