Skip to content

Commit

Permalink
Build: automatically enable system error messages
Browse files Browse the repository at this point in the history
Define HAVE_STRERROR during configuration.

Before:
$ cs2cs +proj=latlong +to +proj=latlong dummy
<cs2cs>:
Sys errno: 2: <system mess. texts unavail.>
dummy

After:
$ cs2cs +proj=latlong +to +proj=latlong dummy
<cs2cs>:
Sys errno: 2: No such file or directory
dummy
  • Loading branch information
cjmayo authored and kbevers committed Mar 22, 2019
1 parent 371cf6d commit 3182dfb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmake/ProjConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ check_include_files (sys/types.h HAVE_SYS_TYPES_H)
check_include_files (unistd.h HAVE_UNISTD_H)
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)

CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV)
check_function_exists(localeconv HAVE_LOCALECONV)
check_function_exists(strerror HAVE_STRERROR)

# check libm need on unix
check_library_exists(m ceil "" HAVE_LIBM)
Expand Down
3 changes: 3 additions & 0 deletions cmake/proj_config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1

/* Define to 1 if you have the `strerror' function. */
#cmakedefine HAVE_STRERROR 1

/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1

Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ CFLAGS="$save_CFLAGS $C99_MATH"
AC_SEARCH_LIBS([sqrt], [m])

AC_CHECK_FUNC(localeconv, [AC_DEFINE(HAVE_LOCALECONV,1,[Define to 1 if you have localeconv])])
AC_CHECK_FUNCS([strerror])

dnl ---------------------------------------------------------------------------
dnl Check for JNI support.
Expand Down
1 change: 1 addition & 0 deletions src/apps/emess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>

#include "proj_api.h"
#include "proj_config.h"
#define EMESS_ROUTINE
#include "emess.h"

Expand Down

0 comments on commit 3182dfb

Please sign in to comment.