Commit ffdd1b7543a5393b05ef947be15db0b01621fb71
1 parent
96cd5dd4
link statically for profiling
Showing
4 changed files
with
80 additions
and
22 deletions
configure.ac
| @@ -16,6 +16,13 @@ AC_PROG_CXX | @@ -16,6 +16,13 @@ AC_PROG_CXX | ||
| 16 | AC_PROG_INSTALL | 16 | AC_PROG_INSTALL |
| 17 | AC_PROG_LIBTOOL | 17 | AC_PROG_LIBTOOL |
| 18 | 18 | ||
| 19 | +# Checks for header files. | ||
| 20 | + | ||
| 21 | +# Checks for typedefs, structures, and compiler characteristics. | ||
| 22 | + | ||
| 23 | +# Checks for library functions. | ||
| 24 | + | ||
| 25 | + | ||
| 19 | dnl ================================= | 26 | dnl ================================= |
| 20 | dnl Checks for debugging or profiling | 27 | dnl Checks for debugging or profiling |
| 21 | dnl ================================= | 28 | dnl ================================= |
| @@ -50,20 +57,50 @@ else | @@ -50,20 +57,50 @@ else | ||
| 50 | AC_MSG_RESULT(no) | 57 | AC_MSG_RESULT(no) |
| 51 | fi | 58 | fi |
| 52 | 59 | ||
| 53 | -# Checks for libraries. | 60 | + |
| 61 | +dnl ==================== | ||
| 62 | +dnl Checks for libraries | ||
| 63 | +dnl ==================== | ||
| 64 | + | ||
| 65 | +# Get GammaLib configuration | ||
| 54 | if test "x$prefix" = xNONE; then | 66 | if test "x$prefix" = xNONE; then |
| 55 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/gamma/lib/pkgconfig" | 67 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/gamma/lib/pkgconfig" |
| 56 | else | 68 | else |
| 57 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$prefix/lib/pkgconfig" | 69 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$prefix/lib/pkgconfig" |
| 58 | fi | 70 | fi |
| 59 | PKG_CHECK_MODULES(GammaLib, gammalib >= 0.0,, | 71 | PKG_CHECK_MODULES(GammaLib, gammalib >= 0.0,, |
| 60 | -AC_MSG_ERROR( | ||
| 61 | -[GammaLib library not found. Consider adjusting the PKG_CONFIG_PATH | ||
| 62 | -environment variable if you installed GammaLib in a non-standard prefix.])) | 72 | + AC_MSG_ERROR([GammaLib library not found. Consider adjusting the PKG_CONFIG_PATH |
| 73 | + environment variable if you installed GammaLib in a non-standard prefix.])) | ||
| 63 | CFLAGS="$CFLAGS $GammaLib_CFLAGS" | 74 | CFLAGS="$CFLAGS $GammaLib_CFLAGS" |
| 64 | CPPFLAGS="$CPPFLAGS $GammaLib_CFLAGS" | 75 | CPPFLAGS="$CPPFLAGS $GammaLib_CFLAGS" |
| 65 | LDFLAGS="$LDFLAGS $GammaLib_LIBS" | 76 | LDFLAGS="$LDFLAGS $GammaLib_LIBS" |
| 66 | 77 | ||
| 78 | +# Check for GammaLib library and determine path to library | ||
| 79 | +AC_ARG_WITH([gammalib-lib-dir], | ||
| 80 | + AC_HELP_STRING([--with-gammalib-lib-dir], | ||
| 81 | + [GammaLib library directory [[/usr/(local/(gamma/))lib(64)]]]), | ||
| 82 | + [gammalib_lib_dir=$withval]) | ||
| 83 | +if test "x$gammalib_lib_dir" != "x"; then | ||
| 84 | + test -f $gammalib_lib_dir/libgamma.a -o -f $gammalib_lib_dir/libgamma.so -o -f $gammalib_lib_dir/libgamma.dylib && LIBDIR_GAMMALIB=$gammalib_lib_dir | ||
| 85 | +else | ||
| 86 | + for i in /usr/local/gamma/lib /usr/local/gamma/lib64 /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 ; do | ||
| 87 | + test -f $i/libgamma.a -o -f $i/libgamma.so -o -f $i/libgamma.dylib && LIBDIR_GAMMALIB=$i | ||
| 88 | + done | ||
| 89 | +fi | ||
| 90 | +if test -z "$LIBDIR_GAMMALIB"; then | ||
| 91 | + if test "x$gammalib_lib_dir" != "x"; then | ||
| 92 | + AC_MSG_ERROR(Cannot find GammaLib library under $gammalib_lib_dir) | ||
| 93 | + else | ||
| 94 | + AC_MSG_ERROR(Cannot find GammaLib library. Use --with-gammalib-lib-dir= to specify non-default path.) | ||
| 95 | + fi | ||
| 96 | +fi | ||
| 97 | +AC_SUBST(LIBDIR_GAMMALIB) | ||
| 98 | + | ||
| 99 | + | ||
| 100 | +dnl ========================= | ||
| 101 | +dnl Check for Python bindings | ||
| 102 | +dnl ========================= | ||
| 103 | + | ||
| 67 | # Checks for SWIG | 104 | # Checks for SWIG |
| 68 | AC_PATH_PROG([SWIG], [swig]) | 105 | AC_PATH_PROG([SWIG], [swig]) |
| 69 | AM_CONDITIONAL(HAVE_SWIG, test "$SWIG") | 106 | AM_CONDITIONAL(HAVE_SWIG, test "$SWIG") |
| @@ -91,12 +128,33 @@ else | @@ -91,12 +128,33 @@ else | ||
| 91 | fi | 128 | fi |
| 92 | AM_CONDITIONAL(ENABLE_PYTHON_BINDING, test "x$ac_enable_python_binding" = "xyes") | 129 | AM_CONDITIONAL(ENABLE_PYTHON_BINDING, test "x$ac_enable_python_binding" = "xyes") |
| 93 | 130 | ||
| 94 | -# Checks for header files. | ||
| 95 | 131 | ||
| 96 | -# Checks for typedefs, structures, and compiler characteristics. | 132 | +dnl ================== |
| 133 | +dnl Build static code? | ||
| 134 | +dnl ================== | ||
| 135 | +if test "x$enable_profiling" = "xyes"; then | ||
| 136 | + AC_MSG_NOTICE([Link executables statically.]) | ||
| 137 | + LIB_LINK_OPTION="-all-static" | ||
| 138 | +else | ||
| 139 | + AC_MSG_CHECKING(whether to link executables statically) | ||
| 140 | + AC_ARG_ENABLE([static_link], | ||
| 141 | + AS_HELP_STRING([--enable-static-link], | ||
| 142 | + [link executables statically (default=no)]), | ||
| 143 | + [static_link="$enableval"], | ||
| 144 | + [static_link="no"]) | ||
| 145 | + if test "x$static_link" = "xyes"; then | ||
| 146 | + AC_MSG_RESULT(yes) | ||
| 147 | + LIB_LINK_OPTION="-all-static" | ||
| 148 | + else | ||
| 149 | + AC_MSG_RESULT(no) | ||
| 150 | + fi | ||
| 151 | +fi | ||
| 152 | +AC_SUBST(LIB_LINK_OPTION) | ||
| 97 | 153 | ||
| 98 | -# Checks for library functions. | ||
| 99 | 154 | ||
| 155 | +dnl ========================== | ||
| 156 | +dnl Create configuration files | ||
| 157 | +dnl ========================== | ||
| 100 | AC_CONFIG_FILES([Makefile | 158 | AC_CONFIG_FILES([Makefile |
| 101 | src/Makefile | 159 | src/Makefile |
| 102 | src/ctselect/Makefile | 160 | src/ctselect/Makefile |
src/ctbin/Makefile.am
| @@ -15,15 +15,15 @@ bin_PROGRAMS = ctbin | @@ -15,15 +15,15 @@ bin_PROGRAMS = ctbin | ||
| 15 | # Sources | 15 | # Sources |
| 16 | sources = ctbin.cpp | 16 | sources = ctbin.cpp |
| 17 | 17 | ||
| 18 | +# Libtool library (only needed for python bindings) | ||
| 19 | +noinst_LTLIBRARIES = libctbin.la | ||
| 20 | +libctbin_la_SOURCES = $(sources) | ||
| 21 | + | ||
| 18 | # Program definition | 22 | # Program definition |
| 19 | ctbin_SOURCES = main.cpp $(sources) | 23 | ctbin_SOURCES = main.cpp $(sources) |
| 20 | -ctbin_LDFLAGS = @LDFLAGS@ | 24 | +ctbin_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ |
| 21 | ctbin_CPPFLAGS = @CPPFLAGS@ | 25 | ctbin_CPPFLAGS = @CPPFLAGS@ |
| 22 | 26 | ||
| 23 | # Parameter files | 27 | # Parameter files |
| 24 | pfilesdir = $(prefix)/syspfiles | 28 | pfilesdir = $(prefix)/syspfiles |
| 25 | pfiles_DATA = ctbin.par | 29 | pfiles_DATA = ctbin.par |
| 26 | - | ||
| 27 | -# Libtool library (only needed for python bindings) | ||
| 28 | -noinst_LTLIBRARIES = libctbin.la | ||
| 29 | -libctbin_la_SOURCES = $(sources) |
src/ctlike/Makefile.am
| @@ -15,15 +15,15 @@ bin_PROGRAMS = ctlike | @@ -15,15 +15,15 @@ bin_PROGRAMS = ctlike | ||
| 15 | # Sources | 15 | # Sources |
| 16 | sources = ctlike.cpp | 16 | sources = ctlike.cpp |
| 17 | 17 | ||
| 18 | +# Libtool library (only needed for python bindings) | ||
| 19 | +noinst_LTLIBRARIES = libctlike.la | ||
| 20 | +libctlike_la_SOURCES = $(sources) | ||
| 21 | + | ||
| 18 | # Program definition | 22 | # Program definition |
| 19 | ctlike_SOURCES = main.cpp $(sources) | 23 | ctlike_SOURCES = main.cpp $(sources) |
| 20 | -ctlike_LDFLAGS = @LDFLAGS@ | 24 | +ctlike_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ |
| 21 | ctlike_CPPFLAGS = @CPPFLAGS@ | 25 | ctlike_CPPFLAGS = @CPPFLAGS@ |
| 22 | 26 | ||
| 23 | # Parameter files | 27 | # Parameter files |
| 24 | pfilesdir = $(prefix)/syspfiles | 28 | pfilesdir = $(prefix)/syspfiles |
| 25 | pfiles_DATA = ctlike.par | 29 | pfiles_DATA = ctlike.par |
| 26 | - | ||
| 27 | -# Libtool library (only needed for python bindings) | ||
| 28 | -noinst_LTLIBRARIES = libctlike.la | ||
| 29 | -libctlike_la_SOURCES = $(sources) |
src/ctselect/Makefile.am
| @@ -15,15 +15,15 @@ bin_PROGRAMS = ctselect | @@ -15,15 +15,15 @@ bin_PROGRAMS = ctselect | ||
| 15 | # Sources | 15 | # Sources |
| 16 | sources = ctselect.cpp | 16 | sources = ctselect.cpp |
| 17 | 17 | ||
| 18 | +# Libtool library (only needed for python bindings) | ||
| 19 | +noinst_LTLIBRARIES = libctselect.la | ||
| 20 | +libctselect_la_SOURCES = $(sources) | ||
| 21 | + | ||
| 18 | # Program definition | 22 | # Program definition |
| 19 | ctselect_SOURCES = main.cpp $(sources) | 23 | ctselect_SOURCES = main.cpp $(sources) |
| 20 | -ctselect_LDFLAGS = @LDFLAGS@ | 24 | +ctselect_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ |
| 21 | ctselect_CPPFLAGS = @CPPFLAGS@ | 25 | ctselect_CPPFLAGS = @CPPFLAGS@ |
| 22 | 26 | ||
| 23 | # Parameter files | 27 | # Parameter files |
| 24 | pfilesdir = $(prefix)/syspfiles | 28 | pfilesdir = $(prefix)/syspfiles |
| 25 | pfiles_DATA = ctselect.par | 29 | pfiles_DATA = ctselect.par |
| 26 | - | ||
| 27 | -# Libtool library (only needed for python bindings) | ||
| 28 | -noinst_LTLIBRARIES = libctselect.la | ||
| 29 | -libctselect_la_SOURCES = $(sources) |