configure.ac 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. # /*
  5. # * Copyright 2021
  6. # *
  7. # * This program is free software: you can redistribute it and/or modify
  8. # * it under the terms of the GNU General Public License as published by
  9. # * the Free Software Foundation, either version 3 of the License, or
  10. # * (at your option) any later version.
  11. # *
  12. # * This program is distributed in the hope that it will be useful,
  13. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # * GNU General Public License for more details.
  16. # *
  17. # * You should have received a copy of the GNU General Public License
  18. # * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. # *
  20. # * SPDX-License-Identifier: GPL-3.0+
  21. # * License-Filename: LICENSE
  22. # *
  23. # */
  24. #
  25. # -*- Autoconf -*-
  26. # Process this file with autoconf to produce a configure script.
  27. # Macro: AC_INIT (package, version, [bug-report], [tarname], [url])
  28. # minor version number is increased at important feature change
  29. # Process with autogen.sh or manual:
  30. # aclocal
  31. # autoheader
  32. # autoconf
  33. # libtoolize --force --automake
  34. # automake -a --gnu --include-deps
  35. # or do this all using autoreconf -fvim
  36. #
  37. # test also using scan-build from llvm clang tools
  38. #
  39. AC_PREREQ([2.69])
  40. AC_INIT([packgpl], [0.4], [unknown])
  41. AC_CONFIG_SRCDIR([src/load.h])
  42. AC_CONFIG_HEADERS([config.h])
  43. AM_INIT_AUTOMAKE
  44. AC_LANG(C)
  45. # Checks for programs.
  46. AC_PROG_AWK
  47. AC_PROG_CC
  48. AC_PROG_MAKE_SET
  49. # Use c99 mode
  50. CFLAGS="$CFLAGS -g -std=c99 -Wall -Wextra -pedantic "
  51. AC_MSG_RESULT($CFLAGS)
  52. # Checks for libraries.
  53. # -lgc is boehm garbage collector for memory allocations
  54. AC_CHECK_LIB([gc], [GC_INIT])
  55. # Checks for header files.
  56. AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h unistd.h])
  57. # Checks for typedefs, structures, and compiler characteristics.
  58. AC_C_INLINE
  59. AC_TYPE_OFF_T
  60. AC_C_RESTRICT
  61. AC_TYPE_SIZE_T
  62. AC_TYPE_UINT32_T
  63. AC_TYPE_UINT8_T
  64. # Checks for library functions.
  65. AC_FUNC_ERROR_AT_LINE
  66. AC_FUNC_MALLOC
  67. AC_FUNC_MMAP
  68. AC_FUNC_REALLOC
  69. AC_CHECK_FUNCS([strchr strdup strerror strtol])
  70. # compilation date in config.h
  71. # CONFIG_DATE=`date +"%a %x %Y"`
  72. CONFIG_DATE=`date +"%a %d %b %Y"`
  73. AC_SUBST(CONFIG_DATE)
  74. AC_DEFINE_UNQUOTED(COMPILE_DATE, ["$CONFIG_DATE"], [Year, month and day this program is compiled.])
  75. # short system name in config.h
  76. CONFIG_UNAME=`uname -s`
  77. AC_SUBST(CONFIG_UNAME)
  78. AC_DEFINE_UNQUOTED(COMPILE_UNAME, ["$CONFIG_UNAME"], [System where this is compiled.])
  79. # final compiler settings
  80. AC_SUBST(PACKAGE_CFLAGS)
  81. AC_SUBST(WARNING_CFLAGS)
  82. AC_CONFIG_FILES([Makefile src/Makefile])
  83. AC_OUTPUT
  84. AC_MSG_NOTICE([
  85. Configuration:
  86. Source code location ${srcdir}
  87. Build code location ${builddir}
  88. Destination prefix ${prefix}
  89. C-Compiler ${CC}
  90. Config CFLAGS "${CFLAGS}"
  91. Config LIBS "${LIBS}"
  92. Config PACKAGE_CFLAGS "$PACKAGE_CFLAGS"
  93. Config COMPILE_DATE "$CONFIG_DATE"
  94. Config COMPILE_UNAME "$CONFIG_UNAME"
  95. ])
  96. # end.