@@ -82,6 +82,10 @@ AC_ARG_ENABLE([lib-only],
82
82
[ Build libnghttp3 only.] ) ] ,
83
83
[ lib_only=$enableval] , [ lib_only=no] )
84
84
85
+ AC_ARG_WITH ( [ cunit] ,
86
+ [ AS_HELP_STRING ( [ --with-cunit] ,
87
+ [ Use cunit [ default=check] ] ) ] ,
88
+ [ request_cunit=$withval] , [ request_cunit=check] )
85
89
86
90
# Checks for programs
87
91
AC_PROG_CC
@@ -99,30 +103,38 @@ AX_CXX_COMPILE_STDCXX([17], [noext], [optional])
99
103
# Checks for libraries.
100
104
101
105
# cunit
102
- PKG_CHECK_MODULES([ CUNIT] , [ cunit >= 2.1] , [ have_cunit=yes] , [ have_cunit=no] )
103
- # If pkg-config does not find cunit, check it using AC_CHECK_LIB. We
104
- # do this because Debian (Ubuntu) lacks pkg-config file for cunit.
105
- if test "x${have_cunit}" = "xno"; then
106
- AC_MSG_WARN ( [ ${CUNIT_PKG_ERRORS}] )
107
- AC_CHECK_LIB ( [ cunit] , [ CU_initialize_registry] ,
108
- [ have_cunit=yes] , [ have_cunit=no] )
106
+ have_cunit=no
107
+ if test "x${request_cunit}" != "xno"; then
108
+ PKG_CHECK_MODULES([ CUNIT] , [ cunit >= 2.1] , [ have_cunit=yes] , [ have_cunit=no] )
109
+ # If pkg-config does not find cunit, check it using AC_CHECK_LIB. We
110
+ # do this because Debian (Ubuntu) lacks pkg-config file for cunit.
111
+ if test "x${have_cunit}" = "xno"; then
112
+ AC_MSG_WARN ( [ ${CUNIT_PKG_ERRORS}] )
113
+ AC_CHECK_LIB ( [ cunit] , [ CU_initialize_registry] ,
114
+ [ have_cunit=yes] , [ have_cunit=no] )
115
+ if test "x${have_cunit}" = "xyes"; then
116
+ CUNIT_LIBS="-lcunit"
117
+ CUNIT_CFLAGS=""
118
+ AC_SUBST ( [ CUNIT_LIBS] )
119
+ AC_SUBST ( [ CUNIT_CFLAGS] )
120
+ fi
121
+ fi
109
122
if test "x${have_cunit}" = "xyes"; then
110
- CUNIT_LIBS="-lcunit"
111
- CUNIT_CFLAGS=""
112
- AC_SUBST ( [ CUNIT_LIBS] )
113
- AC_SUBST ( [ CUNIT_CFLAGS] )
123
+ # cunit in Mac OS X requires ncurses. Note that in Mac OS X, test
124
+ # program can be built without -lncurses, but it emits runtime
125
+ # error.
126
+ case "${build}" in
127
+ *-apple-darwin*)
128
+ CUNIT_LIBS="$CUNIT_LIBS -lncurses"
129
+ AC_SUBST ( [ CUNIT_LIBS] )
130
+ ;;
131
+ esac
114
132
fi
115
133
fi
116
- if test "x${have_cunit}" = "xyes"; then
117
- # cunit in Mac OS X requires ncurses. Note that in Mac OS X, test
118
- # program can be built without -lncurses, but it emits runtime
119
- # error.
120
- case "${build}" in
121
- *-apple-darwin*)
122
- CUNIT_LIBS="$CUNIT_LIBS -lncurses"
123
- AC_SUBST ( [ CUNIT_LIBS] )
124
- ;;
125
- esac
134
+
135
+ if test "x${request_cunit}" = "xyes" &&
136
+ test "x${have_cunit}" != "xyes"; then
137
+ AC_MSG_ERROR ( [ cunit was requested (--with-cunit) but not found] )
126
138
fi
127
139
128
140
AM_CONDITIONAL([ HAVE_CUNIT] , [ test "x${have_cunit}" = "xyes" ] )
0 commit comments