Skip to content

Commit 2d62b99

Browse files
committed
Added commentaries in configure.ac
- Added commentaries by @asalnikov request in comment for Issue #14 - Added aclocal in .gitignore
1 parent 3173e70 commit 2d62b99

File tree

3 files changed

+45
-12
lines changed

3 files changed

+45
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ config.status
3838
config.log
3939
config
4040
/Makefile
41+
aclocal.m4

ac-macros/ax-macros.m4

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
# File with user-defined macros
2+
13
# Wrapper for AC_ARG_ENABLE for basic rules
4+
# Arguments:
5+
# $1 - name of the configure option
6+
# $2 - name of corresponding GOAL to be built
7+
# $3 - default value (empty string if GOAL not to be nuilt by default or $2)
8+
# $4 - help string for configure option
29
AC_DEFUN([AX_ARG_ENABLE], [
310
AC_ARG_ENABLE([$1], [AS_HELP_STRING([--enable-$1], [$4])], [
411
AS_CASE(["${enableval}"],
@@ -11,23 +18,34 @@ AC_DEFUN([AX_ARG_ENABLE], [
1118
])
1219
])
1320

14-
# Wrapper for AC_CHECK_PROG with gentle error
21+
# Wrapper for AC_CHECK_PROG with configure variable and gentle error
22+
# Arguments:
23+
# $1 - configure variable for corresponding tool
24+
# $2 - error string to be shown if tool doesn't exist
1525
AC_DEFUN([AX_CHECK_PROG], [
1626
AC_CHECK_PROG([HAVE_$1], $$1, [true], [false])
1727
AS_IF([test "x$HAVE_$1" == "xfalse"], [AC_MSG_ERROR([$2])])
1828
])
1929

20-
# Wrapper for AC_CHECK_PROG with gentle error
30+
# Wrapper for AC_CHECK_PROG with tool name and gentle error
31+
# Arguments:
32+
# $1 - tool name
33+
# $2 - errorstring to be shown if tool doesn't exist
2134
AC_DEFUN([AX_RAW_CHECK_PROG], [
2235
AC_CHECK_PROG([HAVE_$1], $1, [true], [false])
2336
AS_IF([test "x$HAVE_$1" == "xfalse"], [AC_MSG_ERROR([$2])])
2437
])
2538

26-
# Wrapper for AC_CHECK_LIB for list of functions
39+
# Wrapper for AC_CHECK_LIB for list of required functions
40+
# Argumenst:
41+
# $1 - library name (without 'lib' prefix and extension suffix)
42+
# $2 - list of required functions
2743
AC_DEFUN([AX_CHECK_LIB], [
2844
for sub in $2
2945
do
3046
AC_CHECK_LIB([$1], [$sub], [
47+
# The check below is necessary for deduplication of $1 library
48+
# within LIBS variable
3149
AS_IF([echo $LIBS | grep -q "$1"], [], [
3250
AS_VAR_APPEND([LIBS], [-l$1])
3351
])
@@ -36,4 +54,3 @@ AC_DEFUN([AX_CHECK_LIB], [
3654
])
3755
done
3856
])
39-

configure.ac

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.69])
5+
# Do not forget to update version.
56
AC_INIT([network-tests2], [2.0.1], [Alexey Salnikov <[email protected]>])
67
AC_PREFIX_DEFAULT([$HOME/network_tests-$PACKAGE_VERSION])
78

9+
# Directory with user-defined macros (macros with 'AX_' prefix).
810
AC_CONFIG_MACRO_DIR([ac-macros])
11+
12+
# Configure variables declaration.
913
# TODO: Change the value for qmake for QT5 later
1014
AC_ARG_VAR([QMAKE], [Place where qmake-qt4 is installed])
1115
AC_ARG_VAR([MPICC], [Path to MPI2 compatible C-compiler])
@@ -16,24 +20,31 @@ AC_ARG_VAR([MPI_LIBS], [Additional libs for parallel program])
1620
AC_ARG_VAR([MPI_LDFLAGS], [Path to additional libs for parallel program])
1721
AC_ARG_VAR([GOALS], [List of goals to be built])
1822

23+
# Explicitly enables build for network_viewer_qt_v2 component.
1924
AX_ARG_ENABLE([qt-gui], [" network_viewer_qt_v2 "], [""], [
2025
Enable Qt version of network-viewer program (disabled by default)
21-
]) # network_viewer_qt_v2
26+
])
27+
28+
# Explicitly enables build for network_test component.
2229
AX_ARG_ENABLE([network-test], [" network_test "], [" network_test "], [
2330
Enable testing (enabled by default)
24-
]) # network-test
31+
])
32+
33+
# Explicitly enables build for clustering component.
2534
AX_ARG_ENABLE([clustering], [" clustering "], [""], [
2635
Enable clustering (disabled by default)
27-
]) # clustering
36+
])
2837

38+
# Enables build for all components of the project.
2939
AC_ARG_ENABLE([all], [AS_HELP_STRING([--enable-all], [Enable all modules])], [
3040
AS_CASE(["${enableval}"],
3141
[yes], [AC_SUBST([GOALS], ["network_test network_viewer_qt_v2 clustering"])],
3242
[no], [],
3343
[AC_MSG_ERROR([Bad value ${enableval} for --enable-all])]
3444
)
35-
]) # all
45+
])
3646

47+
# Checks for non-default specific tools.
3748
AS_IF([test "x$MPICC" = "x"], [AC_SUBST([MPICC], [mpicc])])
3849
AS_IF([test "x$MPICXX" = "x"], [AC_SUBST([MPICXX], [mpicxx])])
3950
# TODO: Change the value for qmake for QT5 later
@@ -61,37 +72,41 @@ AC_FUNC_REALLOC
6172
AC_FUNC_STRTOD
6273
AC_CHECK_FUNCS([clock_gettime floor gethostname gettimeofday localeconv memset sqrt strchr strstr])
6374

64-
# Checks for -lnetcdf
75+
# Checks for required function of netcdf library.
6576
AX_CHECK_LIB([netcdf], [nc_create nc_sync nc_close nc_enddef nc_def_dim \
6677
nc_def_var nc_put_var_int nc_put_vara_double
6778
])
6879

69-
# Checks for chosen targets
80+
# Checks for chosen components
7081
for target in $GOALS
7182
do
7283
AS_CASE(["$target"],
7384
[*"network_viewer_qt"*], [
85+
# Checks for tools and libraries required by network_viewer_qt_v2
7486
AX_CHECK_PROG([QMAKE], [qmake-qt4 is required but has not been found])
7587
AX_RAW_CHECK_PROG([lrelease], [lrelease is required but has not been found])
76-
# Checks for libraries.
77-
# -lqwt-qt4 -lGLU -lQtOpenGL -lQtGui -lQtCore -lGL -lpthread
7888
AX_CHECK_LIB([netcdf], [nc_open nc_inq_varid nc_get_var1 \
7989
nc_inq_nvars nc_inq_varids nc_inq_varndims nc_inq_dimlen \
8090
nc_inq_vardimid nc_get_vara_double nc_get_var1_int
8191
])
92+
# TODO: Add checks for libraries.
93+
# -lqwt-qt4 -lGLU -lQtOpenGL -lQtGui -lQtCore -lGL -lpthread
8294
],
8395
[*"network_test"*], [
96+
# Checks for tools and libraries required by network_test
8497
AX_CHECK_LIB([netcdf], [nc_open nc_get_var_int nc_get_vara_double \
8598
nc_inq_dimid nc_inq_dimlen nc_inq_varid
8699
])
87100
]
88101
)
89102
done
90103

104+
# Use flags of non-MPI compilers for MPI ones
91105
AS_IF([test "x$MPI_CFLAGS" = "x"], [AC_SUBST([MPI_CFLAGS], $CFLAGS)])
92106
AS_IF([test "x$MPI_CXXFLAGS" = "x"], [AC_SUBST([MPI_CXXFLAGS], $CXXFLAGS)])
93107
AS_IF([test "x$MPI_LDFLAGS" = "x"], [AC_SUBST([MPI_LDFLAGS], $LDFLAGS)])
94108
AS_IF([test "x$MPI_LIBS" = "x"], [AC_SUBST([MPI_LIBS], $LIBS)])
95109

110+
# Define output files to be built from templates
96111
AC_CONFIG_FILES([config Makefile parus_config.h])
97112
AC_OUTPUT

0 commit comments

Comments
 (0)