CMake + configure: improve generation of fltk-config.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12692 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
0e60b49b52
commit
5c2d98a5fc
@ -82,34 +82,43 @@ if (WIN32)
|
||||
endif (WIN32)
|
||||
|
||||
#######################################################################
|
||||
if(APPLE)
|
||||
option(OPTION_APPLE_X11 "use X11" OFF)
|
||||
option(OPTION_APPLE_SDL "use SDL" OFF)
|
||||
endif(APPLE)
|
||||
if (APPLE)
|
||||
option (OPTION_APPLE_X11 "use X11" OFF)
|
||||
option (OPTION_APPLE_SDL "use SDL" OFF)
|
||||
endif (APPLE)
|
||||
|
||||
if((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
||||
include(FindX11)
|
||||
if(X11_FOUND)
|
||||
set(USE_X11 1)
|
||||
list(APPEND FLTK_LDLIBS -lX11)
|
||||
if (X11_Xext_FOUND)
|
||||
list(APPEND FLTK_LDLIBS -lXext)
|
||||
endif(X11_Xext_FOUND)
|
||||
endif(X11_FOUND)
|
||||
endif((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
||||
# find X11 libraries and headers
|
||||
set (PATH_TO_XLIBS)
|
||||
if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
||||
include (FindX11)
|
||||
if (X11_FOUND)
|
||||
set (USE_X11 1)
|
||||
list (APPEND FLTK_LDLIBS -lX11)
|
||||
if (X11_Xext_FOUND)
|
||||
list (APPEND FLTK_LDLIBS -lXext)
|
||||
endif (X11_Xext_FOUND)
|
||||
get_filename_component (PATH_TO_XLIBS ${X11_X11_LIB} PATH)
|
||||
endif (X11_FOUND)
|
||||
endif ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
||||
|
||||
if (OPTION_APPLE_X11)
|
||||
include_directories(AFTER SYSTEM /opt/X11/include/freetype2)
|
||||
include_directories (AFTER SYSTEM /opt/X11/include/freetype2)
|
||||
if (PATH_TO_XLIBS)
|
||||
set (LDFLAGS "-L${PATH_TO_XLIBS} ${LDFLAGS}")
|
||||
endif (PATH_TO_XLIBS)
|
||||
if (X11_INCLUDE_DIR)
|
||||
list (APPEND FLTK_CFLAGS "-I${X11_INCLUDE_DIR}")
|
||||
endif (X11_INCLUDE_DIR)
|
||||
endif (OPTION_APPLE_X11)
|
||||
|
||||
if (OPTION_APPLE_SDL)
|
||||
find_package(SDL2 REQUIRED)
|
||||
if (SDL2_FOUND)
|
||||
set(USE_SDL 1)
|
||||
set(FL_PORTING 1)
|
||||
list(APPEND FLTK_LDLIBS SDL2_LIBRARY)
|
||||
endif(SDL2_FOUND)
|
||||
endif(OPTION_APPLE_SDL)
|
||||
find_package (SDL2 REQUIRED)
|
||||
if (SDL2_FOUND)
|
||||
set (USE_SDL 1)
|
||||
set (FL_PORTING 1)
|
||||
list (APPEND FLTK_LDLIBS SDL2_LIBRARY)
|
||||
endif (SDL2_FOUND)
|
||||
endif (OPTION_APPLE_SDL)
|
||||
|
||||
#######################################################################
|
||||
option(OPTION_USE_POLL "use poll if available" OFF)
|
||||
@ -188,7 +197,6 @@ endif(HAVE_GL)
|
||||
if(OPTION_USE_GL)
|
||||
if(OPTION_APPLE_X11)
|
||||
set(OPENGL_FOUND TRUE)
|
||||
get_filename_component(PATH_TO_XLIBS ${X11_X11_LIB} PATH)
|
||||
set(OPENGL_LIBRARIES -L${PATH_TO_XLIBS} -lGLU -lGL)
|
||||
elseif(OPTION_APPLE_SDL)
|
||||
set(OPENGL_FOUND FALSE)
|
||||
@ -232,6 +240,16 @@ else ()
|
||||
set (GLLIBS)
|
||||
endif (OPENGL_FOUND)
|
||||
|
||||
#######################################################################
|
||||
option (OPTION_LARGE_FILE "enable large file support" ON)
|
||||
|
||||
if (OPTION_LARGE_FILE)
|
||||
if (NOT MSVC)
|
||||
add_definitions (-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
|
||||
list (APPEND FLTK_CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
|
||||
endif (NOT MSVC)
|
||||
endif (OPTION_LARGE_FILE)
|
||||
|
||||
#######################################################################
|
||||
# Create an option whether we want to check for pthreads.
|
||||
# We must not do it on Windows unless we run under Cygwin, since we
|
||||
@ -295,16 +313,6 @@ if (debug_threads)
|
||||
endif (debug_threads)
|
||||
unset (debug_threads)
|
||||
|
||||
#######################################################################
|
||||
option (OPTION_LARGE_FILE "enable large file support" ON)
|
||||
|
||||
if (OPTION_LARGE_FILE)
|
||||
if (NOT MSVC)
|
||||
add_definitions (-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
|
||||
list (APPEND FLTK_CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
|
||||
endif (NOT MSVC)
|
||||
endif (OPTION_LARGE_FILE)
|
||||
|
||||
#######################################################################
|
||||
option (OPTION_USE_SYSTEM_ZLIB "use system zlib" ON)
|
||||
|
||||
@ -559,6 +567,16 @@ if (DEBUG_OPTIONS_CMAKE)
|
||||
fl_debug_var (OPENGL_FOUND)
|
||||
fl_debug_var (OPENGL_INCLUDE_DIR)
|
||||
fl_debug_var (OPENGL_LIBRARIES)
|
||||
message ("--- X11 ---")
|
||||
fl_debug_var (X11_FOUND)
|
||||
fl_debug_var (X11_INCLUDE_DIR)
|
||||
fl_debug_var (X11_LIBRARIES)
|
||||
fl_debug_var (X11_X11_LIB)
|
||||
fl_debug_var (X11_X11_INCLUDE_PATH)
|
||||
fl_debug_var (X11_Xft_INCLUDE_PATH)
|
||||
fl_debug_var (X11_Xft_LIB)
|
||||
fl_debug_var (X11_Xft_FOUND)
|
||||
fl_debug_var (PATH_TO_XLIBS)
|
||||
message (STATUS "[** end of options.cmake **]")
|
||||
endif (DEBUG_OPTIONS_CMAKE)
|
||||
unset (DEBUG_OPTIONS_CMAKE)
|
||||
|
@ -125,15 +125,15 @@ set(ARCHFLAGS ${OPTION_ARCHFLAGS})
|
||||
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_UPPER)
|
||||
if (${BUILD_UPPER})
|
||||
set(CFLAGS "${CMAKE_C_FLAGS_${BUILD_UPPER}} ${CFLAGS}")
|
||||
set (CFLAGS "${CMAKE_C_FLAGS_${BUILD_UPPER}} ${CFLAGS}")
|
||||
endif (${BUILD_UPPER})
|
||||
|
||||
set(CFLAGS "${OPTION_OPTIM} ${CMAKE_C_FLAGS} ${CFLAGS}")
|
||||
foreach(arg ${FLTK_CFLAGS})
|
||||
set(CFLAGS "${CFLAGS} ${arg}")
|
||||
set(CFLAGS "${CFLAGS} ${arg}")
|
||||
endforeach(arg ${FLTK_CFLAGS})
|
||||
|
||||
set(CXXFLAGS ${CFLAGS})
|
||||
set(CXXFLAGS "${CFLAGS}")
|
||||
|
||||
foreach(arg ${FLTK_LDLIBS})
|
||||
set(LINK_LIBS "${LINK_LIBS} ${arg}")
|
||||
|
69
configure.ac
69
configure.ac
@ -649,41 +649,6 @@ STATICIMAGELIBS=""
|
||||
AC_SUBST(IMAGELIBS)
|
||||
AC_SUBST(STATICIMAGELIBS)
|
||||
|
||||
# Handle the JPEG lib linking mode (use fltk local or system lib)
|
||||
# If --enable-(resp. --disable-)localjpeg parameter is not set by user
|
||||
# Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
|
||||
AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library [[default=auto]]])
|
||||
# Check for System lib use if automatic mode or --disable-localjpeg is requested
|
||||
sysjpeglib_ok=no
|
||||
sysjpeginc_ok=no
|
||||
if test x$enable_localjpeg != xyes; then
|
||||
AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
|
||||
[AC_CHECK_HEADER(jpeglib.h,
|
||||
sysjpeginc_ok=yes)
|
||||
if test x$sysjpeginc_ok = xyes; then
|
||||
sysjpeglib_ok=yes
|
||||
fi])
|
||||
fi
|
||||
# Now set the jpeg lib and include flags according to the requested mode and availability
|
||||
if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
|
||||
JPEGINC="-I../jpeg"
|
||||
JPEG="jpeg"
|
||||
IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
|
||||
STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
#ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
|
||||
# Finally, warn user if system lib was requested but not found
|
||||
if test x$enable_localjpeg = xno; then
|
||||
AC_MSG_WARN([Cannot find system jpeg lib or header: choosing the local lib mode.])
|
||||
fi
|
||||
else
|
||||
JPEGINC=""
|
||||
JPEG=""
|
||||
IMAGELIBS="-ljpeg $IMAGELIBS"
|
||||
STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
fi
|
||||
|
||||
# Handle the ZLIB lib linking mode (use fltk local or system lib)
|
||||
# If --enable-(resp. --disable-)localzlib parameter is not set by user
|
||||
# Then we check the ZLIB lib usability, with result in syszlib_ok variable
|
||||
@ -767,6 +732,40 @@ else
|
||||
AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
|
||||
fi
|
||||
|
||||
# Handle the JPEG lib linking mode (use fltk local or system lib)
|
||||
# If --enable-(resp. --disable-)localjpeg parameter is not set by user
|
||||
# Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
|
||||
AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library [[default=auto]]])
|
||||
# Check for System lib use if automatic mode or --disable-localjpeg is requested
|
||||
sysjpeglib_ok=no
|
||||
sysjpeginc_ok=no
|
||||
if test x$enable_localjpeg != xyes; then
|
||||
AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
|
||||
[AC_CHECK_HEADER(jpeglib.h,
|
||||
sysjpeginc_ok=yes)
|
||||
if test x$sysjpeginc_ok = xyes; then
|
||||
sysjpeglib_ok=yes
|
||||
fi])
|
||||
fi
|
||||
# Now set the jpeg lib and include flags according to the requested mode and availability
|
||||
if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
|
||||
JPEGINC="-I../jpeg"
|
||||
JPEG="jpeg"
|
||||
IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
|
||||
STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
# Finally, warn user if system lib was requested but not found
|
||||
if test x$enable_localjpeg = xno; then
|
||||
AC_MSG_WARN([Cannot find system jpeg lib or header: choosing the local lib mode.])
|
||||
fi
|
||||
else
|
||||
JPEGINC=""
|
||||
JPEG=""
|
||||
IMAGELIBS="-ljpeg $IMAGELIBS"
|
||||
STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
fi
|
||||
|
||||
AC_SUBST(JPEG)
|
||||
AC_SUBST(JPEGINC)
|
||||
AC_SUBST(PNG)
|
||||
|
Loading…
Reference in New Issue
Block a user