📄 acinclude.m4
字号:
AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([K_PATH_X])if test $kde_qtver = 3; then AC_SUBST(LIB_KDECORE, "-lkdecore") AC_SUBST(LIB_KDEUI, "-lkdeui") AC_SUBST(LIB_KIO, "-lkio") AC_SUBST(LIB_SMB, "-lsmb") AC_SUBST(LIB_KAB, "-lkab") AC_SUBST(LIB_KABC, "-lkabc") AC_SUBST(LIB_KHTML, "-lkhtml") AC_SUBST(LIB_KSPELL, "-lkspell") AC_SUBST(LIB_KPARTS, "-lkparts") AC_SUBST(LIB_KDEPRINT, "-lkdeprint")# these are for backward compatibility AC_SUBST(LIB_KSYCOCA, "-lkio") AC_SUBST(LIB_KFILE, "-lkio")elif test $kde_qtver = 2; then AC_SUBST(LIB_KDECORE, "-lkdecore") AC_SUBST(LIB_KDEUI, "-lkdeui") AC_SUBST(LIB_KIO, "-lkio") AC_SUBST(LIB_KSYCOCA, "-lksycoca") AC_SUBST(LIB_SMB, "-lsmb") AC_SUBST(LIB_KFILE, "-lkfile") AC_SUBST(LIB_KAB, "-lkab") AC_SUBST(LIB_KHTML, "-lkhtml") AC_SUBST(LIB_KSPELL, "-lkspell") AC_SUBST(LIB_KPARTS, "-lkparts") AC_SUBST(LIB_KDEPRINT, "-lkdeprint")else AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")fi])AC_DEFUN(AC_PATH_KDE,[ AC_BASE_PATH_KDE AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], [ if test "$enableval" = "no"; then ac_use_path_checking="default" else ac_use_path_checking="" fi ], [ if test "$kde_qtver" = 1; then ac_use_path_checking="" else ac_use_path_checking="default" fi ] ) AC_CREATE_KFSSTND($ac_use_path_checking) AC_SUBST_KFSSTND KDE_CREATE_LIBS_ALIASES])dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])AC_DEFUN(KDE_CHECK_FUNC_EXT,[AC_MSG_CHECKING(for $1)AC_CACHE_VAL(kde_cv_func_$1,[AC_LANG_SAVEAC_LANG_CPLUSPLUSsave_CXXFLAGS="$CXXFLAGS"kde_safe_LIBS="$LIBS"LIBS="$LIBS $X_EXTRA_LIBS"if test "$GXX" = "yes"; thenCXXFLAGS="$CXXFLAGS -pedantic-errors"fiAC_TRY_COMPILE([$2],[$3],kde_cv_func_$1=yes,kde_cv_func_$1=no)CXXFLAGS="$save_CXXFLAGS"LIBS="$kde_safe_LIBS"AC_LANG_RESTORE])AC_MSG_RESULT($kde_cv_func_$1)AC_MSG_CHECKING([if $1 needs custom prototype])AC_CACHE_VAL(kde_cv_proto_$1,[if test "x$kde_cv_func_$1" = xyes; then kde_cv_proto_$1=noelse case "$1" in setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) kde_cv_proto_$1="yes - in libkdefakes" ;; *) kde_cv_proto_$1=unknown ;; esacfiif test "x$kde_cv_proto_$1" = xunknown; thenAC_LANG_SAVEAC_LANG_CPLUSPLUS kde_safe_libs=$LIBS LIBS="$LIBS $X_EXTRA_LIBS" AC_TRY_LINK([$2extern "C" $4;],[$3],[ kde_cv_func_$1=yes kde_cv_proto_$1=yes ], [kde_cv_proto_$1="$1 unavailable"])LIBS=$kde_safe_libsAC_LANG_RESTOREfi])AC_MSG_RESULT($kde_cv_proto_$1)if test "x$kde_cv_func_$1" = xyes; then AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) $6fiif test "x$kde_cv_proto_$1" = xno; then AC_DEFINE(HAVE_$5_PROTO, 1, [Define if you have the $1 prototype])fiAH_VERBATIM([_HAVE_$5_PROTO],[#if !defined(HAVE_$5_PROTO)#ifdef __cplusplusextern "C"#endif$4;#endif])])AC_DEFUN(AC_CHECK_SETENV,[ KDE_CHECK_FUNC_EXT(setenv, [#include <stdlib.h>], [setenv("VAR", "VALUE", 1);], [int setenv (const char *, const char *, int)], [SETENV])])AC_DEFUN(AC_CHECK_UNSETENV,[ KDE_CHECK_FUNC_EXT(unsetenv, [#include <stdlib.h>], [unsetenv("VAR");], [void unsetenv (const char *)], [UNSETENV])])AC_DEFUN(AC_CHECK_GETDOMAINNAME,[ KDE_CHECK_FUNC_EXT(getdomainname, [#include <stdlib.h>#include <unistd.h>], [char buffer[200];getdomainname(buffer, 200);], [int getdomainname (char *, size_t)], [GETDOMAINNAME])])AC_DEFUN(AC_CHECK_GETHOSTNAME,[ KDE_CHECK_FUNC_EXT(gethostname, [#include <stdlib.h>#include <unistd.h>], [char buffer[200];gethostname(buffer, 200);], [int gethostname (char *, unsigned int)], [GETHOSTNAME])])AC_DEFUN(AC_CHECK_USLEEP,[ KDE_CHECK_FUNC_EXT(usleep, [#include <unistd.h>], [usleep(200);], [int usleep (unsigned int)], [USLEEP])])AC_DEFUN(AC_CHECK_RANDOM,[ KDE_CHECK_FUNC_EXT(random, [#include <stdlib.h>], [random();], [long int random(void)], [RANDOM]) KDE_CHECK_FUNC_EXT(srandom, [#include <stdlib.h>], [srandom(27);], [void srandom(unsigned int)], [SRANDOM])])AC_DEFUN(AC_CHECK_INITGROUPS,[ KDE_CHECK_FUNC_EXT(initgroups, [#include <sys/types.h>#include <unistd.h>#include <grp.h>], [char buffer[200];initgroups(buffer, 27);], [int initgroups(const char *, gid_t)], [INITGROUPS])])AC_DEFUN(AC_CHECK_MKSTEMPS,[ KDE_CHECK_FUNC_EXT(mkstemps, [#include <stdlib.h>#include <unistd.h>], [mkstemps("/tmp/aaaXXXXXX", 6);], [int mkstemps(char *, int)], [MKSTEMPS])])AC_DEFUN(AC_CHECK_MKDTEMP,[ KDE_CHECK_FUNC_EXT(mkdtemp, [#include <stdlib.h>#include <unistd.h>], [mkdtemp("/tmp/aaaXXXXXX");], [char *mkdtemp(char *)], [MKDTEMP])])AC_DEFUN(AC_CHECK_RES_INIT,[ AC_MSG_CHECKING([if res_init needs -lresolv]) kde_libs_safe="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS -lresolv" AC_TRY_LINK( [#include <sys/types.h>#include <netinet/in.h>#include <arpa/nameser.h>#include <resolv.h> ], [ res_init(); ], [ LIBRESOLV="-lresolv" AC_MSG_RESULT(yes) AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) ], [ AC_MSG_RESULT(no) ] ) LIBS=$kde_libs_safe AC_SUBST(LIBRESOLV) AC_MSG_CHECKING([if res_init is available]) AC_TRY_COMPILE( [#include <sys/types.h>#include <netinet/in.h>#include <arpa/nameser.h>#include <resolv.h> ], [ res_init(); ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) ], [ AC_MSG_RESULT(no) ] )])AC_DEFUN(AC_CHECK_STRLCPY,[ KDE_CHECK_FUNC_EXT(strlcpy, [#include <string.h>],[ char buf[20]; strlcpy(buf, "KDE function test", sizeof(buf));], [unsigned long strlcpy(char*, const char*, unsigned long)], [STRLCPY])])AC_DEFUN(AC_CHECK_STRLCAT,[ KDE_CHECK_FUNC_EXT(strlcat, [#include <string.h>],[ char buf[20]; buf[0]='\0'; strlcat(buf, "KDE function test", sizeof(buf));], [unsigned long strlcat(char*, const char*, unsigned long)], [STRLCAT])])AC_DEFUN(AC_FIND_GIF, [AC_MSG_CHECKING([for giflib])AC_CACHE_VAL(ac_cv_lib_gif,[ac_save_LIBS="$LIBS"if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; thenLIBS="$all_libraries -lgif -lX11 $LIBSOCKET"elseLIBS="$all_libraries -lgif"fiAC_TRY_LINK(dnl[#ifdef __cplusplusextern "C" {#endifint GifLastError(void);#ifdef __cplusplus}#endif/* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */], [return GifLastError();], eval "ac_cv_lib_gif=yes", eval "ac_cv_lib_gif=no")LIBS="$ac_save_LIBS"])dnlif eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])else AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)fi])AC_DEFUN(KDE_FIND_JPEG_HELPER,[AC_MSG_CHECKING([for libjpeg$2])AC_CACHE_VAL(ac_cv_lib_jpeg_$1,[AC_LANG_Cac_save_LIBS="$LIBS"LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"ac_save_CFLAGS="$CFLAGS"CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"AC_TRY_LINK([/* Override any gcc2 internal prototype to avoid an error. */struct jpeg_decompress_struct;typedef struct jpeg_decompress_struct * j_decompress_ptr;typedef int size_t;#ifdef __cplusplusextern "C" {#endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize);#ifdef __cplusplus}#endif/* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */], [jpeg_CreateDecompress(0L, 0, 0);], eval "ac_cv_lib_jpeg_$1=-ljpeg$2", eval "ac_cv_lib_jpeg_$1=no")LIBS="$ac_save_LIBS"CFLAGS="$ac_save_CFLAGS"])if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_$1" AC_MSG_RESULT($ac_cv_lib_jpeg_$1)else AC_MSG_RESULT(no) $3fi])AC_DEFUN(AC_FIND_JPEG,[dnl first look for librariesKDE_FIND_JPEG_HELPER(6b, 6b, KDE_FIND_JPEG_HELPER(normal, [], [ LIBJPEG= ] ))dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.hdnl requires system dependent includes loaded before it)jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)test "x$jpeg_incdir" = xNO && jpeg_incdir=dnl if headers _and_ libraries are missing, this is no error, and wednl continue with a warning (the user will get no jpeg support in khtml)dnl if only one is missing, it means a configuration error, but we stilldnl only warnif test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])else if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then AC_MSG_WARN([There is an installation error in jpeg support. You seem to have only oneof either the headers _or_ the libraries installed. You may need to eitherprovide correct --with-extra-... options, or the development package oflibjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/Disabling JPEG support.]) else AC_MSG_WARN([libjpeg not found. disable JPEG support.]) fi jpeg_incdir= LIBJPEG=fiAC_SUBST(LIBJPEG)AH_VERBATIM(_AC_CHECK_JPEG,[/* * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system * headers and I'm too lazy to write a configure test as long as only * unixware is related */#ifdef _UNIXWARE#define HAVE_BOOLEAN#endif])])AC_DEFUN(KDE_CHECK_QT_JPEG,[if test -n "$LIBJPEG"; thenAC_MSG_CHECKING([if Qt needs $LIBJPEG])AC_CACHE_VAL(kde_cv_qt_jpeg,[AC_LANG_SAVEAC_LANG_CPLUSPLUSac_save_LIBS="$LIBS"LIBS="$all_libraries $USER_LDFLAGS $LIBQT"LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`ac_save_CXXFLAGS="$CXXFLAGS"CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"AC_TRY_LINK([#include <qapplication.h>], [ int argc; char** argv; QApplication app(argc, argv);], eval "kde_cv
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -