Skip to content

Commit

Permalink
Use pkg-config for initial zlib check (Issue #519)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Mar 14, 2024
1 parent 055acba commit 6d7d843
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 288 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Changes in HTMLDOC v1.9.19

- Updated configure script to look for zlib with pkg-config (Issue #519)


# Changes in HTMLDOC v1.9.18

- Fixed table rendering when there are missing `</tr>` (Issue #494)
Expand Down
51 changes: 1 addition & 50 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Configuration file for HTMLDOC.
*
* Copyright © 2011-2023 by Michael R Sweet.
* Copyright © 2011-2024 by Michael R Sweet.
* Copyright © 1997-2010 by Easy Software Products. All rights reserved.
*
* This program is free software. Distribution and use rights are outlined in
Expand Down Expand Up @@ -110,52 +110,3 @@
*/

#undef HAVE_TM_GMTOFF


/*
* Which random number generator function to use...
*/

#undef HAVE_ARC4RANDOM
#undef HAVE_RANDOM
#undef HAVE_LRAND48

#ifdef HAVE_ARC4RANDOM
# define HTMLDOC_RAND() arc4random()
# define HTMLDOC_SRAND(v)
#elif defined(HAVE_RANDOM)
# define HTMLDOC_RAND() random()
# define HTMLDOC_SRAND(v) srandom(v)
#elif defined(HAVE_LRAND48)
# define HTMLDOC_RAND() lrand48()
# define HTMLDOC_SRAND(v) srand48(v)
#else
# define HTMLDOC_RAND() rand()
# define HTMLDOC_SRAND(v) srand(v)
#endif /* HAVE_ARC4RANDOM */


/*
* Do we have the long long type?
*/

#undef HAVE_LONG_LONG

#ifdef HAVE_LONG_LONG
# define HTMLDOC_LLFMT "%lld"
# define HTMLDOC_LLCAST (long long)
#else
# define HTMLDOC_LLFMT "%ld"
# define HTMLDOC_LLCAST (long)
#endif /* HAVE_LONG_LONG */


/*
* Do we have the strtoll() function?
*/

#undef HAVE_STRTOLL

#ifndef HAVE_STRTOLL
# define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
#endif /* !HAVE_STRTOLL */
165 changes: 52 additions & 113 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2858,6 +2858,7 @@ then :
fi



for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
Expand Down Expand Up @@ -4542,6 +4543,8 @@ fi





if test "$ac_cv_prog_ranlib" = ":"
then :

Expand All @@ -4556,6 +4559,7 @@ fi




ac_header= ac_cache=
for ac_item in $ac_header_c_list
do
Expand Down Expand Up @@ -4600,6 +4604,7 @@ then :
fi



ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
if test "x$ac_cv_func_strdup" = xyes
then :
Expand Down Expand Up @@ -4644,25 +4649,6 @@ then :
fi


ac_fn_c_check_func "$LINENO" "random" "ac_cv_func_random"
if test "x$ac_cv_func_random" = xyes
then :
printf "%s\n" "#define HAVE_RANDOM 1" >>confdefs.h

fi
ac_fn_c_check_func "$LINENO" "lrand48" "ac_cv_func_lrand48"
if test "x$ac_cv_func_lrand48" = xyes
then :
printf "%s\n" "#define HAVE_LRAND48 1" >>confdefs.h

fi
ac_fn_c_check_func "$LINENO" "arc4random" "ac_cv_func_arc4random"
if test "x$ac_cv_func_arc4random" = xyes
then :
printf "%s\n" "#define HAVE_ARC4RANDOM 1" >>confdefs.h

fi


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tm_gmtoff member in tm structure" >&5
printf %s "checking for tm_gmtoff member in tm structure... " >&6; }
Expand Down Expand Up @@ -4696,9 +4682,11 @@ printf "%s\n" "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext


LDFLAGS="${LDFLAGS:=}"



{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
printf %s "checking for pow in -lm... " >&6; }
if test ${ac_cv_lib_m_pow+y}
Expand Down Expand Up @@ -4743,6 +4731,7 @@ then :
fi



# Check whether --enable-largefile was given.
if test ${enable_largefile+y}
then :
Expand Down Expand Up @@ -4971,66 +4960,6 @@ fi
fi


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
printf %s "checking for long long int... " >&6; }
if test ${ac_cv_c_long_long+y}
then :
printf %s "(cached) " >&6
else $as_nop

if test "$GCC" = yes
then :

ac_cv_c_long_long=yes

else $as_nop

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
long long int i;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :

ac_cv_c_long_long=yes

else $as_nop

ac_cv_c_long_long=no

fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext

fi

fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_long_long" >&5
printf "%s\n" "$ac_cv_c_long_long" >&6; }

if test $ac_cv_c_long_long = yes
then :

printf "%s\n" "#define HAVE_LONG_LONG 1" >>confdefs.h


fi

ac_fn_c_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll"
if test "x$ac_cv_func_strtoll" = xyes
then :
printf "%s\n" "#define HAVE_STRTOLL 1" >>confdefs.h

fi


if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cups-config", so it can be a program name with args.
Expand Down Expand Up @@ -5182,6 +5111,7 @@ printf "%s\n" "yes, v$CUPS_VERSION" >&6; }

fi


have_fltk=no
POST=:
if test "x$with_gui" != xno
Expand Down Expand Up @@ -5311,6 +5241,7 @@ fi




{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libjpeg" >&5
printf %s "checking for libjpeg... " >&6; }
if $PKGCONFIG --exists libjpeg
Expand All @@ -5331,13 +5262,35 @@ printf "%s\n" "no" >&6; };

fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing gzgets" >&5
printf %s "checking for library containing gzgets... " >&6; }
if test ${ac_cv_search_gzgets+y}

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5
printf %s "checking for zlib... " >&6; }
if $PKGCONFIG --exists zlib
then :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; };
CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags zlib)"
LIBS="$($PKGCONFIG --libs zlib) $LIBS"

else $as_nop

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no pkg-config definition" >&5
printf "%s\n" "no pkg-config definition" >&6; };
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
if test "x$ac_cv_header_zlib_h" = xyes
then :

fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gzgets in -lz" >&5
printf %s "checking for gzgets in -lz... " >&6; }
if test ${ac_cv_lib_z_gzgets+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_func_search_save_LIBS=$LIBS
ac_check_lib_save_LIBS=$LIBS
LIBS="-lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand All @@ -5353,46 +5306,29 @@ return gzgets ();
return 0;
}
_ACEOF
for ac_lib in '' z
do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_search_gzgets=$ac_res
ac_cv_lib_z_gzgets=yes
else $as_nop
ac_cv_lib_z_gzgets=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_gzgets+y}
then :
break
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
done
if test ${ac_cv_search_gzgets+y}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzgets" >&5
printf "%s\n" "$ac_cv_lib_z_gzgets" >&6; }
if test "x$ac_cv_lib_z_gzgets" = xyes
then :

LIBS="$LIBS -lz"

else $as_nop
ac_cv_search_gzgets=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gzgets" >&5
printf "%s\n" "$ac_cv_search_gzgets" >&6; }
ac_res=$ac_cv_search_gzgets
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"

LIBS="$LIBS -lz"
as_fn_error $? "HTMLDOC requires zlib." "$LINENO" 5

else $as_nop
fi

as_fn_error $? "HTMLDOC requires zlib." "$LINENO" 5

fi

Expand All @@ -5417,6 +5353,7 @@ printf "%s\n" "no" >&6; };

fi


if test "$prefix" = "NONE"
then :

Expand Down Expand Up @@ -5480,6 +5417,7 @@ printf "%s\n" "#define DOCUMENTATION \"$datadir/doc/htmldoc\"" >>confdefs.h
printf "%s\n" "#define HTML_DATA \"$datadir/htmldoc\"" >>confdefs.h



# Check whether --enable-maintainer was given.
if test ${enable_maintainer+y}
then :
Expand Down Expand Up @@ -5708,6 +5646,7 @@ fi

fi


ac_config_files="$ac_config_files Makedefs Makefile desktop/htmldoc.plist"

cat >confcache <<\_ACEOF
Expand Down
Loading

0 comments on commit 6d7d843

Please sign in to comment.