1
0
Fork 0

FGadmin: fix compilation, move CMake stuff to better place, remove old ./configure system

This commit is contained in:
Clément de l'Hamaide 2014-04-30 20:34:05 +02:00
parent 86b3469fbf
commit 6d6e45274f
12 changed files with 66 additions and 373 deletions

View file

@ -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

View file

@ -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)

View file

@ -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"
)

View file

@ -1 +0,0 @@
See the NEWS file in the root of this project.

View file

@ -1 +0,0 @@
See the NEWS file in the root of this project.

View file

@ -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 "======================================"

View file

@ -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 <plib/ul.h>
#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 <stdio.h>
#include <simgear/version.h>
#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, &micro );
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

View file

@ -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)

View file

@ -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 <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> 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 <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> 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 <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> 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 <sys/types.h> does not define. */
/* #undef size_t */

View file

@ -0,0 +1,2 @@
#cmakedefine HAVE_BZ2LIB
#cmakedefine HAVE_ZLIB

View file

@ -20,21 +20,13 @@
//
// $Id$
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string>
#include <FL/Fl.H>
#include <FL/filename.H>
#include <string.h>
#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;
/**

View file

@ -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;