4444 ] )
4545 rm -f nc_test.out
4646AC_MSG_RESULT ( $nc_cv_sizeof_bool )
47- test $nc_cv_sizeof_bool != unknown && AC_DEFINE_UNQUOTED ( CXX_TYPEOF_BOOL ,$nc_cv_sizeof_bool )
47+ test $nc_cv_sizeof_bool != unknown && AC_DEFINE_UNQUOTED ( CXX_TYPE_OF_BOOL ,$nc_cv_sizeof_bool )
4848] )
4949dnl ---------------------------------------------------------------------------
5050dnl
@@ -62,6 +62,71 @@ AC_MSG_RESULT($nc_cv_extern_errno)
6262test $nc_cv_extern_errno = yes && AC_DEFINE ( HAVE_EXTERN_ERRNO )
6363] )
6464dnl ---------------------------------------------------------------------------
65+ dnl Construct the list of include-options according to whether we're building
66+ dnl in the source directory or using '--srcdir=DIR' option. The applications
67+ dnl (in 'test' and 'c++') have a different include-path from the library units
68+ dnl because the latter are compiled within subdirectories of 'src'.
69+ define ( [ NC_INCLUDE_DIRS] ,
70+ [
71+ APP_INCLUDES="-I. -I../src -I../include"
72+ LIB_INCLUDES="-I.. -I../../include"
73+ if test "$srcdir" != "."; then
74+ APP_INCLUDES="$APP_INCLUDES -I\$(srcdir)/../src -I\$(srcdir)/../include"
75+ LIB_INCLUDES="$LIB_INCLUDES -I\$(srcdir) -I\$(srcdir)/../include"
76+ fi
77+ APP_INCLUDES="$APP_INCLUDES -I\$(includedir)"
78+ AC_SUBST ( APP_INCLUDES )
79+ AC_SUBST ( LIB_INCLUDES )
80+ ] ) dnl
81+ dnl ---------------------------------------------------------------------------
82+ dnl Append definitions and rules for the given models to the src/Makefile
83+ define ( [ NC_LIB_RULES] ,
84+ [
85+ for nc_item in $NC_LIST_MODELS
86+ do
87+ echo 'Appending rules for '$nc_item' library'
88+ NC_UPPERCASE($nc_item,NC_ITEM)
89+ NC_LIB_SUFFIX($nc_item,nc_suffix)
90+ $AWK -f $srcdir/mk-1st.awk -v MODEL=$NC_ITEM model=$nc_item suffix=$nc_suffix $srcdir/src/modules >>src/Makefile
91+ $AWK -f $srcdir/mk-2nd.awk -v MODEL=$NC_ITEM model=$nc_item srcdir=$srcdir echo=$WITH_ECHO $srcdir/src/modules >>src/Makefile
92+ test ! -d src/$nc_item && mkdir src/$nc_item
93+ done
94+ ] ) dnl
95+ dnl ---------------------------------------------------------------------------
96+ dnl Compute the library-suffix from the given model name
97+ define ( [ NC_LIB_SUFFIX] ,
98+ [
99+ case $1 in
100+ normal) $2 ='.a' ;;
101+ debug) $2 ='_g.a' ;;
102+ profile) $2 ='_p.a' ;;
103+ shared) $2 ='.so' ;;
104+ esac
105+ ] ) dnl
106+ dnl ---------------------------------------------------------------------------
107+ dnl Compute the string to append to -library from the given model name
108+ define ( [ NC_LIB_TYPE] ,
109+ [
110+ case $1 in
111+ normal) $2 ='' ;;
112+ debug) $2 ='_g' ;;
113+ profile) $2 ='_p' ;;
114+ shared) $2 ='' ;;
115+ esac
116+ ] ) dnl
117+ dnl ---------------------------------------------------------------------------
118+ dnl Construct the list of library names to generate.
119+ define ( [ NC_LIBS_TO_MAKE] ,
120+ [
121+ LIBS_TO_MAKE=""
122+ for nc_item in $nc_list_models
123+ do
124+ NC_LIB_SUFFIX($nc_item,nc_suffix)
125+ LIBS_TO_MAKE="$LIBS_TO_MAKE libncurses$nc_suffix libpanel$nc_suffix"
126+ done
127+ AC_SUBST ( LIBS_TO_MAKE ) dnl
128+ ] ) dnl
129+ dnl ---------------------------------------------------------------------------
65130dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
66131dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
67132dnl (GNU 'make' does both :-)
@@ -76,7 +141,7 @@ AC_CACHE_VAL(nc_cv_makeflags,[
76141all :
77142 echo '.$nc_option'
78143EOF
79- set nc_result=`${MAKE-make} -f ncurses.tmp`
144+ set nc_result=`${MAKE-make} -f ncurses.tmp 2>/dev/null `
80145 if test "$nc_result" != "."
81146 then
82147 nc_cv_makeflags=$nc_option
@@ -90,6 +155,49 @@ AC_SUBST(nc_cv_makeflags)
90155]
91156)
92157dnl ---------------------------------------------------------------------------
158+ dnl Attempt to determine the appropriate CC/LD options for creating a shared
159+ dnl library.
160+ define ( [ NC_SHARED_OPTS] ,
161+ [
162+ nc_systype="`(uname -s || hostname) 2>/dev/null | sed 1q`"
163+ if test -z "$nc_systype"; then nc_systype=unknown;fi
164+ case $nc_systype in
165+ Linux)
166+ CC_SHARED_OPTS='-fPIC'
167+ MK_SHARED_LIB='gcc -o $[ @] -shared -Wl,-soname,$[ @] ,-stats'
168+ ;;
169+ SunOS)
170+ CC_SHARED_OPTS='-pic'
171+ MK_SHARED_LIB='ld --assert-pure-text -o $[ @] '
172+ ;;
173+ *)
174+ CC_SHARED_OPTS='unknown'
175+ MK_SHARED_LIB='echo unknown'
176+ ;;
177+ esac
178+ AC_SUBST ( CC_SHARED_OPTS )
179+ AC_SUBST ( MK_SHARED_LIB )
180+ ] ) dnl
181+ dnl ---------------------------------------------------------------------------
182+ dnl Check for declarion of sys_errlist in one of stdio.h and errno.h.
183+ dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
184+ dnl Reported by Keith Bostic.
185+ define ( [ NC_SYS_ERRLIST] ,
186+ [
187+ AC_MSG_CHECKING ( [ declaration of sys_errlist] )
188+ AC_CACHE_VAL ( nc_cv_dcl_sys_errlist ,[
189+ AC_TRY_COMPILE ( [
190+ #include <stdio.h>
191+ #include <sys/types.h>
192+ #include <errno.h> ] ,
193+ [ char *c = (char *) *sys_errlist; ] ,
194+ [ nc_cv_dcl_sys_errlist=yes] ,
195+ [ nc_cv_dcl_sys_errlist=no] )
196+ ] )
197+ AC_MSG_RESULT ( $nc_cv_dcl_sys_errlist )
198+ test $nc_cv_dcl_sys_errlist = yes && AC_DEFINE ( HAVE_EXTERN_SYS_ERRLIST )
199+ ] ) dnl
200+ dnl ---------------------------------------------------------------------------
93201dnl On some systems ioctl(fd, TIOCGWINSZ, &size) will always return {0,0} until
94202dnl ioctl(fd, TIOCSWINSZ, &size) is called to explicitly set the size of the
95203dnl screen.
@@ -111,11 +219,14 @@ AC_CACHE_VAL(nc_cv_use_tiocgwinsz,[
111219int main()
112220{
113221 static struct winsize size;
114- if (ioctl(0, TIOCGWINSZ, &size) < 0
115- || size.ws_row == 0
116- || size.ws_col == 0)
117- exit(1);
118- exit(0);
222+ int fd;
223+ for (fd = 0; fd <= 2; fd++) { /* try in/out/err in case redirected */
224+ if (ioctl(0, TIOCGWINSZ, &size) == 0
225+ && size.ws_row > 0
226+ && size.ws_col > 0)
227+ exit(0);
228+ }
229+ exit(1);
119230}
120231 ] ,
121232 [ nc_cv_use_tiocgwinsz=yes] ,
@@ -141,3 +252,10 @@ AC_MSG_RESULT($nc_cv_type_sigaction)
141252test $nc_cv_type_sigaction = yes && AC_DEFINE ( HAVE_TYPE_SIGACTION )
142253] )
143254dnl ---------------------------------------------------------------------------
255+ dnl Make an uppercase version of a given name
256+ define ( [ NC_UPPERCASE] ,
257+ [
258+ changequote ( ,) dnl
259+ $2 =`echo $1 |tr '[ a-z] ' '[ A-Z] '`
260+ changequote ( [ ,] ) dnl
261+ ] ) dnl
0 commit comments