diff --git a/CMakeLists.txt b/CMakeLists.txt index 508552c69..c9afd0951 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,28 +229,6 @@ if (MSVC) endif() endif() -if(ENABLE_FGADMIN) - find_package(FLTK) - - if ( FLTK_FOUND ) - if ( X11_Xinerama_FOUND ) - message(STATUS "Found X11_Xinerama...") - list(APPEND FLTK_LIBRARIES ${X11_Xinerama_LIB}) - endif() - - if ( X11_Xft_FOUND ) - message(STATUS "Found X11_Xft...") - list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB}) - endif() - - if ( CMAKE_DL_LIBS ) - list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS}) - endif() - - message(STATUS "Using FLTK_LIBRARIES for fgadmin: ${FLTK_LIBRARIES}") - endif ( FLTK_FOUND ) -endif(ENABLE_FGADMIN) - ############################################################################## ## Sqlite3 setup diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index ad907eb23..b1e136d9d 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,14 +1,10 @@ -if(FLTK_FOUND) - if (EXISTS ${FLTK_FLUID_EXECUTABLE}) - add_subdirectory(fgadmin) - else () - message(STATUS "fluid executable not found, disabling fgadmin") - endif () +if(ENABLE_FGADMIN) + add_subdirectory(fgadmin) endif() # win32 is just excluded because of not having argument parsing there ... if(RTI_FOUND AND NOT WIN32) - add_subdirectory(fgai) + add_subdirectory(fgai) endif() if(ENABLE_FGELEV) @@ -16,7 +12,7 @@ if(ENABLE_FGELEV) endif() if(WITH_FGPANEL) - add_subdirectory(fgpanel) + add_subdirectory(fgpanel) endif() if(ENABLE_FGVIEWER) diff --git a/utils/fgadmin/CMakeLists.txt b/utils/fgadmin/CMakeLists.txt index febd4f0ab..fa59a8ec1 100644 --- a/utils/fgadmin/CMakeLists.txt +++ b/utils/fgadmin/CMakeLists.txt @@ -1 +1,47 @@ -add_subdirectory(src) +#Zlib is already required by FG but we check it just in case +if( ZLIB_FOUND ) + include_directories(${ZLIB_INCLUDE_DIR}) + set( HAVE_ZLIB 1) + message(STATUS "Zlib found for fgadmin") +endif( ZLIB_FOUND ) + +find_package(BZip2) +if( BZIP2_FOUND ) + include_directories(${BZIP2_INCLUDE_DIR}) + set( HAVE_BZ2LIB 1) + message(STATUS "BZip2 found for fgadmin") +endif( BZIP2_FOUND ) + +find_package(FLTK) +if( FLTK_FOUND ) + include_directories(${FLTK_INCLUDE_DIR}) + + if ( X11_Xinerama_FOUND ) + message(STATUS "Found X11_Xinerama...") + list(APPEND FLTK_LIBRARIES ${X11_Xinerama_LIB}) + endif() + + if ( X11_Xft_FOUND ) + message(STATUS "Found X11_Xft...") + list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB}) + endif() + + if ( CMAKE_DL_LIBS ) + list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS}) + endif() + + if( EXISTS ${FLTK_FLUID_EXECUTABLE} ) + add_subdirectory(src) + else() + message(STATUS "Fluid executable not found, disabling fgadmin") + endif() + + message(STATUS "Using FLTK_LIBRARIES for fgadmin: ${FLTK_LIBRARIES}") +else() + message(STATUS "FLTK not found, disabling fgadmin") +endif( FLTK_FOUND ) + +configure_file( + "${PROJECT_SOURCE_DIR}/utils/fgadmin/src/config_cmake.h.in" + "${PROJECT_BINARY_DIR}/utils/fgadmin/src/config_fgadmin.h" +) diff --git a/utils/fgadmin/ChangeLog b/utils/fgadmin/ChangeLog deleted file mode 100644 index 05ec0d7d8..000000000 --- a/utils/fgadmin/ChangeLog +++ /dev/null @@ -1 +0,0 @@ -See the NEWS file in the root of this project. diff --git a/utils/fgadmin/NEWS b/utils/fgadmin/NEWS deleted file mode 100644 index 05ec0d7d8..000000000 --- a/utils/fgadmin/NEWS +++ /dev/null @@ -1 +0,0 @@ -See the NEWS file in the root of this project. diff --git a/utils/fgadmin/autogen.sh b/utils/fgadmin/autogen.sh deleted file mode 100755 index f57cd8fd4..000000000 --- a/utils/fgadmin/autogen.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -OSTYPE=`uname -s` -MACHINE=`uname -m` -AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\.\([0-9]*\).*/\1/'` -if test $AUTO_MAKE_VERSION -lt 15; then - echo "" - echo "You need to upgrade to automake version 1.5 or greater." - echo "Most distributions have packages available to install or you can" - echo "find the source for the most recent version at" - echo "ftp://ftp.gnu.org/gnu/automake" - exit 1 -fi - -echo "Host info: $OSTYPE $MACHINE" -echo -n " automake: `automake --version | head -1 | awk '{print $4}'`" -echo " ($AUTO_MAKE_VERSION)" -echo "" - -echo "Running aclocal" -aclocal - -echo "Running autoheader" -autoheader -if [ ! -e src/config.h.in ]; then - echo "ERROR: autoheader didn't create src/configh.in!" - exit 1 -fi - -echo "Running automake --add-missing" -automake --add-missing - -echo "Running autoconf" -autoconf - -if [ ! -e configure ]; then - echo "ERROR: configure was not created!" - exit 1 -fi - -echo "" -echo "======================================" - -if [ -f config.cache ]; then - echo "config.cache exists. Removing the config.cache file will force" - echo "the ./configure script to rerun all it's tests rather than using" - echo "the previously cached values." - echo "" -fi - -echo "Now you are ready to run './configure'" -echo "======================================" diff --git a/utils/fgadmin/configure.ac b/utils/fgadmin/configure.ac deleted file mode 100644 index 0b48693aa..000000000 --- a/utils/fgadmin/configure.ac +++ /dev/null @@ -1,188 +0,0 @@ -dnl Process this file with autoget.sh to produce a working configure -dnl script. -dnl -dnl $Id$ - -AC_INIT -AC_CONFIG_SRCDIR([src/fgadmin.fl]) - -dnl Require at least automake 2.52 -AC_PREREQ(2.52) - -dnl Initialize the automake stuff -AM_INIT_AUTOMAKE(fgadmin, 1.0.0) - -dnl Checks for programs. -AC_PROG_MAKE_SET -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -AC_PROG_RANLIB -AC_PROG_INSTALL -AC_PROG_LN_S - -dnl set the $host variable based on local machine/os -AC_CANONICAL_HOST - -case "${host}" in -*-*-irix*) - if test "$CXX" = "CC"; then - AR="CC -ar" - ARFLAGS="-o" - CXXFLAGS="$CXXFLAGS -I$with_simgear/include/simgear/compatibility" - else - AR="ar" - ARFLAGS="cru" - fi - ;; -*) - AR="ar" - ARFLAGS="cru" - ;; -esac -AC_SUBST(AR) -AC_SUBST(ARFLAGS) - -# Check for MS Windows environment -AC_CHECK_HEADER(windows.h) - -dnl Checks for libraries. - -# The following are C++ items that need to be tested for with the c++ -# compiler - -AC_LANG_PUSH(C++) - -AC_CHECK_LIB(fltk,fl_yes,LIBS="$LIBS `fltk-config --use-images --ldflags`" - LDFLAGS="$LDFLAGS `fltk-config --use-images --ldflags`" - CPPFLAGS="$CPPFLAGS `fltk-config --cxxflags`", - AC_MSG_ERROR(fltk library required get it at http://www.fltk.org)) - -# Check for "plib" without which we cannot go on -AC_CHECK_HEADER(plib/ul.h) -if test "x$ac_cv_header_plib_ul_h" != "xyes"; then - echo - echo "You *must* have the plib library installed on your system to build" - echo "the FGFS simulator!" - echo - echo "Please see README.plib for more details." - echo - echo "configure aborted." - exit -fi - -AC_MSG_CHECKING([for plib 1.6.0 or newer]) -AC_TRY_RUN([ -#include - -#define MIN_PLIB_VERSION 160 - -int main() { - int major, minor, micro; - - if ( PLIB_VERSION < MIN_PLIB_VERSION ) { - return -1; - } - - return 0; -} - -], - AC_MSG_RESULT(yes), - [AC_MSG_RESULT(wrong version); - AC_MSG_ERROR([Install plib 1.6.0 or later first...])], - AC_MSG_RESULT(yes) -) - -dnl Check for the presence of SimGear -AC_CHECK_HEADER(simgear/version.h) -if test "x$ac_cv_header_simgear_version_h" != "xyes"; then - echo - echo "You *must* have the SimGear support library installed on your system" - echo "to build the FGFS simulator!" - echo - echo "Please see README.SimGear for more details." - echo - echo "configure aborted." - exit -fi - -AC_MSG_CHECKING([for simgear 0.3.4 or newer]) -AC_TRY_RUN([ -#include - -#include - -#define STRINGIFY(X) XSTRINGIFY(X) -#define XSTRINGIFY(X) #X - -#define MIN_MAJOR 0 -#define MIN_MINOR 3 -#define MIN_MICRO 4 - -int main() { - int major, minor, micro; - - printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); - - sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ ); - - if ( major < MIN_MAJOR ) { - return -1; - } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) { - return -1; - } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){ - return -1; - } - - return 0; -} - -], - AC_MSG_RESULT(yes), - [AC_MSG_RESULT(wrong version); - AC_MSG_ERROR([Install latest simgear first...])], - AC_MSG_RESULT(yes) -) - -AC_LANG_POP - -dnl Check for system installed zlib -AC_CHECK_HEADER(zlib.h) -if test "x$ac_cv_header_zlib_h" != "xyes"; then - echo - echo "zlib library not found." - echo - echo "If your OS does not provide an installable package for zlib" - echo "you will have to compile and install it first yourself. A copy" - echo "of zlib-1.1.4.tar.gz is included with SimGear. You will" - echo "have to untar this source code, and follow it's included instructions" - echo "to compile and install on your system." - echo - echo "configure aborted." - echo - exit -else - AC_DEFINE([HAVE_ZLIB], 1, [Define to enable gz compressed tar archives]) -fi - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS( errno.h fcntl.h sys/types.h sys/stat.h ) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM - -AC_CHECK_FUNCS( [ rmdir unlink ] ) - -AM_CONFIG_HEADER(src/config.h) - -AC_CONFIG_FILES([ \ - Makefile \ - src/Makefile \ -]) - -AC_OUTPUT diff --git a/utils/fgadmin/src/CMakeLists.txt b/utils/fgadmin/src/CMakeLists.txt index 42b95d799..ef98c6c14 100644 --- a/utils/fgadmin/src/CMakeLists.txt +++ b/utils/fgadmin/src/CMakeLists.txt @@ -1,18 +1,19 @@ - fltk_wrap_ui(FGAdminUI fgadmin.fl) add_library(FGAdminUI ${FGAdminUI_FLTK_UI_SRCS}) -add_executable(fgadmin fgadmin_funcs.cxx main.cxx untarka.c) +add_executable(fgadmin WIN32 fgadmin_funcs.cxx main.cxx untarka.c) add_dependencies(fgadmin FGAdminUI) -include_directories(${FLTK_INCLUDE_DIR}) - target_link_libraries(fgadmin FGAdminUI ${SIMGEAR_CORE_LIBRARIES} ${PLIB_LIBRARIES} ${FLTK_LIBRARIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} - ${ZLIB_LIBRARY} + ${ZLIB_LIBRARIES} ) +if( BZIP2_FOUND ) + target_link_libraries(fgadmin ${BZIP2_LIBRARIES}) +endif( BZIP2_FOUND ) + install(TARGETS fgadmin RUNTIME DESTINATION bin) diff --git a/utils/fgadmin/src/config.h b/utils/fgadmin/src/config.h deleted file mode 100644 index 4f79640a4..000000000 --- a/utils/fgadmin/src/config.h +++ /dev/null @@ -1,80 +0,0 @@ -/* src/config.h. Generated by configure. */ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `rmdir' function. */ -#define HAVE_RMDIR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `unlink' function. */ -#define HAVE_UNLINK 1 - -/* Define to enable gz compressed tar archives */ -#define HAVE_ZLIB 1 - -/* Name of package */ -#define PACKAGE "fgadmin" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Version number of package */ -#define VERSION "1.0.0" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ diff --git a/utils/fgadmin/src/config_cmake.h.in b/utils/fgadmin/src/config_cmake.h.in new file mode 100644 index 000000000..2409de6d9 --- /dev/null +++ b/utils/fgadmin/src/config_cmake.h.in @@ -0,0 +1,2 @@ +#cmakedefine HAVE_BZ2LIB +#cmakedefine HAVE_ZLIB diff --git a/utils/fgadmin/src/main.cxx b/utils/fgadmin/src/main.cxx index d40a0578c..07f660369 100644 --- a/utils/fgadmin/src/main.cxx +++ b/utils/fgadmin/src/main.cxx @@ -20,21 +20,13 @@ // // $Id$ - -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include -#include #include "fgadmin.h" -using std::string; - -string def_install_source; -string def_scenery_dest; +std::string def_install_source; +std::string def_scenery_dest; bool silent = false; /** diff --git a/utils/fgadmin/src/untarka.c b/utils/fgadmin/src/untarka.c index 3336ba1ba..4e393f398 100644 --- a/utils/fgadmin/src/untarka.c +++ b/utils/fgadmin/src/untarka.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "config_fgadmin.h" #endif #define DUMMY \ @@ -156,7 +156,7 @@ static char const* xZ_Error(struct Readable* self, int *errnum_ret) { return "lzw error"; } -#if HAVE_ZLIB +#ifdef HAVE_ZLIB #include "zlib.h" /* #define xFILE gzFile */ static int xGZ_Open4Read(struct Readable* self, char const* filename) { total_read=0; return NULL==(self->f=gzopen(filename,"rb")); } @@ -165,7 +165,7 @@ static unsigned xGZ_Read(struct Readable* self, void* buf, unsigned len) { unsig static char const* xGZ_Error(struct Readable* self, int *errnum_ret) { return gzerror((gzFile)self->f, errnum_ret); } #endif -#if HAVE_BZ2LIB +#ifdef HAVE_BZ2LIB #include "bzlib.h" /* #define xFILE BZFILE* */ static int xBZ2_Open4Read(struct Readable* self, char const* filename) { return NULL==(self->f=BZ2_bzopen(filename,"rb")); } @@ -315,7 +315,7 @@ static int xOpen4Read(struct Readable *self, char const* filename) { if (5>fread(buf, 1, sizeof(buf), f)) return 2; if (0) { } else if (buf[0]==0102 && buf[1]==0132 && buf[2]==0150) { -#if HAVE_BZ2LIB +#ifdef HAVE_BZ2LIB fclose(f); self->xOpen4Read=xBZ2_Open4Read; self->xClose=xBZ2_Close; @@ -326,7 +326,7 @@ static int xOpen4Read(struct Readable *self, char const* filename) { error("bzip2 compression not compiled in"); #endif } else if (buf[0]==0037 && (buf[1]&255)==0213 && (buf[2]&255)<=8) { -#if HAVE_ZLIB +#ifdef HAVE_ZLIB fclose(f); self->xOpen4Read=xGZ_Open4Read; self->xClose=xGZ_Close;